interfaces.spm.utils

Analyze2nii

Link to code

Inputs:

[Mandatory]
analyze_file: (an existing file name)

[Optional]
matlab_cmd: (a unicode string)
        matlab command to use
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_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: (an existing file name)
matlab_cmd: (a unicode string)
        matlab command to use
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_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() 

Inputs:

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

[Optional]
target: (an existing file name)
        File defining target space
deformation: (an existing file name)
        SN SPM deformation file
        mutually_exclusive: deformation_field
deformation_field: (an existing file name)
        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 directory name)
        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 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() 

Inputs:

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

[Optional]
out_file: (a file name)
        output file name for transformed data
matlab_cmd: (a unicode string)
        matlab command to use
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_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: (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() 

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: (an existing file name)
        target for generating affine transform
moving: (an existing file name)
        volume transform can be applied to register with target

[Optional]
mat: (a file name)
        Filename used to store affine matrix
invmat: (a file name)
        Filename used to store inverse affine matrix
matlab_cmd: (a unicode string)
        matlab command to use
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_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: (an existing file name)
        Matlab file holding transform
invmat: (a file name)
        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() 

Inputs:

[Mandatory]
in_files: (a list of items which are an existing file name)
        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 directory name)
        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 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]
interp: (0 <= a long integer <= 7, nipype default value: 0)
        degree of b-spline used for interpolation0 is nearest neighbor
        (default)
out_file: (a file name)
        Optional file to save resliced volume
matlab_cmd: (a unicode string)
        matlab command to use
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_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: (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() 

Inputs:

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

[Optional]
target: (an existing file name)
        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 directory name)
        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 an existing file name)
        Transformed files

References:

None