nipype.interfaces.spm.utils module¶
Analyze2nii¶
Bases: SPMCommand
- Mandatory Inputs
analyze_file (a pathlike object or string representing an existing file)
- Optional Inputs
matlab_cmd (a string) – Matlab command to use.
mfile (a boolean) – Run m-code using m-file. (Nipype default value:
True
)paths (a list of items which are a pathlike object or string representing a directory) – Paths to add to matlabpath.
use_mcr (a boolean) – Run m-code using SPM MCR.
use_v8struct (a boolean) – Generate SPM8 and higher compatible jobs. (Nipype default value:
True
)- Outputs
matlab_cmd (a string) – Matlab command to use.
mfile (a 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_mcr (a boolean) – Run m-code using SPM MCR.
use_v8struct (a boolean) – Generate SPM8 and higher compatible jobs. (Nipype default value:
True
)
ApplyInverseDeformation¶
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()
- Mandatory Inputs
in_files (a list of items which are a pathlike object or string representing an existing file) – Files on which deformation is applied.
- Optional Inputs
bounding_box (a list of from 6 to 6 items which are a float) – 6-element list (opt).
deformation (a pathlike object or string representing an existing file) – SN SPM deformation file. Mutually exclusive with inputs:
deformation_field
.deformation_field (a pathlike object or string representing an existing file) – SN SPM deformation file. Mutually exclusive with inputs:
deformation
.interpolation (0 <= an integer <= 7) – Degree of b-spline used for interpolation.
matlab_cmd (a string) – Matlab command to use.
mfile (a boolean) – Run m-code using m-file. (Nipype default value:
True
)paths (a list of items which are a pathlike object or string representing a directory) – Paths to add to matlabpath.
target (a pathlike object or string representing an existing file) – File defining target space.
use_mcr (a boolean) – Run m-code using SPM MCR.
use_v8struct (a boolean) – Generate SPM8 and higher compatible jobs. (Nipype default value:
True
)voxel_sizes (a list of from 3 to 3 items which are a float) – 3-element list (opt).
- Outputs
out_files (a list of items which are a pathlike object or string representing an existing file) – Transformed files.
ApplyTransform¶
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()
- Mandatory Inputs
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 Inputs
matlab_cmd (a string) – Matlab command to use.
mfile (a boolean) – Run m-code using m-file. (Nipype default value:
True
)out_file (a pathlike object or string representing a file) – Output file name for transformed data.
paths (a list of items which are a pathlike object or string representing a directory) – Paths to add to matlabpath.
use_mcr (a boolean) – Run m-code using SPM MCR.
use_v8struct (a boolean) – Generate SPM8 and higher compatible jobs. (Nipype default value:
True
)- Outputs
out_file (a pathlike object or string representing an existing file) – Transformed image file.
CalcCoregAffine¶
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
- Mandatory Inputs
moving (a pathlike object or string representing an existing file) – Volume transform can be applied to register with target.
target (a pathlike object or string representing an existing file) – Target for generating affine transform.
- Optional Inputs
invmat (a pathlike object or string representing a file) – Filename used to store inverse affine matrix.
mat (a pathlike object or string representing a file) – Filename used to store affine matrix.
matlab_cmd (a string) – Matlab command to use.
mfile (a boolean) – Run m-code using m-file. (Nipype default value:
True
)paths (a list of items which are a pathlike object or string representing a directory) – Paths to add to matlabpath.
use_mcr (a boolean) – Run m-code using SPM MCR.
use_v8struct (a boolean) – Generate SPM8 and higher compatible jobs. (Nipype default value:
True
)- Outputs
invmat (a pathlike object or string representing a file) – Matlab file holding inverse transform.
mat (a pathlike object or string representing an existing file) – Matlab file holding transform.
DicomImport¶
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()
- Mandatory Inputs
in_files (a list of items which are a pathlike object or string representing an existing file) – Dicom files to be converted.
- Optional Inputs
format (‘nii’ or ‘img’) – Output format. (Nipype default value:
nii
)icedims (a 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_cmd (a string) – Matlab command to use.
mfile (a boolean) – Run m-code using m-file. (Nipype default value:
True
)output_dir (a 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
)paths (a list of items which are a pathlike object or string representing a directory) – Paths to add to matlabpath.
use_mcr (a boolean) – Run m-code using SPM MCR.
use_v8struct (a boolean) – Generate SPM8 and higher compatible jobs. (Nipype default value:
True
)- Outputs
out_files (a list of items which are a pathlike object or string representing an existing file) – Converted files.
Reslice¶
Bases: SPMCommand
uses spm_reslice to resample in_file into space of space_defining
- Mandatory Inputs
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 Inputs
interp (0 <= an integer <= 7) – Degree of b-spline used for interpolation0 is nearest neighbor (default). (Nipype default value:
0
)matlab_cmd (a string) – Matlab command to use.
mfile (a boolean) – Run m-code using m-file. (Nipype default value:
True
)out_file (a pathlike object or string representing a file) – Optional file to save resliced volume.
paths (a list of items which are a pathlike object or string representing a directory) – Paths to add to matlabpath.
use_mcr (a boolean) – Run m-code using SPM MCR.
use_v8struct (a boolean) – Generate SPM8 and higher compatible jobs. (Nipype default value:
True
)- Outputs
out_file (a pathlike object or string representing an existing file) – Resliced volume.
ResliceToReference¶
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()
- Mandatory Inputs
in_files (a list of items which are a pathlike object or string representing an existing file) – Files on which deformation is applied.
- Optional Inputs
bounding_box (a list of from 6 to 6 items which are a float) – 6-element list (opt).
interpolation (0 <= an integer <= 7) – Degree of b-spline used for interpolation.
matlab_cmd (a string) – Matlab command to use.
mfile (a boolean) – Run m-code using m-file. (Nipype default value:
True
)paths (a list of items which are a pathlike object or string representing a directory) – Paths to add to matlabpath.
target (a pathlike object or string representing an existing file) – File defining target space.
use_mcr (a boolean) – Run m-code using SPM MCR.
use_v8struct (a boolean) – Generate SPM8 and higher compatible jobs. (Nipype default value:
True
)voxel_sizes (a list of from 3 to 3 items which are a float) – 3-element list (opt).
- Outputs
out_files (a list of items which are a pathlike object or string representing an existing file) – Transformed files.