예제 #1
0
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
                                        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:
    """
예제 #3
0
# 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([