interfaces.spm.utils

Analyze2nii

Link to code

Inputs:

[Mandatory]
analyze_file: (a pathlike object or string representing an existing
          file)

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

Outputs:

nifti_file: (a pathlike object or string representing an existing
          file)
matlab_cmd: (a unicode string)
        matlab command to use
paths: (a list of items which are a pathlike object or string
          representing a directory)
        Paths to add to matlabpath
mfile: (a boolean, nipype default value: True)
        Run m-code using m-file
use_mcr: (a boolean)
        Run m-code using SPM MCR
use_v8struct: (a boolean, nipype default value: True)
        Generate SPM8 and higher compatible jobs

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 a pathlike object or string
          representing an existing file)
        Files on which deformation is applied

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

Outputs:

out_files: (a list of items which are a pathlike object or string
          representing an existing file)
        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]
in_file: (a pathlike object or string representing an existing file)
        file to apply transform to, (only updates header)
mat: (a pathlike object or string representing an existing file)
        file holding transform to apply

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

Outputs:

out_file: (a pathlike object or string representing an existing file)
        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]
target: (a pathlike object or string representing an existing file)
        target for generating affine transform
moving: (a pathlike object or string representing an existing file)
        volume transform can be applied to register with target

[Optional]
mat: (a pathlike object or string representing a file)
        Filename used to store affine matrix
invmat: (a pathlike object or string representing a file)
        Filename used to store inverse affine matrix
matlab_cmd: (a unicode string)
        matlab command to use
paths: (a list of items which are a pathlike object or string
          representing a directory)
        Paths to add to matlabpath
mfile: (a boolean, nipype default value: True)
        Run m-code using m-file
use_mcr: (a boolean)
        Run m-code using SPM MCR
use_v8struct: (a boolean, nipype default value: True)
        Generate SPM8 and higher compatible jobs

Outputs:

mat: (a pathlike object or string representing an existing file)
        Matlab file holding transform
invmat: (a pathlike object or string representing a file)
        Matlab file holding inverse 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 a pathlike object or string
          representing an existing file)
        dicom files to be converted

[Optional]
output_dir_struct: ('flat' or 'series' or 'patname' or 'patid_date'
          or 'patid' or 'date_time', nipype default value: flat)
        directory structure for the output.
output_dir: (a unicode string, nipype default value:
          ./converted_dicom)
        output directory.
format: ('nii' or 'img', nipype default value: nii)
        output format.
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
paths: (a list of items which are a pathlike object or string
          representing a directory)
        Paths to add to matlabpath
mfile: (a boolean, nipype default value: True)
        Run m-code using m-file
use_mcr: (a boolean)
        Run m-code using SPM MCR
use_v8struct: (a boolean, nipype default value: True)
        Generate SPM8 and higher compatible jobs

Outputs:

out_files: (a list of items which are a pathlike object or string
          representing an existing file)
        converted files

References:

None

Reslice

Link to code

uses spm_reslice to resample in_file into space of space_defining

Inputs:

[Mandatory]
in_file: (a pathlike object or string representing an existing file)
        file to apply transform to, (only updates header)
space_defining: (a pathlike object or string representing an existing
          file)
        Volume defining space to slice in_file into

[Optional]
interp: (0 <= a long integer <= 7, nipype default value: 0)
        degree of b-spline used for interpolation0 is nearest neighbor
        (default)
out_file: (a pathlike object or string representing a file)
        Optional file to save resliced volume
matlab_cmd: (a unicode string)
        matlab command to use
paths: (a list of items which are a pathlike object or string
          representing a directory)
        Paths to add to matlabpath
mfile: (a boolean, nipype default value: True)
        Run m-code using m-file
use_mcr: (a boolean)
        Run m-code using SPM MCR
use_v8struct: (a boolean, nipype default value: True)
        Generate SPM8 and higher compatible jobs

Outputs:

out_file: (a pathlike object or string representing an existing file)
        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 a pathlike object or string
          representing an existing file)
        Files on which deformation is applied

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

Outputs:

out_files: (a list of items which are a pathlike object or string
          representing an existing file)
        Transformed files

References:

None