def smooth_data(name='func_smoothed'): from nipype.pipeline.engine import Node, Workflow import nipype.interfaces.utility as util import nipype.interfaces.fsl as fsl flow = Workflow(name) inputnode = Node(util.IdentityInterface(fields=['func_data']), name='inputnode') outputnode = Node(util.IdentityInterface(fields=['func_smoothed']), name='outputnode') smooth = Node(interface=fsl.Smooth(), name='func_smooth_fwhm_4') smooth.inputs.fwhm = 4.0 smooth.terminal_output = 'file' flow.connect(inputnode, 'func_data', smooth, 'in_file') flow.connect(smooth, 'smoothed_file', outputnode, 'func_smoothed') return flow
def smooth_data(name = 'func_smoothed'): from nipype.pipeline.engine import Node, Workflow import nipype.interfaces.utility as util import nipype.interfaces.fsl as fsl flow = Workflow(name) inputnode = Node(util.IdentityInterface(fields=['func_data']), name = 'inputnode') outputnode = Node(util.IdentityInterface(fields=['func_smoothed']), name = 'outputnode') smooth = Node(interface=fsl.Smooth(), name='func_smooth_fwhm_4') smooth.inputs.fwhm = 4.0 smooth.terminal_output = 'file' flow.connect(inputnode, 'func_data' , smooth , 'in_file' ) flow.connect(smooth, 'smoothed_file' , outputnode , 'func_smoothed' ) return flow
if do_recon_all: # two version of recon-all : fs5 and fs6 commands if fsversion == "freesurfer5": if not checkfsVersion("v5"): raise Exception("If I may .. you are using freesurfer 6.0 and requested a freesurfer5 command of recon-all") # we actually do the recon-all fsReconAll = Node(AbcReconAll(), name="fsReconAll5") fsReconAll.inputs.args = ' -3T -contrasurfreg -qcache -no-isrunning' fsReconAll.inputs.directive = 'all' fsReconAll.inputs.environ = {} fsReconAll.ignore_exception = False fsReconAll.inputs.subjects_dir = subjects_dir fsReconAll.terminal_output = 'stream' fsReconAll.inputs.use_FLAIR = use_FLAIR # no need to connect the T1 and T2flair since the process was already initialized in basic_structural ishanat.connect(struct, "outputNode.subject_id", fsReconAll, "subject_id") else: if not checkfsVersion("v6"): raise Exception("If I may .. you are using some freesurfer 5 version and requested a freesurfer6 command of recon-all") # Node: fs.fsReconAll fsReconAll = Node(AbcReconAll(), name="fsReconAll6") fsReconAll.inputs.args = ' -brainstem-structures -3T -contrasurfreg -qcache -no-isrunning' fsReconAll.inputs.directive = 'all' fsReconAll.inputs.environ = {} fsReconAll.ignore_exception = True # may throw an exception that cannot find result files ==> dummy