@@ -444,7 +444,7 @@ def create_wm_mask(subject_id, subjects_dir, fs_dir, parcellation_name):
444
444
nb .save (img , wm_out )
445
445
446
446
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 ):
448
448
fs_dir = op .join (subjects_dir , subject_id )
449
449
cmp_config = cmp .configuration .PipelineConfiguration ()
450
450
cmp_config .parcellation_scheme = "Lausanne2008"
@@ -468,7 +468,8 @@ def crop_and_move_datasets(subject_id, subjects_dir, fs_dir, parcellation_name,
468
468
469
469
ds .append ((op .join (op .curdir , 'ROI_%s.nii.gz' % parcellation_name ),
470
470
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' %
472
473
parcellation_name ), op .join (op .curdir , 'ROIv_HR_th.nii.gz' )))
473
474
orig = op .join (fs_dir , 'mri' , 'orig' , '001.mgz' )
474
475
for d in ds :
@@ -531,7 +532,7 @@ class ParcellateInputSpec(BaseInterfaceInputSpec):
531
532
class ParcellateOutputSpec (TraitedSpec ):
532
533
roi_file = File (
533
534
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 (desc = 'Region of Interest file for fMRI connectivity mapping' )
535
536
white_matter_mask_file = File (exists = True , desc = 'White matter mask file' )
536
537
cc_unknown_file = File (
537
538
desc = 'Image file with regions labelled as unknown cortical structures' ,
@@ -545,8 +546,7 @@ class ParcellateOutputSpec(TraitedSpec):
545
546
desc = 'ROI image resliced to the dimensions of the original structural image' ,
546
547
exists = True )
547
548
dilated_roi_file_in_structural_space = File (
548
- desc = 'dilated ROI image resliced to the dimensions of the original structural image' ,
549
- exists = True )
549
+ desc = 'dilated ROI image resliced to the dimensions of the original structural image' )
550
550
551
551
552
552
class Parcellate (BaseInterface ):
@@ -583,7 +583,7 @@ def _run_interface(self, runtime):
583
583
create_annot_label (self .inputs .subject_id , self .inputs .subjects_dir , self .inputs .freesurfer_dir , self .inputs .parcellation_name )
584
584
create_roi (self .inputs .subject_id , self .inputs .subjects_dir , self .inputs .freesurfer_dir , self .inputs .parcellation_name , self .inputs .dilation )
585
585
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 )
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 , self . inputs . dilation )
587
587
return runtime
588
588
589
589
def _list_outputs (self ):
@@ -593,16 +593,18 @@ def _list_outputs(self):
593
593
else :
594
594
outputs ['roi_file' ] = op .abspath (
595
595
self ._gen_outfilename ('nii.gz' , 'ROI' ))
596
- outputs ['roiv_file' ] = op .abspath (self ._gen_outfilename (
596
+ if (self .inputs .dilation == True ):
597
+ outputs ['roiv_file' ] = op .abspath (self ._gen_outfilename (
597
598
'nii.gz' , 'ROIv' ))
598
599
outputs ['white_matter_mask_file' ] = op .abspath ('fsmask_1mm.nii.gz' )
599
600
outputs ['cc_unknown_file' ] = op .abspath ('cc_unknown.nii.gz' )
600
601
outputs ['ribbon_file' ] = op .abspath ('ribbon.nii.gz' )
601
602
outputs ['aseg_file' ] = op .abspath ('aseg.nii.gz' )
602
603
outputs ['roi_file_in_structural_space' ] = op .abspath (
603
604
'ROI_HR_th.nii.gz' )
604
- outputs ['dilated_roi_file_in_structural_space' ] = op .abspath (
605
- 'ROI_HR_th.nii.gz' )
605
+ if (self .inputs .dilation == True ):
606
+ outputs ['dilated_roi_file_in_structural_space' ] = op .abspath (
607
+ 'ROIv_HR_th.nii.gz' )
606
608
return outputs
607
609
608
610
def _gen_outfilename (self , ext , prefix = 'ROI' ):
0 commit comments