nipype.interfaces.spm.utils module

Analyze2nii

Link to code

Bases: SPMCommand

analyze_file : a pathlike object or string representing an existing file

matlab_cmda unicode string

Matlab command to use.

mfilea boolean

Run m-code using m-file. (Nipype default value: True)

pathsa list of items which are a pathlike object or string representing a directory

Paths to add to matlabpath.

use_mcra boolean

Run m-code using SPM MCR.

use_v8structa boolean

Generate SPM8 and higher compatible jobs. (Nipype default value: True)

matlab_cmda unicode string

Matlab command to use.

mfilea boolean

Run m-code using m-file. (Nipype default value: True)

nifti_file : a pathlike object or string representing an existing file paths : a list of items which are a pathlike object or string representing a directory

Paths to add to matlabpath.

use_mcra boolean

Run m-code using SPM MCR.

use_v8structa boolean

Generate SPM8 and higher compatible jobs. (Nipype default value: True)

ApplyInverseDeformation

Link to code

Bases: SPMCommand

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() 
in_filesa list of items which are a pathlike object or string representing an existing file

Files on which deformation is applied.

bounding_boxa list of from 6 to 6 items which are a float

6-element list (opt).

deformationa pathlike object or string representing an existing file

SN SPM deformation file. Mutually exclusive with inputs: deformation_field.

deformation_fielda pathlike object or string representing an existing file

SN SPM deformation file. Mutually exclusive with inputs: deformation.

interpolation0 <= a long integer <= 7

Degree of b-spline used for interpolation.

matlab_cmda unicode string

Matlab command to use.

mfilea boolean

Run m-code using m-file. (Nipype default value: True)

pathsa list of items which are a pathlike object or string representing a directory

Paths to add to matlabpath.

targeta pathlike object or string representing an existing file

File defining target space.

use_mcra boolean

Run m-code using SPM MCR.

use_v8structa boolean

Generate SPM8 and higher compatible jobs. (Nipype default value: True)

voxel_sizesa list of from 3 to 3 items which are a float

3-element list (opt).

out_filesa list of items which are a pathlike object or string representing an existing file

Transformed files.

ApplyTransform

Link to code

Bases: SPMCommand

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() 
in_filea pathlike object or string representing an existing file

File to apply transform to, (only updates header).

mata pathlike object or string representing an existing file

File holding transform to apply.

matlab_cmda unicode string

Matlab command to use.

mfilea boolean

Run m-code using m-file. (Nipype default value: True)

out_filea pathlike object or string representing a file

Output file name for transformed data.

pathsa list of items which are a pathlike object or string representing a directory

Paths to add to matlabpath.

use_mcra boolean

Run m-code using SPM MCR.

use_v8structa boolean

Generate SPM8 and higher compatible jobs. (Nipype default value: True)

out_filea pathlike object or string representing an existing file

Transformed image file.

CalcCoregAffine

Link to code

Bases: SPMCommand

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

movinga pathlike object or string representing an existing file

Volume transform can be applied to register with target.

targeta pathlike object or string representing an existing file

Target for generating affine transform.

invmata pathlike object or string representing a file

Filename used to store inverse affine matrix.

mata pathlike object or string representing a file

Filename used to store affine matrix.

matlab_cmda unicode string

Matlab command to use.

mfilea boolean

Run m-code using m-file. (Nipype default value: True)

pathsa list of items which are a pathlike object or string representing a directory

Paths to add to matlabpath.

use_mcra boolean

Run m-code using SPM MCR.

use_v8structa boolean

Generate SPM8 and higher compatible jobs. (Nipype default value: True)

invmata pathlike object or string representing a file

Matlab file holding inverse transform.

mata pathlike object or string representing an existing file

Matlab file holding transform.

DicomImport

Link to code

Bases: SPMCommand

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() 
in_filesa list of items which are a pathlike object or string representing an existing file

Dicom files to be converted.

format‘nii’ or ‘img’

Output format. (Nipype default value: nii)

icedimsa boolean

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. (Nipype default value: False)

matlab_cmda unicode string

Matlab command to use.

mfilea boolean

Run m-code using m-file. (Nipype default value: True)

output_dira unicode string

Output directory. (Nipype default value: ./converted_dicom)

output_dir_struct‘flat’ or ‘series’ or ‘patname’ or ‘patid_date’ or ‘patid’ or ‘date_time’

Directory structure for the output. (Nipype default value: flat)

pathsa list of items which are a pathlike object or string representing a directory

Paths to add to matlabpath.

use_mcra boolean

Run m-code using SPM MCR.

use_v8structa boolean

Generate SPM8 and higher compatible jobs. (Nipype default value: True)

out_filesa list of items which are a pathlike object or string representing an existing file

Converted files.

Reslice

Link to code

Bases: SPMCommand

uses spm_reslice to resample in_file into space of space_defining

in_filea pathlike object or string representing an existing file

File to apply transform to, (only updates header).

space_defininga pathlike object or string representing an existing file

Volume defining space to slice in_file into.

interp0 <= a long integer <= 7

Degree of b-spline used for interpolation0 is nearest neighbor (default). (Nipype default value: 0)

matlab_cmda unicode string

Matlab command to use.

mfilea boolean

Run m-code using m-file. (Nipype default value: True)

out_filea pathlike object or string representing a file

Optional file to save resliced volume.

pathsa list of items which are a pathlike object or string representing a directory

Paths to add to matlabpath.

use_mcra boolean

Run m-code using SPM MCR.

use_v8structa boolean

Generate SPM8 and higher compatible jobs. (Nipype default value: True)

out_filea pathlike object or string representing an existing file

Resliced volume.

ResliceToReference

Link to code

Bases: SPMCommand

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() 
in_filesa list of items which are a pathlike object or string representing an existing file

Files on which deformation is applied.

bounding_boxa list of from 6 to 6 items which are a float

6-element list (opt).

interpolation0 <= a long integer <= 7

Degree of b-spline used for interpolation.

matlab_cmda unicode string

Matlab command to use.

mfilea boolean

Run m-code using m-file. (Nipype default value: True)

pathsa list of items which are a pathlike object or string representing a directory

Paths to add to matlabpath.

targeta pathlike object or string representing an existing file

File defining target space.

use_mcra boolean

Run m-code using SPM MCR.

use_v8structa boolean

Generate SPM8 and higher compatible jobs. (Nipype default value: True)

voxel_sizesa list of from 3 to 3 items which are a float

3-element list (opt).

out_filesa list of items which are a pathlike object or string representing an existing file

Transformed files.