interfaces.spm.preprocess

ApplyDeformations

Link to code

Inputs:

[Mandatory]
reference_volume: (an existing, uncompressed file (valid extensions:
          [.hdr, .nii, .img]))
deformation_field: (an existing file name)
in_files: (a list of items which are an existing, uncompressed file
          (valid extensions: [.hdr, .nii, .img]))

[Optional]
paths: (a list of items which are a directory name)
        Paths to add to matlabpath
use_v8struct: (a boolean, nipype default value: True)
        Generate SPM8 and higher compatible jobs
interp: (0 <= an integer <= 7)
        degree of b-spline used for interpolation
use_mcr: (a boolean)
        Run m-code using SPM MCR
matlab_cmd: (a unicode string)
        matlab command to use
mfile: (a boolean, nipype default value: True)
        Run m-code using m-file

Outputs:

out_files: (a list of items which are an existing file name)

References:

None

Coregister

Link to code

Use spm_coreg for estimating cross-modality rigid body alignment

http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=39

Examples

>>> import nipype.interfaces.spm as spm
>>> coreg = spm.Coregister()
>>> coreg.inputs.target = 'functional.nii'
>>> coreg.inputs.source = 'structural.nii'
>>> coreg.run() # doctest: +SKIP

Inputs:

[Mandatory]
source: (a list of items which are an existing, uncompressed file
          (valid extensions: [.hdr, .nii, .img]))
        file to register to target
target: (an existing, uncompressed file (valid extensions: [.hdr,
          .nii, .img]))
        reference file to register to

[Optional]
paths: (a list of items which are a directory name)
        Paths to add to matlabpath
write_mask: (a boolean)
        True/False mask output image
write_wrap: (a list of from 3 to 3 items which are an integer (int or
          long))
        Check if interpolation should wrap in [x,y,z]
write_interp: (0 <= an integer <= 7)
        degree of b-spline used for interpolation
use_v8struct: (a boolean, nipype default value: True)
        Generate SPM8 and higher compatible jobs
cost_function: (u'mi' or u'nmi' or u'ecc' or u'ncc')
        cost function, one of:
         'mi' - Mutual Information,
         'nmi' - Normalised Mutual Information,
         'ecc' - Entropy Correlation Coefficient,
         'ncc' - Normalised Cross Correlation
use_mcr: (a boolean)
        Run m-code using SPM MCR
out_prefix: (a string, nipype default value: r)
        coregistered output prefix
mfile: (a boolean, nipype default value: True)
        Run m-code using m-file
matlab_cmd: (a unicode string)
        matlab command to use
tolerance: (a list of items which are a float)
        acceptable tolerance for each of 12 params
separation: (a list of items which are a float)
        sampling separation in mm
apply_to_files: (a list of items which are an existing file name)
        files to apply transformation to
fwhm: (a list of from 2 to 2 items which are a float)
        gaussian smoothing kernel width (mm)
jobtype: (u'estwrite' or u'estimate' or u'write', nipype default
          value: estwrite)
        one of: estimate, write, estwrite

Outputs:

coregistered_files: (a list of items which are an existing file name)
        Coregistered other files
coregistered_source: (a list of items which are an existing file
          name)
        Coregistered source files

References:

None

CreateWarped

Link to code

Apply a flow field estimated by DARTEL to create warped images

http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=190

Examples

>>> import nipype.interfaces.spm as spm
>>> create_warped = spm.CreateWarped()
>>> create_warped.inputs.image_files = ['rc1s1.nii', 'rc1s2.nii']
>>> create_warped.inputs.flowfield_files = ['u_rc1s1_Template.nii', 'u_rc1s2_Template.nii']
>>> create_warped.run() # doctest: +SKIP

Inputs:

[Mandatory]
image_files: (a list of items which are an existing, uncompressed
          file (valid extensions: [.hdr, .nii, .img]))
        A list of files to be warped
flowfield_files: (a list of items which are an existing, uncompressed
          file (valid extensions: [.hdr, .nii, .img]))
        DARTEL flow fields u_rc1*

[Optional]
paths: (a list of items which are a directory name)
        Paths to add to matlabpath
mfile: (a boolean, nipype default value: True)
        Run m-code using m-file
use_v8struct: (a boolean, nipype default value: True)
        Generate SPM8 and higher compatible jobs
interp: (0 <= an integer <= 7)
        degree of b-spline used for interpolation
use_mcr: (a boolean)
        Run m-code using SPM MCR
matlab_cmd: (a unicode string)
        matlab command to use
iterations: (0 <= an integer <= 9)
        The number of iterations: log2(number of time steps)
modulate: (a boolean)
        Modulate images

Outputs:

warped_files: (a list of items which are an existing file name)

References:

None

DARTEL

Link to code

Use spm DARTEL to create a template and flow fields

http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=185

Examples

>>> import nipype.interfaces.spm as spm
>>> dartel = spm.DARTEL()
>>> dartel.inputs.image_files = [['rc1s1.nii','rc1s2.nii'],['rc2s1.nii', 'rc2s2.nii']]
>>> dartel.run() # doctest: +SKIP

Inputs:

[Mandatory]
image_files: (a list of items which are a list of items which are an
          existing, uncompressed file (valid extensions: [.hdr, .nii,
          .img]))
        A list of files to be segmented

[Optional]
paths: (a list of items which are a directory name)
        Paths to add to matlabpath
iteration_parameters: (a list of from 3 to 12 items which are a tuple
          of the form: (1 <= an integer <= 10, a tuple of the form: (a
          float, a float, a float), 1 or 2 or 4 or 8 or 16 or 32 or 64 or
          128 or 256 or 512, 0 or 0.5 or 1 or 2 or 4 or 8 or 16 or 32))
        List of tuples for each iteration
         - Inner iterations
         - Regularization parameters
         - Time points for deformation model
         - smoothing parameter
use_v8struct: (a boolean, nipype default value: True)
        Generate SPM8 and higher compatible jobs
use_mcr: (a boolean)
        Run m-code using SPM MCR
template_prefix: (a unicode string, nipype default value: Template)
        Prefix for template
matlab_cmd: (a unicode string)
        matlab command to use
optimization_parameters: (a tuple of the form: (a float, 1 <= an
          integer <= 8, 1 <= an integer <= 8))
         Optimization settings a tuple
         - LM regularization
         - cycles of multigrid solver
         - relaxation iterations
mfile: (a boolean, nipype default value: True)
        Run m-code using m-file
regularization_form: (u'Linear' or u'Membrane' or u'Bending')
        Form of regularization energy term

Outputs:

dartel_flow_fields: (a list of items which are an existing file name)
        DARTEL flow fields
template_files: (a list of items which are an existing file name)
        Templates from different stages of iteration
final_template_file: (an existing file name)
        final DARTEL template

References:

None

DARTELNorm2MNI

Link to code

Use spm DARTEL to normalize data to MNI space

http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=188

Examples

>>> import nipype.interfaces.spm as spm
>>> nm = spm.DARTELNorm2MNI()
>>> nm.inputs.template_file = 'Template_6.nii'
>>> nm.inputs.flowfield_files = ['u_rc1s1_Template.nii', 'u_rc1s3_Template.nii']
>>> nm.inputs.apply_to_files = ['c1s1.nii', 'c1s3.nii']
>>> nm.inputs.modulate = True
>>> nm.run() # doctest: +SKIP

Inputs:

[Mandatory]
flowfield_files: (a list of items which are an existing, uncompressed
          file (valid extensions: [.hdr, .nii, .img]))
        DARTEL flow fields u_rc1*
template_file: (an existing, uncompressed file (valid extensions:
          [.hdr, .nii, .img]))
        DARTEL template
apply_to_files: (a list of items which are an existing, uncompressed
          file (valid extensions: [.hdr, .nii, .img]))
        Files to apply the transform to

[Optional]
paths: (a list of items which are a directory name)
        Paths to add to matlabpath
voxel_size: (a tuple of the form: (a float, a float, a float))
        Voxel sizes for output file
use_v8struct: (a boolean, nipype default value: True)
        Generate SPM8 and higher compatible jobs
use_mcr: (a boolean)
        Run m-code using SPM MCR
bounding_box: (a tuple of the form: (a float, a float, a float, a
          float, a float, a float))
        Voxel sizes for output file
mfile: (a boolean, nipype default value: True)
        Run m-code using m-file
matlab_cmd: (a unicode string)
        matlab command to use
fwhm: (a list of from 3 to 3 items which are a float or a float)
        3-list of fwhm for each dimension
modulate: (a boolean)
        Modulate out images - no modulation preserves concentrations

Outputs:

normalized_files: (a list of items which are an existing file name)
        Normalized files in MNI space
normalization_parameter_file: (an existing file name)
        Transform parameters to MNI space

References:

None

FieldMap

Link to code

Use the fieldmap toolbox from spm to calculate the voxel displacement map (VDM).

http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=173

To do

Deal with real/imag magnitude images and with the two phase files case.

Examples

>>> from nipype.interfaces.spm import FieldMap
>>> fm = FieldMap()
>>> fm.inputs.phase_file = 'phase.nii'
>>> fm.inputs.magnitude_file = 'magnitude.nii'
>>> fm.inputs.echo_times = (5.19, 7.65)
>>> fm.inputs.blip_direction = 1
>>> fm.inputs.total_readout_time = 15.6
>>> fm.inputs.epi_file = 'epi.nii'
>>> fm.run() # doctest: +SKIP

Inputs:

[Mandatory]
magnitude_file: (an existing file name)
        presubstracted magnitude file
echo_times: (a tuple of the form: (a float, a float))
        short and long echo times
blip_direction: (1 or -1)
        polarity of the phase-encode blips
epi_file: (an existing file name)
        EPI to unwarp
total_readout_time: (a float)
        total EPI readout time
phase_file: (an existing file name)
        presubstracted phase file

[Optional]
writeunwarped: (a boolean, nipype default value: False)
        write unwarped EPI
use_v8struct: (a boolean, nipype default value: True)
        Generate SPM8 and higher compatible jobs
matlab_cmd: (a unicode string)
        matlab command to use
nerode: (an integer >= 0, nipype default value: 2)
        number of erosions
ndilate: (an integer >= 0, nipype default value: 4)
        number of erosions
paths: (a list of items which are a directory name)
        Paths to add to matlabpath
mask_fwhm: (an integer >= 0, nipype default value: 5)
        gaussian smoothing kernel width
maskbrain: (a boolean, nipype default value: True)
        masking or no masking of the brain
pad: (an integer >= 0, nipype default value: 0)
        padding kernel width
matchvdm: (a boolean, nipype default value: True)
        match VDM to EPI
anat_file: (an existing file name)
        anatomical image for comparison
method: (u'Mark3D' or u'Mark2D' or u'Huttonish', nipype default
          value: Mark3D)
        One of: Mark3D, Mark2D, Huttonish
template: (an existing file name)
        template image for brain masking
epifm: (a boolean, nipype default value: False)
        epi-based field map
matchanat: (a boolean, nipype default value: True)
        match anatomical image to EPI
use_mcr: (a boolean)
        Run m-code using SPM MCR
thresh: (a float, nipype default value: 0.5)
        threshold used to create brain mask from segmented data
jacobian_modulation: (a boolean, nipype default value: False)
        jacobian modulation
reg: (a float, nipype default value: 0.02)
        regularization value used in the segmentation
unwarp_fwhm: (an integer >= 0, nipype default value: 10)
        gaussian smoothing kernel width
mfile: (a boolean, nipype default value: True)
        Run m-code using m-file
ws: (a boolean, nipype default value: True)
        weighted smoothing
sessname: (a unicode string, nipype default value: _run-)
        VDM filename extension
jobtype: (u'calculatevdm' or u'applyvdm', nipype default value:
          calculatevdm)
        one of: calculatevdm, applyvdm

Outputs:

vdm: (an existing file name)
        voxel difference map

References:

None

NewSegment

Link to code

Use spm_preproc8 (New Segment) to separate structural images into different tissue classes. Supports multiple modalities.

NOTE: This interface currently supports single channel input only

http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=43

Examples

>>> import nipype.interfaces.spm as spm
>>> seg = spm.NewSegment()
>>> seg.inputs.channel_files = 'structural.nii'
>>> seg.inputs.channel_info = (0.0001, 60, (True, True))
>>> seg.run() # doctest: +SKIP

For VBM pre-processing [http://www.fil.ion.ucl.ac.uk/~john/misc/VBMclass10.pdf], TPM.nii should be replaced by /path/to/spm8/toolbox/Seg/TPM.nii

>>> seg = NewSegment()
>>> seg.inputs.channel_files = 'structural.nii'
>>> tissue1 = (('TPM.nii', 1), 2, (True,True), (False, False))
>>> tissue2 = (('TPM.nii', 2), 2, (True,True), (False, False))
>>> tissue3 = (('TPM.nii', 3), 2, (True,False), (False, False))
>>> tissue4 = (('TPM.nii', 4), 2, (False,False), (False, False))
>>> tissue5 = (('TPM.nii', 5), 2, (False,False), (False, False))
>>> seg.inputs.tissues = [tissue1, tissue2, tissue3, tissue4, tissue5]
>>> seg.run() # doctest: +SKIP

Inputs:

[Mandatory]
channel_files: (a list of items which are an existing, uncompressed
          file (valid extensions: [.hdr, .nii, .img]))
        A list of files to be segmented

[Optional]
paths: (a list of items which are a directory name)
        Paths to add to matlabpath
write_deformation_fields: (a list of from 2 to 2 items which are a
          boolean)
        Which deformation fields to write:[Inverse, Forward]
tissues: (a list of items which are a tuple of the form: (a tuple of
          the form: (an existing, uncompressed file (valid extensions:
          [.hdr, .nii, .img]), an integer (int or long)), an integer (int or
          long), a tuple of the form: (a boolean, a boolean), a tuple of the
          form: (a boolean, a boolean)))
        A list of tuples (one per tissue) with the following fields:
         - tissue probability map (4D), 1-based index to frame
         - number of gaussians
         - which maps to save [Native, DARTEL] - a tuple of two boolean
        values
         - which maps to save [Unmodulated, Modulated] - a tuple of two
        boolean values
sampling_distance: (a float)
        Sampling distance on data for parameter estimation
use_v8struct: (a boolean, nipype default value: True)
        Generate SPM8 and higher compatible jobs
warping_regularization: (a list of from 5 to 5 items which are a
          float or a float)
        Warping regularization parameter(s). Accepts float or list of floats
        (the latter is required by SPM12)
use_mcr: (a boolean)
        Run m-code using SPM MCR
affine_regularization: (u'mni' or u'eastern' or u'subj' or u'none')
        mni, eastern, subj, none
mfile: (a boolean, nipype default value: True)
        Run m-code using m-file
matlab_cmd: (a unicode string)
        matlab command to use
channel_info: (a tuple of the form: (a float, a float, a tuple of the
          form: (a boolean, a boolean)))
        A tuple with the following fields:
         - bias reguralisation (0-10)
         - FWHM of Gaussian smoothness of bias
         - which maps to save (Field, Corrected) - a tuple of two boolean
        values

Outputs:

modulated_class_images: (a list of items which are a list of items
          which are an existing file name)
        modulated+normalized class images
normalized_class_images: (a list of items which are a list of items
          which are an existing file name)
        normalized class images
bias_field_images: (a list of items which are an existing file name)
        bias field images
bias_corrected_images: (a list of items which are an existing file
          name)
        bias corrected images
inverse_deformation_field: (a list of items which are an existing
          file name)
dartel_input_images: (a list of items which are a list of items which
          are an existing file name)
        dartel imported class images
transformation_mat: (a list of items which are an existing file name)
        Normalization transformation
native_class_images: (a list of items which are a list of items which
          are an existing file name)
        native space probability maps
forward_deformation_field: (a list of items which are an existing
          file name)

References:

None

Normalize

Link to code

use spm_normalise for warping an image to a template

http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=203

Examples

>>> import nipype.interfaces.spm as spm
>>> norm = spm.Normalize()
>>> norm.inputs.source = 'functional.nii'
>>> norm.run() # doctest: +SKIP

Inputs:

[Mandatory]
source: (a list of items which are an existing, uncompressed file
          (valid extensions: [.hdr, .nii, .img]))
        file to normalize to template
        mutually_exclusive: parameter_file
parameter_file: (a file name)
        normalization parameter file*_sn.mat
        mutually_exclusive: source, template
template: (an existing file name)
        template file to normalize to
        mutually_exclusive: parameter_file

[Optional]
write_interp: (0 <= an integer <= 7)
        degree of b-spline used for interpolation
use_v8struct: (a boolean, nipype default value: True)
        Generate SPM8 and higher compatible jobs
write_voxel_sizes: (a list of from 3 to 3 items which are a float)
        3-element list
write_bounding_box: (a list of from 2 to 2 items which are a list of
          from 3 to 3 items which are a float)
        3x2-element list of lists
matlab_cmd: (a unicode string)
        matlab command to use
write_wrap: (a list of items which are an integer (int or long))
        Check if interpolation should wrap in [x,y,z] - list of bools
paths: (a list of items which are a directory name)
        Paths to add to matlabpath
nonlinear_iterations: (an integer (int or long))
        Number of iterations of nonlinear warping
source_image_smoothing: (a float)
        source smoothing
source_weight: (a file name)
        name of weighting image for source
mfile: (a boolean, nipype default value: True)
        Run m-code using m-file
write_preserve: (a boolean)
        True/False warped images are modulated
affine_regularization_type: (u'mni' or u'size' or u'none')
        mni, size, none
out_prefix: (a string, nipype default value: w)
        normalized output prefix
use_mcr: (a boolean)
        Run m-code using SPM MCR
DCT_period_cutoff: (a float)
        Cutoff of for DCT bases
nonlinear_regularization: (a float)
        the amount of the regularization for the nonlinear part of the
        normalization
apply_to_files: (a list of items which are an existing file name or a
          list of items which are an existing file name)
        files to apply transformation to
template_weight: (a file name)
        name of weighting image for template
template_image_smoothing: (a float)
        template smoothing
jobtype: (u'estwrite' or u'est' or u'write', nipype default value:
          estwrite)
        Estimate, Write or do both

Outputs:

normalized_source: (a list of items which are an existing file name)
        Normalized source files
normalized_files: (a list of items which are an existing file name)
        Normalized other files
normalization_parameters: (a list of items which are an existing file
          name)
        MAT files containing the normalization parameters

References:

None

Normalize12

Link to code

uses SPM12’s new Normalise routine for warping an image to a template. Spatial normalisation is now done via the segmentation routine (which was known as New Segment in SPM8). Note that the normalisation in SPM12 is done towards a file containing multiple tissue probability maps, which was not the case in SPM8.

http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=49

Examples

>>> import nipype.interfaces.spm as spm
>>> norm12 = spm.Normalize12()
>>> norm12.inputs.image_to_align = 'structural.nii'
>>> norm12.inputs.apply_to_files = 'functional.nii'
>>> norm12.run() # doctest: +SKIP

Inputs:

[Mandatory]
deformation_file: (a uncompressed file (valid extensions: [.hdr,
          .nii, .img]))
        file y_*.nii containing 3 deformation fields for the deformation in
        x, y and z dimension
        mutually_exclusive: image_to_align, tpm
image_to_align: (an existing, uncompressed file (valid extensions:
          [.hdr, .nii, .img]))
        file to estimate normalization parameters with
        mutually_exclusive: deformation_file

[Optional]
paths: (a list of items which are a directory name)
        Paths to add to matlabpath
bias_fwhm: (30 or 40 or 50 or 60 or 70 or 80 or 90 or 100 or 110 or
          120 or 130 or 140 or 150 or u'Inf')
        FWHM of Gaussian smoothness of bias
bias_regularization: (0 or 1e-05 or 0.0001 or 0.001 or 0.01 or 0.1 or
          1 or 10)
        no(0) - extremely heavy (10)
write_interp: (0 <= an integer <= 7)
        degree of b-spline used for interpolation
affine_regularization_type: (u'mni' or u'size' or u'none')
        mni, size, none
mfile: (a boolean, nipype default value: True)
        Run m-code using m-file
use_v8struct: (a boolean, nipype default value: True)
        Generate SPM8 and higher compatible jobs
write_voxel_sizes: (a list of from 3 to 3 items which are a float)
        3-element list representing the voxel sizes (in mm) of the written
        normalised images
warping_regularization: (a list of from 5 to 5 items which are a
          float)
        controls balance between parameters and data
write_bounding_box: (a list of from 2 to 2 items which are a list of
          from 3 to 3 items which are a float)
        3x2-element list of lists representing the bounding box (in mm) to
        be written
out_prefix: (a string, nipype default value: w)
        Normalized output prefix
use_mcr: (a boolean)
        Run m-code using SPM MCR
tpm: (an existing file name)
        template in form of tissue probablitiy maps to normalize to
        mutually_exclusive: deformation_file
matlab_cmd: (a unicode string)
        matlab command to use
apply_to_files: (a list of items which are an existing, uncompressed
          file (valid extensions: [.hdr, .nii, .img]) or a list of items
          which are an existing, uncompressed file (valid extensions: [.hdr,
          .nii, .img]))
        files to apply transformation to
sampling_distance: (a float)
        Sampling distance on data for parameter estimation
smoothness: (a float)
        value (in mm) to smooth the data before normalization
jobtype: (u'estwrite' or u'est' or u'write', nipype default value:
          estwrite)
        Estimate, Write or do Both

Outputs:

normalized_image: (a list of items which are an existing file name)
        Normalized file that needed to be aligned
deformation_field: (a list of items which are an existing file name)
        NIfTI file containing 3 deformation fields for the deformation in x,
        y and z dimension
normalized_files: (a list of items which are an existing file name)
        Normalized other files

References:

None

Realign

Link to code

Use spm_realign for estimating within modality rigid body alignment

http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=25

Examples

>>> import nipype.interfaces.spm as spm
>>> realign = spm.Realign()
>>> realign.inputs.in_files = 'functional.nii'
>>> realign.inputs.register_to_mean = True
>>> realign.run() # doctest: +SKIP

Inputs:

[Mandatory]
in_files: (a list of items which are an existing, uncompressed file
          (valid extensions: [.hdr, .nii, .img]) or a list of items which
          are an existing, uncompressed file (valid extensions: [.hdr, .nii,
          .img]))
        list of filenames to realign

[Optional]
paths: (a list of items which are a directory name)
        Paths to add to matlabpath
write_mask: (a boolean)
        True/False mask output image
register_to_mean: (a boolean)
        Indicate whether realignment is done to the mean image
separation: (a floating point number >= 0.0)
        sampling separation in mm
write_interp: (0 <= an integer <= 7)
        degree of b-spline used for interpolation
use_v8struct: (a boolean, nipype default value: True)
        Generate SPM8 and higher compatible jobs
interp: (0 <= an integer <= 7)
        degree of b-spline used for interpolation
out_prefix: (a string, nipype default value: r)
        realigned output prefix
use_mcr: (a boolean)
        Run m-code using SPM MCR
write_which: (a list of items which are a value of type 'int', nipype
          default value: [2, 1])
        determines which images to reslice
mfile: (a boolean, nipype default value: True)
        Run m-code using m-file
matlab_cmd: (a unicode string)
        matlab command to use
weight_img: (an existing file name)
        filename of weighting image
write_wrap: (a list of from 3 to 3 items which are an integer (int or
          long))
        Check if interpolation should wrap in [x,y,z]
jobtype: (u'estwrite' or u'estimate' or u'write', nipype default
          value: estwrite)
        one of: estimate, write, estwrite
wrap: (a list of from 3 to 3 items which are an integer (int or
          long))
        Check if interpolation should wrap in [x,y,z]
quality: (0.0 <= a floating point number <= 1.0)
        0.1 = fast, 1.0 = precise
fwhm: (a floating point number >= 0.0)
        gaussian smoothing kernel width

Outputs:

realignment_parameters: (a list of items which are an existing file
          name)
        Estimated translation and rotation parameters
modified_in_files: (a list of items which are a list of items which
          are an existing file name or an existing file name)
        Copies of all files passed to in_files. Headers will have been
        modified to align all images with the first, or optionally to first
        do that, extract a mean image, and re-align to that mean image.
realigned_files: (a list of items which are a list of items which are
          an existing file name or an existing file name)
        If jobtype is write or estwrite, these will be the resliced files.
        Otherwise, they will be copies of in_files that have had their
        headers rewritten.
mean_image: (an existing file name)
        Mean image file from the realignment

References:

None

RealignUnwarp

Link to code

Use spm_uw_estimate for estimating within subject registration and unwarping of time series. Function accepts only one single field map. If in_files is a list of files they will be treated as separate sessions but associated to the same fieldmap.

http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=31

Examples

>>> import nipype.interfaces.spm as spm
>>> realignUnwarp = spm.RealignUnwarp()
>>> realignUnwarp.inputs.in_files = ['functional.nii', 'functional2.nii']
>>> realignUnwarp.inputs.phase_map = 'voxeldisplacemap.vdm'
>>> realignUnwarp.inputs.register_to_mean = True
>>> realignUnwarp.run() # doctest: +SKIP

Inputs:

[Mandatory]
in_files: (a list of items which are an existing, uncompressed file
          (valid extensions: [.hdr, .nii, .img]) or a list of items which
          are an existing, uncompressed file (valid extensions: [.hdr, .nii,
          .img]))
        list of filenames to realign and unwarp

[Optional]
est_taylor_expansion_point: (a string, nipype default value: Average)
        Point in position space to perform Taylor-expansion around.
phase_map: (a file name)
        Voxel displacement map to use in unwarping. Unlike SPM standard
        behaviour, the same map will be used for all sessions
est_unwarp_fwhm: (a floating point number >= 0.0)
        gaussian smoothing kernel width for unwarp
est_basis_func: (a list of from 2 to 2 items which are an integer
          (int or long))
        Number of basis functions to use for each dimension
use_v8struct: (a boolean, nipype default value: True)
        Generate SPM8 and higher compatible jobs
interp: (0 <= an integer <= 7)
        degree of b-spline used for interpolation
est_first_order_effects: (a list of from 1 to 6 items which are an
          integer (int or long))
        First order effects should only depend on pitch and roll, i.e. [4 5]
reslice_interp: (0 <= an integer <= 7)
        degree of b-spline used for interpolation
est_num_of_iterations: (a list of items which are a value of type
          'int', nipype default value: [5])
        Number of iterations.
matlab_cmd: (a unicode string)
        matlab command to use
est_reg_order: (0 <= an integer <= 3)
        This parameter determines how to balance the compromise between
        likelihood maximization and smoothness maximization of the estimated
        field.
wrap: (a list of from 3 to 3 items which are an integer (int or
          long))
        Check if interpolation should wrap in [x,y,z]
fwhm: (a floating point number >= 0.0)
        gaussian smoothing kernel width
paths: (a list of items which are a directory name)
        Paths to add to matlabpath
quality: (0.0 <= a floating point number <= 1.0)
        0.1 = fast, 1.0 = precise
mfile: (a boolean, nipype default value: True)
        Run m-code using m-file
register_to_mean: (a boolean)
        Indicate whether realignment is done to the mean image
est_jacobian_deformations: (a boolean)
        Jacobian deformations. In theory a good idea to include them, in
        practice a bad idea. Default: No.
out_prefix: (a string, nipype default value: u)
        realigned and unwarped output prefix
use_mcr: (a boolean)
        Run m-code using SPM MCR
est_second_order_effects: (a list of from 1 to 6 items which are an
          integer (int or long))
        List of second order terms to model second derivatives of.
separation: (a floating point number >= 0.0)
        sampling separation in mm
reslice_mask: (a boolean)
        True/False mask output image
reslice_which: (a list of items which are a value of type 'int',
          nipype default value: [2, 1])
        determines which images to reslice
est_reg_factor: (a list of items which are a value of type 'int',
          nipype default value: [100000])
        Regularisation factor. Default: 100000 (medium).
est_re_est_mov_par: (a boolean)
        Re-estimate movement parameters at each unwarping iteration.
reslice_wrap: (a list of from 3 to 3 items which are an integer (int
          or long))
        Check if interpolation should wrap in [x,y,z]
weight_img: (an existing file name)
        filename of weighting image

Outputs:

realigned_unwarped_files: (a list of items which are a list of items
          which are an existing file name or an existing file name)
        Realigned and unwarped files written to disc.
realignment_parameters: (a list of items which are an existing file
          name)
        Estimated translation and rotation parameters
modified_in_files: (a list of items which are a list of items which
          are an existing file name or an existing file name)
        Copies of all files passed to in_files. Headers will have been
        modified to align all images with the first, or optionally to first
        do that, extract a mean image, and re-align to that mean image.
mean_image: (an existing file name)
        Mean image file from the realignment & unwarping

References:

None

Segment

Link to code

use spm_segment to separate structural images into different tissue classes.

http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=209

Examples

>>> import nipype.interfaces.spm as spm
>>> seg = spm.Segment()
>>> seg.inputs.data = 'structural.nii'
>>> seg.run() # doctest: +SKIP

Inputs:

[Mandatory]
data: (a list of items which are an existing, uncompressed file
          (valid extensions: [.hdr, .nii, .img]))
        one scan per subject

[Optional]
csf_output_type: (a list of from 3 to 3 items which are a boolean)
         Options to produce CSF images: c3*.img, wc3*.img and mwc3*.img.
         None: [False,False,False],
         Native Space: [False,False,True],
         Unmodulated Normalised: [False,True,False],
         Modulated Normalised: [True,False,False],
         Native + Unmodulated Normalised: [False,True,True],
         Native + Modulated Normalised: [True,False,True],
         Native + Modulated + Unmodulated: [True,True,True],
         Modulated + Unmodulated Normalised: [True,True,False]
paths: (a list of items which are a directory name)
        Paths to add to matlabpath
clean_masks: (u'no' or u'light' or u'thorough')
        clean using estimated brain mask ('no','light','thorough')
bias_fwhm: (30 or 40 or 50 or 60 or 70 or 80 or 90 or 100 or 110 or
          120 or 130 or u'Inf')
        FWHM of Gaussian smoothness of bias
mask_image: (an existing file name)
        Binary image to restrict parameter estimation
bias_regularization: (0 or 1e-05 or 0.0001 or 0.001 or 0.01 or 0.1 or
          1 or 10)
        no(0) - extremely heavy (10)
warp_frequency_cutoff: (a float)
        Cutoff of DCT bases
affine_regularization: (u'mni' or u'eastern' or u'subj' or u'none' or
          u'')
        Possible options: "mni", "eastern", "subj", "none" (no
        reguralisation), "" (no affine registration)
use_v8struct: (a boolean, nipype default value: True)
        Generate SPM8 and higher compatible jobs
warping_regularization: (a float)
        Controls balance between parameters and data
use_mcr: (a boolean)
        Run m-code using SPM MCR
gm_output_type: (a list of from 3 to 3 items which are a boolean)
        Options to produce grey matter images: c1*.img, wc1*.img and
        mwc1*.img.
         None: [False,False,False],
         Native Space: [False,False,True],
         Unmodulated Normalised: [False,True,False],
         Modulated Normalised: [True,False,False],
         Native + Unmodulated Normalised: [False,True,True],
         Native + Modulated Normalised: [True,False,True],
         Native + Modulated + Unmodulated: [True,True,True],
         Modulated + Unmodulated Normalised: [True,True,False]
tissue_prob_maps: (a list of items which are an existing file name)
        list of gray, white & csf prob. (opt,)
sampling_distance: (a float)
        Sampling distance on data for parameter estimation
matlab_cmd: (a unicode string)
        matlab command to use
mfile: (a boolean, nipype default value: True)
        Run m-code using m-file
save_bias_corrected: (a boolean)
        True/False produce a bias corrected image
wm_output_type: (a list of from 3 to 3 items which are a boolean)
         Options to produce white matter images: c2*.img, wc2*.img and
        mwc2*.img.
         None: [False,False,False],
         Native Space: [False,False,True],
         Unmodulated Normalised: [False,True,False],
         Modulated Normalised: [True,False,False],
         Native + Unmodulated Normalised: [False,True,True],
         Native + Modulated Normalised: [True,False,True],
         Native + Modulated + Unmodulated: [True,True,True],
         Modulated + Unmodulated Normalised: [True,True,False]
gaussians_per_class: (a list of items which are an integer (int or
          long))
        num Gaussians capture intensity distribution

Outputs:

bias_corrected_image: (a file name)
        bias-corrected version of input image
native_csf_image: (a file name)
        native space csf probability map
normalized_wm_image: (a file name)
        normalized white probability map
modulated_wm_image: (a file name)
        modulated, normalized white probability map
modulated_input_image: (a file name)
        bias-corrected version of input image
native_wm_image: (a file name)
        native space white probability map
inverse_transformation_mat: (an existing file name)
        Inverse normalization info
transformation_mat: (an existing file name)
        Normalization transformation
normalized_csf_image: (a file name)
        normalized csf probability map
modulated_gm_image: (a file name)
        modulated, normalized grey probability map
modulated_csf_image: (a file name)
        modulated, normalized csf probability map
native_gm_image: (a file name)
        native space grey probability map
normalized_gm_image: (a file name)
        normalized grey probability map

References:

None

SliceTiming

Link to code

Use spm to perform slice timing correction.

http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=19

Examples

>>> from nipype.interfaces.spm import SliceTiming
>>> st = SliceTiming()
>>> st.inputs.in_files = 'functional.nii'
>>> st.inputs.num_slices = 32
>>> st.inputs.time_repetition = 6.0
>>> st.inputs.time_acquisition = 6. - 6./32.
>>> st.inputs.slice_order = list(range(32,0,-1))
>>> st.inputs.ref_slice = 1
>>> st.run() # doctest: +SKIP

Inputs:

[Mandatory]
time_repetition: (a float)
        time between volume acquisitions(start to start time)
in_files: (a list of items which are a list of items which are an
          existing, uncompressed file (valid extensions: [.hdr, .nii, .img])
          or an existing, uncompressed file (valid extensions: [.hdr, .nii,
          .img]))
        list of filenames to apply slice timing
num_slices: (an integer (int or long))
        number of slices in a volume
ref_slice: (an integer (int or long))
        1-based Number of the reference slice or reference time point if
        slice_order is in onsets (ms)
time_acquisition: (a float)
        time of volume acquisition. usuallycalculated as TR-(TR/num_slices)
slice_order: (a list of items which are a float)
        1-based order or onset (in ms) in which slices are acquired

[Optional]
paths: (a list of items which are a directory name)
        Paths to add to matlabpath
mfile: (a boolean, nipype default value: True)
        Run m-code using m-file
use_v8struct: (a boolean, nipype default value: True)
        Generate SPM8 and higher compatible jobs
out_prefix: (a string, nipype default value: a)
        slicetimed output prefix
matlab_cmd: (a unicode string)
        matlab command to use
use_mcr: (a boolean)
        Run m-code using SPM MCR

Outputs:

timecorrected_files: (a list of items which are a list of items which
          are an existing file name or an existing file name)
        slice time corrected files

References:

None

Smooth

Link to code

Use spm_smooth for 3D Gaussian smoothing of image volumes.

http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=55

Examples

>>> import nipype.interfaces.spm as spm
>>> smooth = spm.Smooth()
>>> smooth.inputs.in_files = 'functional.nii'
>>> smooth.inputs.fwhm = [4, 4, 4]
>>> smooth.run() # doctest: +SKIP

Inputs:

[Mandatory]
in_files: (a list of items which are an existing, uncompressed file
          (valid extensions: [.hdr, .nii, .img]))
        list of files to smooth

[Optional]
implicit_masking: (a boolean)
        A mask implied by a particularvoxel value
paths: (a list of items which are a directory name)
        Paths to add to matlabpath
mfile: (a boolean, nipype default value: True)
        Run m-code using m-file
data_type: (an integer (int or long))
        Data type of the output images
use_v8struct: (a boolean, nipype default value: True)
        Generate SPM8 and higher compatible jobs
out_prefix: (a string, nipype default value: s)
        smoothed output prefix
matlab_cmd: (a unicode string)
        matlab command to use
use_mcr: (a boolean)
        Run m-code using SPM MCR
fwhm: (a list of from 3 to 3 items which are a float or a float)
        3-list of fwhm for each dimension

Outputs:

smoothed_files: (a list of items which are an existing file name)
        smoothed files

References:

None

VBMSegment

Link to code

Use VBM8 toolbox to separate structural images into different tissue classes.

Example

>>> import nipype.interfaces.spm as spm
>>> seg = spm.VBMSegment()
>>> seg.inputs.tissues = 'TPM.nii'
>>> seg.inputs.dartel_template = 'Template_1_IXI550_MNI152.nii'
>>> seg.inputs.bias_corrected_native = True
>>> seg.inputs.gm_native = True
>>> seg.inputs.wm_native = True
>>> seg.inputs.csf_native = True
>>> seg.inputs.pve_label_native = True
>>> seg.inputs.deformation_field = (True, False)
>>> seg.run() # doctest: +SKIP

Inputs:

[Mandatory]
in_files: (a list of items which are an existing, uncompressed file
          (valid extensions: [.hdr, .nii, .img]))
        A list of files to be segmented

[Optional]
csf_dartel: (0 <= an integer <= 2, nipype default value: 0)
        0=None,1=rigid(SPM8 default),2=affine
csf_modulated_normalized: (0 <= an integer <= 2, nipype default
          value: 2)
        0=none,1=affine+non-linear(SPM8 default),2=non-linear only
cleanup_partitions: (an integer (int or long), nipype default value:
          1)
        0=None,1=light,2=thorough
gm_dartel: (0 <= an integer <= 2, nipype default value: 0)
        0=None,1=rigid(SPM8 default),2=affine
use_v8struct: (a boolean, nipype default value: True)
        Generate SPM8 and higher compatible jobs
dartel_template: (an existing, uncompressed file (valid extensions:
          [.hdr, .nii, .img]))
warping_regularization: (a float, nipype default value: 4)
        Controls balance between parameters and data
use_sanlm_denoising_filter: (0 <= an integer <= 2, nipype default
          value: 2)
        0=No denoising, 1=denoising,2=denoising multi-threaded
matlab_cmd: (a unicode string)
        matlab command to use
csf_normalized: (a boolean, nipype default value: False)
pve_label_dartel: (0 <= an integer <= 2, nipype default value: 0)
        0=None,1=rigid(SPM8 default),2=affine
bias_corrected_normalized: (a boolean, nipype default value: True)
paths: (a list of items which are a directory name)
        Paths to add to matlabpath
sampling_distance: (a float, nipype default value: 3)
        Sampling distance on data for parameter estimation
wm_native: (a boolean, nipype default value: False)
wm_modulated_normalized: (0 <= an integer <= 2, nipype default value:
          2)
        0=none,1=affine+non-linear(SPM8 default),2=non-linear only
pve_label_native: (a boolean, nipype default value: False)
bias_corrected_affine: (a boolean, nipype default value: False)
gm_native: (a boolean, nipype default value: False)
gm_modulated_normalized: (0 <= an integer <= 2, nipype default value:
          2)
        0=none,1=affine+non-linear(SPM8 default),2=non-linear only
bias_corrected_native: (a boolean, nipype default value: False)
spatial_normalization: (u'high' or u'low', nipype default value:
          high)
csf_native: (a boolean, nipype default value: False)
gm_normalized: (a boolean, nipype default value: False)
display_results: (a boolean, nipype default value: True)
jacobian_determinant: (a boolean, nipype default value: False)
tissues: (an existing, uncompressed file (valid extensions: [.hdr,
          .nii, .img]))
        tissue probability map
use_mcr: (a boolean)
        Run m-code using SPM MCR
wm_dartel: (0 <= an integer <= 2, nipype default value: 0)
        0=None,1=rigid(SPM8 default),2=affine
bias_regularization: (0 or 1e-05 or 0.0001 or 0.001 or 0.01 or 0.1 or
          1 or 10, nipype default value: 0.0001)
        no(0) - extremely heavy (10)
mrf_weighting: (a float, nipype default value: 0.15)
bias_fwhm: (30 or 40 or 50 or 60 or 70 or 80 or 90 or 100 or 110 or
          120 or 130 or u'Inf', nipype default value: 60)
        FWHM of Gaussian smoothness of bias
deformation_field: (a tuple of the form: (a boolean, a boolean),
          nipype default value: (0, 0))
        forward and inverse field
mfile: (a boolean, nipype default value: True)
        Run m-code using m-file
wm_normalized: (a boolean, nipype default value: False)
pve_label_normalized: (a boolean, nipype default value: False)
gaussians_per_class: (a tuple of the form: (an integer (int or long),
          an integer (int or long), an integer (int or long), an integer
          (int or long), an integer (int or long), an integer (int or
          long)), nipype default value: (2, 2, 2, 3, 4, 2))
        number of gaussians for each tissue class

Outputs:

modulated_class_images: (a list of items which are a list of items
          which are an existing file name)
        modulated+normalized class images
pve_label_registered_images: (a list of items which are an existing
          file name)
normalized_class_images: (a list of items which are a list of items
          which are an existing file name)
        normalized class images
normalized_bias_corrected_images: (a list of items which are an
          existing file name)
        bias corrected images
bias_corrected_images: (a list of items which are an existing file
          name)
        bias corrected images
pve_label_normalized_images: (a list of items which are an existing
          file name)
inverse_deformation_field: (a list of items which are an existing
          file name)
dartel_input_images: (a list of items which are a list of items which
          are an existing file name)
        dartel imported class images
transformation_mat: (a list of items which are an existing file name)
        Normalization transformation
pve_label_native_images: (a list of items which are an existing file
          name)
native_class_images: (a list of items which are a list of items which
          are an existing file name)
        native space probability maps
forward_deformation_field: (a list of items which are an existing
          file name)
jacobian_determinant_images: (a list of items which are an existing
          file name)

References:

None