totalWorkflow.connect(reorient_struct, 'out_file', myanatproc, 'inputspec.anat') mybbr = bbr.bbr_workflow() totalWorkflow.connect(myanatproc, 'outputspec.brain', mybbr, 'inputspec.skull') #ToDo ready: rather input the brain extracted here? totalWorkflow.connect(reorient_func, 'out_file', mybbr, 'inputspec.func') totalWorkflow.connect(myanatproc, 'outputspec.probmap_wm', mybbr, 'inputspec.anat_wm_segmentation') totalWorkflow.connect(myanatproc, 'outputspec.probmap_csf', mybbr, 'inputspec.anat_csf_segmentation') totalWorkflow.connect(myanatproc, 'outputspec.probmap_gm', mybbr, 'inputspec.anat_gm_segmentation') totalWorkflow.connect(myanatproc, 'outputspec.probmap_ventricle', mybbr, 'inputspec.anat_ventricle_segmentation') compcor_roi = cc.create_anat_noise_roi_workflow() totalWorkflow.connect(mybbr, 'outputspec.wm_mask_in_funcspace', compcor_roi, 'inputspec.wm_mask') totalWorkflow.connect(mybbr, 'outputspec.ventricle_mask_in_funcspace', compcor_roi, 'inputspec.ventricle_mask') # Preprocessing of functional data myfuncproc = funcproc.FuncProc_despike_afni(fwhm=opts.fwhm, carpet_plot="carpet_plots") totalWorkflow.connect(reorient_func, 'out_file', myfuncproc, 'inputspec.func') totalWorkflow.connect(compcor_roi, 'outputspec.noise_roi', myfuncproc, 'inputspec.cc_noise_roi') # Pick atlas pickatlas = tsext.PickAtlas() pickatlas.inputs.inputspec.labelmap = _MISTDIR_ + "/Parcellations/MIST_122.nii.gz" pickatlas.inputs.inputspec.modules = _ATLAS_MODULES pickatlas.inputs.inputspec.labels = _ATLAS_LABELS # Extract timeseries extract_timeseries = tsext.extract_timeseries_nativespace() totalWorkflow.connect(pickatlas, 'outputspec.relabeled_atlas', extract_timeseries, 'inputspec.atlas') totalWorkflow.connect(pickatlas, 'outputspec.reordered_labels', extract_timeseries, 'inputspec.labels') totalWorkflow.connect(pickatlas, 'outputspec.reordered_modules', extract_timeseries, 'inputspec.modules') totalWorkflow.connect(myanatproc, 'outputspec.brain', extract_timeseries, 'inputspec.anat')
#myadding=adding.addimgs_workflow(numimgs=2) add_masks = pe.MapNode(fsl.ImageMaths(op_string=' -add'), iterfield=['in_file', 'in_file2'], name="addimgs") # TODO_ready: erode compcor noise mask!!!! erode_mask = pe.MapNode(fsl.ErodeImage(), iterfield=['in_file'], name="erode_compcor_mask") def pickindex(vec, i): return [x[i] for x in vec] myfuncproc = funcproc.FuncProc() #create atlas matching this space resample_atlas = pe.Node( interface=afni.Resample( outputtype='NIFTI_GZ', in_file="/Users/tspisak/data/atlases/MIST/Parcellations/MIST_7.nii.gz", master=globals._FSLDIR_ + '/data/standard/MNI152_T1_3mm_brain.nii.gz'), name='resample_atlas') #default interpolation is nearest neighbour # standardize what you need myfunc2mni = transform.func2mni(stdreg=_regtype_, carpet_plot="1_original", wf_name="func2mni_1") myfunc2mni_cc = transform.func2mni(stdreg=_regtype_, carpet_plot="2_cc",
# Add arbitrary number of nii images wthin the same space. The default is to add csf and wm masks for anatcompcor calculation. #myadding=adding.addimgs_workflow(numimgs=2) # ToDo_ready: put compcor-related mask handling into a nested pipeline # TODO_ready: erode compcor noise mask!!!! # NOTE: more CSF voxels are retained for compcor when only WM signal is eroded and csf is added to it compcor_roi = cc.create_anat_noise_roi_workflow() totalWorkflow.connect(mybbr, 'outputspec.wm_mask_in_funcspace', compcor_roi, 'inputspec.wm_mask') totalWorkflow.connect(mybbr, 'outputspec.ventricle_mask_in_funcspace', compcor_roi, 'inputspec.ventricle_mask') # Preprocessing of functional data myfuncproc = funcproc.FuncProc_despike_afni(carpet_plot="carpet_plots") totalWorkflow.connect(reorient_func, 'out_file', myfuncproc, 'inputspec.func') totalWorkflow.connect(compcor_roi, 'outputspec.noise_roi', myfuncproc, 'inputspec.cc_noise_roi') # Pick atlas pickatlas = tsext.PickAtlas() pickatlas.inputs.inputspec.labelmap = _MISTDIR_ + "/Parcellations/MIST_122.nii.gz" pickatlas.inputs.inputspec.modules = _ATLAS_MODULES pickatlas.inputs.inputspec.labels = _ATLAS_LABELS # Extract timeseries extract_timeseries = tsext.extract_timeseries_nativespace() totalWorkflow.connect(pickatlas, 'outputspec.relabeled_atlas', extract_timeseries, 'inputspec.atlas') totalWorkflow.connect(pickatlas, 'outputspec.reordered_labels',