interfaces.spm.utils

Analyze2nii

Link to code

Inputs:

[Mandatory]
analyze_file: (an existing file name)

[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
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:

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
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
nifti_file: (an existing file name)

References:

None

ApplyInverseDeformation

Link to code

Uses spm to apply inverse deformation stored in a .mat file or a deformation field to a given file

Examples

>>> import nipype.interfaces.spm.utils as spmu
>>> inv = spmu.ApplyInverseDeformation()
>>> inv.inputs.in_files = 'functional.nii'
>>> inv.inputs.deformation = 'struct_to_func.mat'
>>> inv.inputs.target = 'structural.nii'
>>> inv.run() # doctest: +SKIP

Inputs:

[Mandatory]
in_files: (a list of items which are an existing file name)
        Files on which deformation is applied

[Optional]
paths: (a list of items which are a directory name)
        Paths to add to matlabpath
target: (an existing file name)
        File defining target space
use_v8struct: (a boolean, nipype default value: True)
        Generate SPM8 and higher compatible jobs
use_mcr: (a boolean)
        Run m-code using SPM MCR
voxel_sizes: (a list of from 3 to 3 items which are a float)
        3-element list (opt)
bounding_box: (a list of from 6 to 6 items which are a float)
        6-element list (opt)
matlab_cmd: (a unicode string)
        matlab command to use
mfile: (a boolean, nipype default value: True)
        Run m-code using m-file
deformation_field: (an existing file name)
        SN SPM deformation file
        mutually_exclusive: deformation
deformation: (an existing file name)
        SN SPM deformation file
        mutually_exclusive: deformation_field
interpolation: (0 <= an integer <= 7)
        degree of b-spline used for interpolation

Outputs:

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

References:

None

ApplyTransform

Link to code

Uses SPM to apply transform stored in a .mat file to given file

Examples

>>> import nipype.interfaces.spm.utils as spmu
>>> applymat = spmu.ApplyTransform()
>>> applymat.inputs.in_file = 'functional.nii'
>>> applymat.inputs.mat = 'func_to_struct.mat'
>>> applymat.run() # doctest: +SKIP

Inputs:

[Mandatory]
mat: (an existing file name)
        file holding transform to apply
in_file: (an existing file name)
        file to apply transform to, (only updates header)

[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
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
out_file: (a file name)
        output file name for transformed data

Outputs:

out_file: (an existing file name)
        Transformed image file

References:

None

CalcCoregAffine

Link to code

Uses SPM (spm_coreg) to calculate the transform mapping moving to target. Saves Transform in mat (matlab binary file) Also saves inverse transform

Examples

>>> import nipype.interfaces.spm.utils as spmu
>>> coreg = spmu.CalcCoregAffine(matlab_cmd='matlab-spm8')
>>> coreg.inputs.target = 'structural.nii'
>>> coreg.inputs.moving = 'functional.nii'
>>> coreg.inputs.mat = 'func_to_struct.mat'
>>> coreg.run() # doctest: +SKIP

Note

  • the output file mat is saves as a matlab binary file
  • calculating the transforms does NOT change either input image it does not move the moving image, only calculates the transform that can be used to move it

Inputs:

[Mandatory]
moving: (an existing file name)
        volume transform can be applied to register with target
target: (an existing file name)
        target for generating affine transform

[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
use_mcr: (a boolean)
        Run m-code using SPM MCR
mfile: (a boolean, nipype default value: True)
        Run m-code using m-file
matlab_cmd: (a unicode string)
        matlab command to use
invmat: (a file name)
        Filename used to store inverse affine matrix
mat: (a file name)
        Filename used to store affine matrix

Outputs:

invmat: (a file name)
        Matlab file holding inverse transform
mat: (an existing file name)
        Matlab file holding transform

References:

None

DicomImport

Link to code

Uses spm to convert DICOM files to nii or img+hdr.

Examples

>>> import nipype.interfaces.spm.utils as spmu
>>> di = spmu.DicomImport()
>>> di.inputs.in_files = ['functional_1.dcm', 'functional_2.dcm']
>>> di.run() # doctest: +SKIP

Inputs:

[Mandatory]
in_files: (a list of items which are an existing file name)
        dicom files to be converted

[Optional]
paths: (a list of items which are a directory name)
        Paths to add to matlabpath
format: (u'nii' or u'img', nipype default value: nii)
        output format.
use_v8struct: (a boolean, nipype default value: True)
        Generate SPM8 and higher compatible jobs
use_mcr: (a boolean)
        Run m-code using SPM MCR
output_dir_struct: (u'flat' or u'series' or u'patname' or
          u'patid_date' or u'patid' or u'date_time', nipype default value:
          flat)
        directory structure for the output.
icedims: (a boolean, nipype default value: False)
        If image sorting fails, one can try using the additional SIEMENS
        ICEDims information to create unique filenames. Use this only if
        there would be multiple volumes with exactly the same file names.
matlab_cmd: (a unicode string)
        matlab command to use
output_dir: (a unicode string, nipype default value:
          ./converted_dicom)
        output directory.
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)
        converted files

References:

None

Reslice

Link to code

uses spm_reslice to resample in_file into space of space_defining

Inputs:

[Mandatory]
in_file: (an existing file name)
        file to apply transform to, (only updates header)
space_defining: (an existing file name)
        Volume defining space to slice in_file into

[Optional]
paths: (a list of items which are a directory name)
        Paths to add to matlabpath
out_file: (a file name)
        Optional file to save resliced volume
use_v8struct: (a boolean, nipype default value: True)
        Generate SPM8 and higher compatible jobs
interp: (0 <= an integer <= 7, nipype default value: 0)
        degree of b-spline used for interpolation0 is nearest neighbor
        (default)
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_file: (an existing file name)
        resliced volume

References:

None

ResliceToReference

Link to code

Uses spm to reslice a volume to a target image space or to a provided voxel size and bounding box

Examples

>>> import nipype.interfaces.spm.utils as spmu
>>> r2ref = spmu.ResliceToReference()
>>> r2ref.inputs.in_files = 'functional.nii'
>>> r2ref.inputs.target = 'structural.nii'
>>> r2ref.run() # doctest: +SKIP

Inputs:

[Mandatory]
in_files: (a list of items which are an existing file name)
        Files on which deformation is applied

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

Outputs:

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

References:

None