Skip to content

Commit 4bf1b32

Browse files
aschaeferaschaefer
authored andcommitted
fixed some problems when you did not dilate, a file ROIv was expected which was not created. Further the format of the file was transformed to PEP8
1 parent 396ce9e commit 4bf1b32

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

nipype/interfaces/cmtk/parcellation.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ def create_wm_mask(subject_id, subjects_dir, fs_dir, parcellation_name):
444444
nb.save(img, wm_out)
445445

446446

447-
def crop_and_move_datasets(subject_id, subjects_dir, fs_dir, parcellation_name, out_roi_file):
447+
def crop_and_move_datasets(subject_id, subjects_dir, fs_dir, parcellation_name, out_roi_file,dilation):
448448
fs_dir = op.join(subjects_dir, subject_id)
449449
cmp_config = cmp.configuration.PipelineConfiguration()
450450
cmp_config.parcellation_scheme = "Lausanne2008"
@@ -468,7 +468,8 @@ def crop_and_move_datasets(subject_id, subjects_dir, fs_dir, parcellation_name,
468468

469469
ds.append((op.join(op.curdir, 'ROI_%s.nii.gz' % parcellation_name),
470470
op.join(op.curdir, 'ROI_HR_th.nii.gz')))
471-
ds.append((op.join(op.curdir, 'ROIv_%s.nii.gz' %
471+
if(dilation==True):
472+
ds.append((op.join(op.curdir, 'ROIv_%s.nii.gz' %
472473
parcellation_name), op.join(op.curdir, 'ROIv_HR_th.nii.gz')))
473474
orig = op.join(fs_dir, 'mri', 'orig', '001.mgz')
474475
for d in ds:
@@ -531,7 +532,7 @@ class ParcellateInputSpec(BaseInterfaceInputSpec):
531532
class ParcellateOutputSpec(TraitedSpec):
532533
roi_file = File(
533534
exists=True, desc='Region of Interest file for connectivity mapping')
534-
roiv_file = File(exists=True, desc='Region of Interest file for fMRI connectivity mapping')
535+
roiv_file = File(exists=False, desc='Region of Interest file for fMRI connectivity mapping')
535536
white_matter_mask_file = File(exists=True, desc='White matter mask file')
536537
cc_unknown_file = File(
537538
desc='Image file with regions labelled as unknown cortical structures',
@@ -583,7 +584,7 @@ def _run_interface(self, runtime):
583584
create_annot_label(self.inputs.subject_id, self.inputs.subjects_dir, self.inputs.freesurfer_dir, self.inputs.parcellation_name)
584585
create_roi(self.inputs.subject_id, self.inputs.subjects_dir, self.inputs.freesurfer_dir, self.inputs.parcellation_name, self.inputs.dilation)
585586
create_wm_mask(self.inputs.subject_id, self.inputs.subjects_dir, self.inputs.freesurfer_dir, self.inputs.parcellation_name)
586-
crop_and_move_datasets(self.inputs.subject_id, self.inputs.subjects_dir, self.inputs.freesurfer_dir, self.inputs.parcellation_name, self.inputs.out_roi_file)
587+
crop_and_move_datasets(self.inputs.subject_id, self.inputs.subjects_dir, self.inputs.freesurfer_dir, self.inputs.parcellation_name, self.inputs.out_roi_file,self.inputs.dilation)
587588
return runtime
588589

589590
def _list_outputs(self):
@@ -602,7 +603,7 @@ def _list_outputs(self):
602603
outputs['roi_file_in_structural_space'] = op.abspath(
603604
'ROI_HR_th.nii.gz')
604605
outputs['dilated_roi_file_in_structural_space'] = op.abspath(
605-
'ROI_HR_th.nii.gz')
606+
'ROIv_HR_th.nii.gz')
606607
return outputs
607608

608609
def _gen_outfilename(self, ext, prefix='ROI'):

0 commit comments

Comments
 (0)