def test_IsotropicSmooth_outputs(): output_map = dict(out_file=dict(), ) outputs = IsotropicSmooth.output_spec() for key, metadata in output_map.items(): for metakey, value in metadata.items(): yield assert_equal, getattr(outputs.traits()[key], metakey), value
def test_IsotropicSmooth_outputs(): output_map = dict(out_file=dict(), ) outputs = IsotropicSmooth.output_spec() for key, metadata in output_map.items(): for metakey, value in metadata.items(): yield assert_equal, getattr(outputs.traits()[key], metakey), value
def smooth_volume(imf, smoothmm): from nipype.interfaces.fsl.maths import IsotropicSmooth if smoothmm > 0: omf = imf + "_smooth" + str(smoothmm) + "mm.nii.gz" isosmooth = IsotropicSmooth() isosmooth.inputs.in_file = imf isosmooth.inputs.fwhm = smoothmm isosmooth.inputs.out_file = omf isosmooth.run() data = nib.load(omf).get_data() os.remove(omf) else: data = nib.load(imf).get_data() return data
def smooth_volume(imf, smoothmm): from nipype.interfaces.fsl.maths import IsotropicSmooth if smoothmm > 0: omf = imf + '_smooth' + str(smoothmm) + 'mm.nii.gz' isosmooth = IsotropicSmooth() isosmooth.inputs.in_file = imf isosmooth.inputs.fwhm = smoothmm isosmooth.inputs.out_file = omf isosmooth.run() data = nib.load(omf).get_data() os.remove(omf) else: data = nib.load(imf).get_data() return data
def test_IsotropicSmooth_inputs(): input_map = dict( args=dict(argstr='%s', ), environ=dict( nohash=True, usedefault=True, ), fwhm=dict( argstr='-s %.5f', mandatory=True, position=4, xor=['sigma'], ), ignore_exception=dict( nohash=True, usedefault=True, ), in_file=dict( argstr='%s', mandatory=True, position=2, ), internal_datatype=dict( argstr='-dt %s', position=1, ), nan2zeros=dict( argstr='-nan', position=3, ), out_file=dict( argstr='%s', genfile=True, hash_files=False, position=-2, ), output_datatype=dict( argstr='-odt %s', position=-1, ), output_type=dict(), sigma=dict( argstr='-s %.5f', mandatory=True, position=4, xor=['fwhm'], ), terminal_output=dict( mandatory=True, nohash=True, ), ) inputs = IsotropicSmooth.input_spec() for key, metadata in input_map.items(): for metakey, value in metadata.items(): yield assert_equal, getattr(inputs.traits()[key], metakey), value
def test_IsotropicSmooth_inputs(): input_map = dict(args=dict(argstr='%s', ), environ=dict(nohash=True, usedefault=True, ), fwhm=dict(argstr='-s %.5f', mandatory=True, position=4, xor=['sigma'], ), ignore_exception=dict(nohash=True, usedefault=True, ), in_file=dict(argstr='%s', mandatory=True, position=2, ), internal_datatype=dict(argstr='-dt %s', position=1, ), nan2zeros=dict(argstr='-nan', position=3, ), out_file=dict(argstr='%s', genfile=True, hash_files=False, position=-2, ), output_datatype=dict(argstr='-odt %s', position=-1, ), output_type=dict(), sigma=dict(argstr='-s %.5f', mandatory=True, position=4, xor=['fwhm'], ), terminal_output=dict(mandatory=True, nohash=True, ), ) inputs = IsotropicSmooth.input_spec() for key, metadata in input_map.items(): for metakey, value in metadata.items(): yield assert_equal, getattr(inputs.traits()[key], metakey), value
interp="sinc", cost='mutualinfo'), name="coreg_to_struct_space") # Warp whole head T1 Structural Image to MNI 152 template warp_to_152_node = Node(legacy.GenWarpFields(similarity_metric="CC"), name="warp152") # coreg_to_template_space_node = Node(ApplyTransforms(reference_image=template, interpolation='BSpline'), name="coreg_to_template_space") coreg_to_template_space_node = Node(ApplyTransforms(interpolation='BSpline'), name="coreg_to_template_space") merge_transforms_node = Node(Merge(2), iterfield=['in2'], name="merge") # Spatial smoothing iso_smooth_node = Node(IsotropicSmooth(fwhm=4, output_type="NIFTI"), name='isoSmooth') #TODO: Use the data sink node in the pipeline data_sink_node = Node(nio.DataSink(base_directory="results_dir", container='warp152_output', infields=['tt']), name='dataSink') def set_template_image(template_image): """ Sets the template image used to register the T1 or epi images to in the coregistration nodes. :param template_image: The path of the template image :return: """
# Warp whole head T1 Structural Image to MNI 152 template warp_to_152 = Node(legacy.GenWarpFields(reference_image=template, similarity_metric="CC"), name="warp152") # 3______________________ # coreg_to_struct_space = Node(FLIRT(apply_xfm=True, reference=struct_image, interp="sinc"), name="coreg") coreg_to_struct_space = Node(FLIRT(apply_xfm=True, interp="sinc"), name="coreg_to_struct_space") coreg_to_template_space = Node(ApplyTransforms(reference_image=template), name="coreg_to_template_space") merge_transforms_node = Node(Merge(2), iterfield=['in2'], name="merge") # Spatial smoothing isoSmooth = Node(IsotropicSmooth(fwhm=4, output_type="NIFTI"), name='isoSmooth') dataSink = Node(nio.DataSink(base_directory="results_dir", container='warp152_output', infields=['tt']), name='dataSink') # Default process base_dir = os.path.abspath("/projects/abeetem/results") #"fmriPipeline") if args['epi_temp'] is not None: base_dir = os.path.abspath('/projects/abeetem/results2') process_timeseries = Workflow(name="process_timeseries", base_dir=base_dir) ''' process_timeseries.connect([