def get_workflow(wf_name, c): preproc = None """ setup standard file paths """ prior_path = os.path.join(c.priorDirectory, c.standardResolution) PRIOR_CSF = os.path.join(prior_path, 'avg152T1_csf_bin.nii.gz') PRIOR_GRAY = os.path.join(prior_path, 'avg152T1_gray_bin.nii.gz') PRIOR_WHITE = os.path.join(prior_path, 'avg152T1_white_bin.nii.gz') standard_res_brain = os.path.join(c.FSLDIR, 'data/standard/MNI152_T1_%s_brain.nii.gz' % (c.standardResolution)) standard = os.path.join(c.FSLDIR, 'data/standard/MNI152_T1_%s.nii.gz' % (c.standardResolution)) standard_brain_mask_dil = '/home2/ssikka/scripts1/templates/MNI152_T1_%s_brain_mask_dil.nii.gz' % (c.standardResolution) config_file = '/home2/ssikka/scripts1/templates/T1_2_MNI152_%s.cnf' % (c.standardResolution) brain_symmetric = '/home2/ssikka/scripts1/templates/MNI152_T1_2mm_brain_symmetric.nii.gz' symm_standard = '/home2/ssikka/scripts1/templates/MNI152_T1_2mm_symmetric.nii.gz' twomm_brain_mask_dil = '/home2/ssikka/scripts1/templates/MNI152_T1_2mm_brain_mask_symmetric_dil.nii.gz' config_file_twomm = '/home2/ssikka/scripts1/templates/T1_2_MNI152_2mm.cnf' identity_matrix = os.path.join(c.FSLDIR, 'etc/flirtsch/ident.mat') if wf_name.lower() == 'anat': preproc = create_anat_preproc() return preproc if wf_name.lower() == 'func': preproc = create_func_preproc() preproc.inputs.inputspec.start_idx = c.startIdx preproc.inputs.inputspec.stop_idx = c.stopIdx return preproc if wf_name.lower() == 'seg': preproc = create_seg_preproc() preproc.inputs.inputspec.PRIOR_CSF = PRIOR_CSF preproc.inputs.inputspec.PRIOR_WHITE = PRIOR_WHITE preproc.inputs.inputspec.PRIOR_GRAY = PRIOR_GRAY preproc.inputs.inputspec.standard_res_brain = standard_res_brain preproc.inputs.csf_threshold.csf_threshold = \ c.cerebralSpinalFluidThreshold preproc.inputs.wm_threshold.wm_threshold = \ c.whiteMatterThreshold preproc.inputs.gm_threshold.gm_threshold = \ c.grayMatterThreshold preproc.get_node('csf_threshold').iterables = ('csf_threshold', c.cerebralSpinalFluidThreshold) preproc.get_node('wm_threshold').iterables = ('wm_threshold', c.whiteMatterThreshold) preproc.get_node('gm_threshold').iterables = ('gm_threshold', c.grayMatterThreshold) return preproc if wf_name.lower() == 'reg': preproc = create_reg_preproc() preproc.inputs.inputspec.standard_res_brain = \ standard_res_brain preproc.inputs.inputspec.standard = standard preproc.inputs.inputspec.config_file = config_file preproc.inputs.inputspec.standard_brain_mask_dil = \ standard_brain_mask_dil return preproc if wf_name.lower() == 'alff': preproc = create_alff_preproc() preproc.inputs.inputspec.standard = standard preproc.inputs.hp_input.hp = c.highPassFreqALFF preproc.inputs.lp_input.lp = c.lowPassFreqALFF preproc.inputs.fwhm_input.fwhm = c.fwhm preproc.get_node('hp_input').iterables = ('hp', c.highPassFreqALFF) preproc.get_node('lp_input').iterables = ('lp', c.lowPassFreqALFF) preproc.get_node('fwhm_input').iterables = ('fwhm', c.fwhm) return preproc if wf_name.lower() == 'sca': preproc = create_sca_preproc(c.correlationSpace) preproc.inputs.fwhm_input.fwhm = c.fwhm preproc.get_node('fwhm_input').iterables = ('fwhm', c.fwhm) preproc.inputs.inputspec.standard = standard return preproc if wf_name.lower() == 'vmhc': preproc = create_vmhc_preproc() preproc.inputs.inputspec.brain_symmetric = \ brain_symmetric preproc.inputs.inputspec.symm_standard = \ symm_standard preproc.inputs.inputspec.twomm_brain_mask_dil = \ twomm_brain_mask_dil preproc.inputs.inputspec.config_file_twomm = \ config_file_twomm preproc.inputs.inputspec.standard = \ standard return preproc if wf_name.lower() == 'sc': preproc = create_scrubbing_preproc() preproc.inputs.threshold_input.threshold = c.scrubbingThreshold preproc.get_node('threshold_input').iterables = ('threshold', c.scrubbingThreshold) return preproc if wf_name.lower() == 'select': preproc = selector_wf() preproc.inputs.run_scrubbing_input.run_scrubbing = c.scrubData preproc.get_node('run_scrubbing_input').iterables = \ ('run_scrubbing', c.scrubData) return preproc if wf_name.lower() == 'nuisance': preproc = create_nuisance_preproc() preproc.inputs.selector_input.selector = c.Corrections preproc.inputs.nc_input.nc = c.nComponents preproc.inputs.target_angle_deg_input.target_angle_deg = \ c.targetAngleDeg preproc.get_node('selector_input').iterables = \ ('selector', c.Corrections) preproc.get_node('nc_input').iterables = \ ('nc', c.nComponents) preproc.get_node('target_angle_deg_input').iterables = \ ('target_angle_deg', c.targetAngleDeg) return preproc if wf_name.lower() == 'mprage_in_mnioutputs': preproc = mprage_in_mnioutputs() preproc.inputs.inputspec.standard = standard return preproc if wf_name.lower() == 'func_in_mnioutputs': preproc = func_in_mnioutputs() preproc.inputs.inputspec.standard = standard return preproc if wf_name.lower() == 'freq_filter': from base_nuisance import bandpass_voxels import nipype.interfaces.utility as util preproc = pe.MapNode(util.Function(input_names=['realigned_file', 'sample_period', 'bandpass_freqs'], output_names=['bandpassed_file'], function=bandpass_voxels), name='bandpass_filter', iterfield=['realigned_file', 'bandpass_freqs']) preproc.inputs.bandpass_freqs = c.nuisanceBandpassFreq preproc.inputs.sample_period = c.TR return preproc if wf_name.lower() == 'ts': preproc = create_timeseries_preproc(True, True, True, c.runSurfaceRegistraion) preproc.inputs.inputspec.recon_subjects = c.reconSubjectsDirectory preproc.inputs.inputspec.standard = standard preproc.inputs.inputspec.identity_matrix = identity_matrix preproc.inputs.inputspec.unitTSOutputs = [True, True] preproc.inputs.inputspec.voxelTSOutputs = [True, True] preproc.inputs.inputspec.verticesTSOutputs = [True, True] return preproc if wf_name.lower() == 'group_analysis': preproc = create_group_analysis(c.fTest) preproc.inputs.inputspec.z_threshold = c.zThreshold preproc.inputs.inputspec.p_threshold = c.pThreshold preproc.inputs.inputspec.parameters = (c.FSLDIR, c.MNI) return preproc
def get_workflow(wf_name, c): preproc = None """ setup standard file paths """ prior_path = os.path.join(c.priorDirectory, c.standardResolution) PRIOR_CSF = os.path.join(prior_path, 'avg152T1_csf_bin.nii.gz') PRIOR_GRAY = os.path.join(prior_path, 'avg152T1_gray_bin.nii.gz') PRIOR_WHITE = os.path.join(prior_path, 'avg152T1_white_bin.nii.gz') standard_res_brain = os.path.join(c.FSLDIR, 'data/standard/MNI152_T1_%s_brain.nii.gz' % (c.standardResolution)) standard = os.path.join(c.FSLDIR, 'data/standard/MNI152_T1_%s.nii.gz' % (c.standardResolution)) standard_brain_mask_dil = os.path.join(c.FSLDIR, 'data/standard/MNI152_T1_%s_brain_mask_dil.nii.gz' % (c.standardResolution)) config_file = os.path.join(c.FSLDIR, 'etc/flirtsch/T1_2_MNI152_%s.cnf' % (c.standardResolution)) brain_symmetric = os.path.join(c.FSLDIR, 'data/standard/MNI152_T1_2mm_brain_symmetric.nii.gz') symm_standard = os.path.join(c.FSLDIR, 'data/standard/MNI152_T1_2mm_symmetric.nii.gz') twomm_brain_mask_dil = os.path.join(c.FSLDIR, 'data/standard/MNI152_T1_2mm_brain_mask_symmetric_dil.nii.gz') config_file_twomm = os.path.join(c.FSLDIR, 'etc/flirtsch/T1_2_MNI152_2mm.cnf') identity_matrix = os.path.join(c.FSLDIR, 'etc/flirtsch/ident.mat') if wf_name.lower() == 'anat': preproc = create_anat_preproc() return preproc if wf_name.lower() == 'func': preproc = create_func_preproc() preproc.inputs.inputspec.start_idx = c.startIdx preproc.inputs.inputspec.stop_idx = c.stopIdx return preproc if wf_name.lower() == 'seg': preproc = create_seg_preproc() preproc.inputs.inputspec.PRIOR_CSF = PRIOR_CSF preproc.inputs.inputspec.PRIOR_WHITE = PRIOR_WHITE preproc.inputs.inputspec.PRIOR_GRAY = PRIOR_GRAY preproc.inputs.inputspec.standard_res_brain = standard_res_brain preproc.inputs.csf_threshold.csf_threshold = \ c.cerebralSpinalFluidThreshold preproc.inputs.wm_threshold.wm_threshold = \ c.whiteMatterThreshold preproc.inputs.gm_threshold.gm_threshold = \ c.grayMatterThreshold preproc.get_node('csf_threshold').iterables = ('csf_threshold', c.cerebralSpinalFluidThreshold) preproc.get_node('wm_threshold').iterables = ('wm_threshold', c.whiteMatterThreshold) preproc.get_node('gm_threshold').iterables = ('gm_threshold', c.grayMatterThreshold) return preproc if wf_name.lower() == 'reg': preproc = create_reg_preproc() preproc.inputs.inputspec.standard_res_brain = \ standard_res_brain preproc.inputs.inputspec.standard = standard preproc.inputs.inputspec.config_file = config_file preproc.inputs.inputspec.standard_brain_mask_dil = \ standard_brain_mask_dil return preproc if wf_name.lower() == 'alff': preproc = create_alff_preproc(c) preproc.inputs.inputspec.standard = standard preproc.inputs.hp_input.hp = c.highPassFreqALFF preproc.inputs.lp_input.lp = c.lowPassFreqALFF preproc.inputs.fwhm_input.fwhm = c.fwhm preproc.get_node('hp_input').iterables = ('hp', c.highPassFreqALFF) preproc.get_node('lp_input').iterables = ('lp', c.lowPassFreqALFF) preproc.get_node('fwhm_input').iterables = ('fwhm', c.fwhm) return preproc if wf_name.lower() == 'sca': preproc = create_sca_preproc(c.correlationSpace) preproc.inputs.fwhm_input.fwhm = c.fwhm preproc.get_node('fwhm_input').iterables = ('fwhm', c.fwhm) preproc.inputs.inputspec.standard = standard return preproc if wf_name.lower() == 'vmhc': preproc = create_vmhc_preproc(c) preproc.inputs.inputspec.brain_symmetric = \ brain_symmetric preproc.inputs.inputspec.symm_standard = \ symm_standard preproc.inputs.inputspec.twomm_brain_mask_dil = \ twomm_brain_mask_dil preproc.inputs.inputspec.config_file_twomm = \ config_file_twomm preproc.inputs.inputspec.standard = \ standard return preproc if wf_name.lower() == 'sc': preproc = create_scrubbing_preproc() return preproc if wf_name.lower() == 'pm': preproc = create_parameters_preproc(c) preproc.inputs.threshold_input.threshold = c.scrubbingThreshold preproc.get_node('threshold_input').iterables = ('threshold', c.scrubbingThreshold) return preproc if wf_name.lower() == 'select': preproc = selector_wf() preproc.inputs.scrubbed_input.scrubbed = c.scrubData preproc.get_node('scrubbed_input').iterables = \ ('scrubbed', c.scrubData) return preproc if wf_name.lower() == 'nuisance': preproc = create_nuisance_preproc() preproc.inputs.selector_input.selector = c.Corrections preproc.inputs.nc_input.nc = c.nComponents preproc.inputs.target_angle_deg_input.target_angle_deg = \ c.targetAngleDeg preproc.get_node('selector_input').iterables = \ ('selector', c.Corrections) preproc.get_node('nc_input').iterables = \ ('nc', c.nComponents) preproc.get_node('target_angle_deg_input').iterables = \ ('target_angle_deg', c.targetAngleDeg) return preproc if wf_name.lower() == 'mprage_in_mnioutputs': preproc = mprage_in_mnioutputs() preproc.inputs.inputspec.standard = standard return preproc if wf_name.lower() == 'func_in_mnioutputs': preproc = func_in_mnioutputs() preproc.inputs.inputspec.standard = standard return preproc if wf_name.lower() == 'freq_filter': from base_nuisance import bandpass_voxels import nipype.interfaces.utility as util preproc = pe.MapNode(util.Function(input_names=['realigned_file', 'sample_period', 'bandpass_freqs'], output_names=['bandpassed_file'], function=bandpass_voxels), name='bandpass_filter', iterfield=['realigned_file', 'bandpass_freqs', 'sample_period']) preproc.inputs.bandpass_freqs = c.nuisanceBandpassFreq #preproc.inputs.sample_period = c.TR return preproc if wf_name.lower() == 'ts': preproc = create_timeseries_preproc(True, True, True, c.runSurfaceRegistraion) preproc.inputs.inputspec.recon_subjects = c.reconSubjectsDirectory preproc.inputs.inputspec.standard = standard preproc.inputs.inputspec.identity_matrix = identity_matrix preproc.inputs.inputspec.unitTSOutputs = [True, True] preproc.inputs.inputspec.voxelTSOutputs = [True, True] preproc.inputs.inputspec.verticesTSOutputs = [True, True] return preproc if wf_name.lower() == 'group_analysis': preproc = create_group_analysis(c.fTest) preproc.inputs.inputspec.z_threshold = c.zThreshold preproc.inputs.inputspec.p_threshold = c.pThreshold preproc.inputs.inputspec.parameters = (c.FSLDIR, c.MNI) return preproc
# preproc.inputs.lp_input.lp = \ # c.nuisanceLowFreqHighCutOff # preproc.get_node('lp_input').iterables = \ # ('lp', c.nuisanceLowFreqHighCutOff) ======= iterfield=['realigned_file', 'bandpass_freqs', 'sample_period']) preproc.inputs.bandpass_freqs = c.nuisanceBandpassFreq #preproc.inputs.sample_period = c.TR >>>>>>> 4a9c41095b62712d6e6334ceb9941ed8abea3ff1 return preproc if wf_name.lower() == 'ts': preproc = create_timeseries_preproc(True, True, True, c.runSurfaceRegistraion) preproc.inputs.inputspec.recon_subjects = c.reconSubjectsDirectory preproc.inputs.inputspec.standard = standard preproc.inputs.inputspec.identity_matrix = identity_matrix preproc.inputs.inputspec.unitTSOutputs = [True, True] preproc.inputs.inputspec.voxelTSOutputs = [True, True] preproc.inputs.inputspec.verticesTSOutputs = [True, True] return preproc if wf_name.lower() == 'group_analysis': preproc = create_group_analysis(c.fTest) preproc.inputs.inputspec.z_threshold = c.zThreshold preproc.inputs.inputspec.p_threshold = c.pThreshold preproc.inputs.inputspec.parameters = (c.FSLDIR, c.MNI)