nipype.interfaces.spm.preprocess module¶
SPM wrappers for preprocessing data
ApplyDeformations¶
Bases: SPMCommand
deformation_field : a pathlike object or string representing an existing file in_files : a list of items which are a pathlike object or string representing an existing file reference_volume : a pathlike object or string representing an existing file
- interp0 <= 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.
- use_mcra boolean
Run m-code using SPM MCR.
- use_v8structa boolean
Generate SPM8 and higher compatible jobs. (Nipype default value:
True
)out_files : a list of items which are a pathlike object or string representing an existing file
Coregister¶
Bases: SPMCommand
Use spm_coreg for estimating cross-modality rigid body alignment
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=39
Examples
>>> import nipype.interfaces.spm as spm >>> coreg = spm.Coregister() >>> coreg.inputs.target = 'functional.nii' >>> coreg.inputs.source = 'structural.nii' >>> coreg.run()
- sourcea list of items which are a pathlike object or string representing an existing file
File to register to target.
- targeta pathlike object or string representing an existing file
Reference file to register to.
- apply_to_filesa list of items which are a pathlike object or string representing an existing file
Files to apply transformation to.
- cost_function‘mi’ or ‘nmi’ or ‘ecc’ or ‘ncc’
- Cost function, one of:
‘mi’ - Mutual Information, ‘nmi’ - Normalised Mutual Information, ‘ecc’ - Entropy Correlation Coefficient, ‘ncc’ - Normalised Cross Correlation.
- fwhma list of from 2 to 2 items which are a float
Gaussian smoothing kernel width (mm).
- jobtype‘estwrite’ or ‘estimate’ or ‘write’
One of: estimate, write, estwrite. (Nipype default value:
estwrite
)- matlab_cmda unicode string
Matlab command to use.
- mfilea boolean
Run m-code using m-file. (Nipype default value:
True
)- out_prefixa string
Coregistered output prefix. (Nipype default value:
r
)- pathsa list of items which are a pathlike object or string representing a directory
Paths to add to matlabpath.
- separationa list of items which are a float
Sampling separation in mm.
- tolerancea list of items which are a float
Acceptable tolerance for each of 12 params.
- use_mcra boolean
Run m-code using SPM MCR.
- use_v8structa boolean
Generate SPM8 and higher compatible jobs. (Nipype default value:
True
)- write_interp0 <= a long integer <= 7
Degree of b-spline used for interpolation.
- write_maska boolean
True/False mask output image.
- write_wrapa list of from 3 to 3 items which are an integer (int or long)
Check if interpolation should wrap in [x,y,z].
- coregistered_filesa list of items which are a pathlike object or string representing an existing file
Coregistered other files.
- coregistered_sourcea list of items which are a pathlike object or string representing an existing file
Coregistered source files.
CreateWarped¶
Bases: SPMCommand
Apply a flow field estimated by DARTEL to create warped images
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=190
Examples
>>> import nipype.interfaces.spm as spm >>> create_warped = spm.CreateWarped() >>> create_warped.inputs.image_files = ['rc1s1.nii', 'rc1s2.nii'] >>> create_warped.inputs.flowfield_files = ['u_rc1s1_Template.nii', 'u_rc1s2_Template.nii'] >>> create_warped.run()
- flowfield_filesa list of items which are a pathlike object or string representing an existing file
DARTEL flow fields u_rc1*.
- image_filesa list of items which are a pathlike object or string representing an existing file
A list of files to be warped.
- interp0 <= a long integer <= 7
Degree of b-spline used for interpolation.
- iterations0 <= a long integer <= 9
The number of iterations: log2(number of time steps).
- matlab_cmda unicode string
Matlab command to use.
- mfilea boolean
Run m-code using m-file. (Nipype default value:
True
)- modulatea boolean
Modulate images.
- 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
)warped_files : a list of items which are a pathlike object or string representing an existing file
DARTEL¶
Bases: SPMCommand
Use spm DARTEL to create a template and flow fields
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=185
Examples
>>> import nipype.interfaces.spm as spm >>> dartel = spm.DARTEL() >>> dartel.inputs.image_files = [['rc1s1.nii','rc1s2.nii'],['rc2s1.nii', 'rc2s2.nii']] >>> dartel.run()
- image_filesa list of items which are a list of items which are a pathlike object or string representing an existing file
A list of files to be segmented.
- iteration_parametersa list of from 3 to 12 items which are a tuple of the form: (1 <= a long integer <= 10, a tuple of the form: (a float, a float, a float), 1 or 2 or 4 or 8 or 16 or 32 or 64 or 128 or 256 or 512, 0 or 0.5 or 1 or 2 or 4 or 8 or 16 or 32)
List of tuples for each iteration
Inner iterations
Regularization parameters
Time points for deformation model
smoothing parameter
- matlab_cmda unicode string
Matlab command to use.
- mfilea boolean
Run m-code using m-file. (Nipype default value:
True
)- optimization_parametersa tuple of the form: (a float, 1 <= a long integer <= 8, 1 <= a long integer <= 8)
Optimization settings a tuple:
LM regularization
cycles of multigrid solver
relaxation iterations
- pathsa list of items which are a pathlike object or string representing a directory
Paths to add to matlabpath.
- regularization_form‘Linear’ or ‘Membrane’ or ‘Bending’
Form of regularization energy term.
- template_prefixa unicode string
Prefix for template. (Nipype default value:
Template
)- use_mcra boolean
Run m-code using SPM MCR.
- use_v8structa boolean
Generate SPM8 and higher compatible jobs. (Nipype default value:
True
)
- dartel_flow_fieldsa list of items which are a pathlike object or string representing an existing file
DARTEL flow fields.
- final_template_filea pathlike object or string representing an existing file
Final DARTEL template.
- template_filesa list of items which are a pathlike object or string representing an existing file
Templates from different stages of iteration.
DARTELNorm2MNI¶
Bases: SPMCommand
Use spm DARTEL to normalize data to MNI space
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=188
Examples
>>> import nipype.interfaces.spm as spm >>> nm = spm.DARTELNorm2MNI() >>> nm.inputs.template_file = 'Template_6.nii' >>> nm.inputs.flowfield_files = ['u_rc1s1_Template.nii', 'u_rc1s3_Template.nii'] >>> nm.inputs.apply_to_files = ['c1s1.nii', 'c1s3.nii'] >>> nm.inputs.modulate = True >>> nm.run()
- apply_to_filesa list of items which are a pathlike object or string representing an existing file
Files to apply the transform to.
- flowfield_filesa list of items which are a pathlike object or string representing an existing file
DARTEL flow fields u_rc1*.
- template_filea pathlike object or string representing an existing file
DARTEL template.
- bounding_boxa tuple of the form: (a float, a float, a float, a float, a float, a float)
Voxel sizes for output file.
- fwhma list of from 3 to 3 items which are a float or a float
3-list of fwhm for each dimension.
- matlab_cmda unicode string
Matlab command to use.
- mfilea boolean
Run m-code using m-file. (Nipype default value:
True
)- modulatea boolean
Modulate out images - no modulation preserves concentrations.
- 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
)- voxel_sizea tuple of the form: (a float, a float, a float)
Voxel sizes for output file.
- normalization_parameter_filea pathlike object or string representing an existing file
Transform parameters to MNI space.
- normalized_filesa list of items which are a pathlike object or string representing an existing file
Normalized files in MNI space.
FieldMap¶
Bases: SPMCommand
Use the fieldmap toolbox from spm to calculate the voxel displacement map (VDM).
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=173
Important
This interface does not deal with real/imag magnitude images nor with the two phase files case.
Examples
>>> from nipype.interfaces.spm import FieldMap >>> fm = FieldMap() >>> fm.inputs.phase_file = 'phase.nii' >>> fm.inputs.magnitude_file = 'magnitude.nii' >>> fm.inputs.echo_times = (5.19, 7.65) >>> fm.inputs.blip_direction = 1 >>> fm.inputs.total_readout_time = 15.6 >>> fm.inputs.epi_file = 'epi.nii' >>> fm.run()
- blip_direction1 or -1
Polarity of the phase-encode blips.
- echo_timesa tuple of the form: (a float, a float)
Short and long echo times.
- epi_filea pathlike object or string representing an existing file
EPI to unwarp.
- magnitude_filea pathlike object or string representing an existing file
Presubstracted magnitude file.
- phase_filea pathlike object or string representing an existing file
Presubstracted phase file.
- total_readout_timea float
Total EPI readout time.
- anat_filea pathlike object or string representing an existing file
Anatomical image for comparison.
- epifma boolean
Epi-based field map. (Nipype default value:
False
)- jacobian_modulationa boolean
Jacobian modulation. (Nipype default value:
False
)- jobtype‘calculatevdm’ or ‘applyvdm’
One of: calculatevdm, applyvdm. (Nipype default value:
calculatevdm
)- mask_fwhma long integer >= 0
Gaussian smoothing kernel width. (Nipype default value:
5
)- maskbraina boolean
Masking or no masking of the brain. (Nipype default value:
True
)- matchanata boolean
Match anatomical image to EPI. (Nipype default value:
True
)- matchvdma boolean
Match VDM to EPI. (Nipype default value:
True
)- matlab_cmda unicode string
Matlab command to use.
- method‘Mark3D’ or ‘Mark2D’ or ‘Huttonish’
One of: Mark3D, Mark2D, Huttonish. (Nipype default value:
Mark3D
)- mfilea boolean
Run m-code using m-file. (Nipype default value:
True
)- ndilatea long integer >= 0
Number of erosions. (Nipype default value:
4
)- nerodea long integer >= 0
Number of erosions. (Nipype default value:
2
)- pada long integer >= 0
Padding kernel width. (Nipype default value:
0
)- pathsa list of items which are a pathlike object or string representing a directory
Paths to add to matlabpath.
- rega float
Regularization value used in the segmentation. (Nipype default value:
0.02
)- sessnamea unicode string
VDM filename extension. (Nipype default value:
_run-
)- templatea pathlike object or string representing an existing file
Template image for brain masking.
- thresha float
Threshold used to create brain mask from segmented data. (Nipype default value:
0.5
)- unwarp_fwhma long integer >= 0
Gaussian smoothing kernel width. (Nipype default value:
10
)- use_mcra boolean
Run m-code using SPM MCR.
- use_v8structa boolean
Generate SPM8 and higher compatible jobs. (Nipype default value:
True
)- writeunwarpeda boolean
Write unwarped EPI. (Nipype default value:
False
)- wsa boolean
Weighted smoothing. (Nipype default value:
True
)
- vdma pathlike object or string representing an existing file
Voxel difference map.
MultiChannelNewSegment¶
Bases: SPMCommand
Use spm_preproc8 (New Segment) to separate structural images into different tissue classes. Supports multiple modalities and multichannel inputs.
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=45
Examples
>>> import nipype.interfaces.spm as spm >>> seg = spm.MultiChannelNewSegment() >>> seg.inputs.channels = [('structural.nii',(0.0001, 60, (True, True)))] >>> seg.run()For VBM pre-processing [http://www.fil.ion.ucl.ac.uk/~john/misc/VBMclass10.pdf], TPM.nii should be replaced by /path/to/spm8/toolbox/Seg/TPM.nii
>>> seg = MultiChannelNewSegment() >>> channel1= ('T1.nii',(0.0001, 60, (True, True))) >>> channel2= ('T2.nii',(0.0001, 60, (True, True))) >>> seg.inputs.channels = [channel1, channel2] >>> tissue1 = (('TPM.nii', 1), 2, (True,True), (False, False)) >>> tissue2 = (('TPM.nii', 2), 2, (True,True), (False, False)) >>> tissue3 = (('TPM.nii', 3), 2, (True,False), (False, False)) >>> tissue4 = (('TPM.nii', 4), 2, (False,False), (False, False)) >>> tissue5 = (('TPM.nii', 5), 2, (False,False), (False, False)) >>> seg.inputs.tissues = [tissue1, tissue2, tissue3, tissue4, tissue5] >>> seg.run()
- affine_regularization‘mni’ or ‘eastern’ or ‘subj’ or ‘none’
Mni, eastern, subj, none .
- channelsa list of items which are a tuple of the form: (a list of items which are a pathlike object or string representing an existing file, a tuple of the form: (a float, a float, a tuple of the form: (a boolean, a boolean)))
- A list of tuples (one per each channel) with the following fields:
a list of channel files (only 1rst channel files will be segmented)
a tuple with the following channel-specific info fields: - bias reguralisation (0-10) - FWHM of Gaussian smoothness of bias - which maps to save (Field, Corrected) - a tuple of two boolean values.
- 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.
- sampling_distancea float
Sampling distance on data for parameter estimation.
- tissuesa list of items which are a tuple of the form: (a tuple of the form: (a pathlike object or string representing an existing file, an integer (int or long)), an integer (int or long), a tuple of the form: (a boolean, a boolean), a tuple of the form: (a boolean, a boolean))
- A list of tuples (one per tissue) with the following fields:
tissue probability map (4D), 1-based index to frame
number of gaussians
which maps to save [Native, DARTEL] - a tuple of two boolean values
which maps to save [Unmodulated, Modulated] - a tuple of two boolean values.
- use_mcra boolean
Run m-code using SPM MCR.
- use_v8structa boolean
Generate SPM8 and higher compatible jobs. (Nipype default value:
True
)- warping_regularizationa list of from 5 to 5 items which are a float or a float
Warping regularization parameter(s). Accepts float or list of floats (the latter is required by SPM12).
- write_deformation_fieldsa list of from 2 to 2 items which are a boolean
Which deformation fields to write:[Inverse, Forward].
- bias_corrected_imagesa list of items which are a pathlike object or string representing an existing file
Bias corrected images.
- bias_field_imagesa list of items which are a pathlike object or string representing an existing file
Bias field images.
- dartel_input_imagesa list of items which are a list of items which are a pathlike object or string representing an existing file
Dartel imported class images.
forward_deformation_field : a list of items which are a pathlike object or string representing an existing file inverse_deformation_field : a list of items which are a pathlike object or string representing an existing file modulated_class_images : a list of items which are a list of items which are a pathlike object or string representing an existing file
Modulated+normalized class images.
- native_class_imagesa list of items which are a list of items which are a pathlike object or string representing an existing file
Native space probability maps.
- normalized_class_imagesa list of items which are a list of items which are a pathlike object or string representing an existing file
Normalized class images.
- transformation_mata list of items which are a pathlike object or string representing an existing file
Normalization transformation.
NewSegment¶
Bases: SPMCommand
Use spm_preproc8 (New Segment) to separate structural images into different tissue classes. Supports multiple modalities.
NOTE: This interface currently supports single channel input only
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=43
Examples
>>> import nipype.interfaces.spm as spm >>> seg = spm.NewSegment() >>> seg.inputs.channel_files = 'structural.nii' >>> seg.inputs.channel_info = (0.0001, 60, (True, True)) >>> seg.run()For VBM pre-processing [http://www.fil.ion.ucl.ac.uk/~john/misc/VBMclass10.pdf], TPM.nii should be replaced by /path/to/spm8/toolbox/Seg/TPM.nii
>>> seg = NewSegment() >>> seg.inputs.channel_files = 'structural.nii' >>> tissue1 = (('TPM.nii', 1), 2, (True,True), (False, False)) >>> tissue2 = (('TPM.nii', 2), 2, (True,True), (False, False)) >>> tissue3 = (('TPM.nii', 3), 2, (True,False), (False, False)) >>> tissue4 = (('TPM.nii', 4), 2, (False,False), (False, False)) >>> tissue5 = (('TPM.nii', 5), 2, (False,False), (False, False)) >>> seg.inputs.tissues = [tissue1, tissue2, tissue3, tissue4, tissue5] >>> seg.run()
- channel_filesa list of items which are a pathlike object or string representing an existing file
A list of files to be segmented.
- affine_regularization‘mni’ or ‘eastern’ or ‘subj’ or ‘none’
Mni, eastern, subj, none .
- channel_infoa tuple of the form: (a float, a float, a tuple of the form: (a boolean, a boolean))
- A tuple with the following fields:
bias reguralisation (0-10)
FWHM of Gaussian smoothness of bias
which maps to save (Field, Corrected) - a tuple of two boolean values.
- 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.
- sampling_distancea float
Sampling distance on data for parameter estimation.
- tissuesa list of items which are a tuple of the form: (a tuple of the form: (a pathlike object or string representing an existing file, an integer (int or long)), an integer (int or long), a tuple of the form: (a boolean, a boolean), a tuple of the form: (a boolean, a boolean))
- A list of tuples (one per tissue) with the following fields:
tissue probability map (4D), 1-based index to frame
number of gaussians
which maps to save [Native, DARTEL] - a tuple of two boolean values
which maps to save [Unmodulated, Modulated] - a tuple of two boolean values.
- use_mcra boolean
Run m-code using SPM MCR.
- use_v8structa boolean
Generate SPM8 and higher compatible jobs. (Nipype default value:
True
)- warping_regularizationa list of from 5 to 5 items which are a float or a float
Warping regularization parameter(s). Accepts float or list of floats (the latter is required by SPM12).
- write_deformation_fieldsa list of from 2 to 2 items which are a boolean
Which deformation fields to write:[Inverse, Forward].
- bias_corrected_imagesa list of items which are a pathlike object or string representing an existing file
Bias corrected images.
- bias_field_imagesa list of items which are a pathlike object or string representing an existing file
Bias field images.
- dartel_input_imagesa list of items which are a list of items which are a pathlike object or string representing an existing file
Dartel imported class images.
forward_deformation_field : a list of items which are a pathlike object or string representing an existing file inverse_deformation_field : a list of items which are a pathlike object or string representing an existing file modulated_class_images : a list of items which are a list of items which are a pathlike object or string representing an existing file
Modulated+normalized class images.
- native_class_imagesa list of items which are a list of items which are a pathlike object or string representing an existing file
Native space probability maps.
- normalized_class_imagesa list of items which are a list of items which are a pathlike object or string representing an existing file
Normalized class images.
- transformation_mata list of items which are a pathlike object or string representing an existing file
Normalization transformation.
Normalize¶
Bases: SPMCommand
use spm_normalise for warping an image to a template
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=203
Examples
>>> import nipype.interfaces.spm as spm >>> norm = spm.Normalize() >>> norm.inputs.source = 'functional.nii' >>> norm.run()
- parameter_filea pathlike object or string representing a file
Normalization parameter file*_sn.mat. Mutually exclusive with inputs:
source
,template
.- sourcea list of items which are a pathlike object or string representing an existing file
File to normalize to template. Mutually exclusive with inputs:
parameter_file
.- templatea pathlike object or string representing an existing file
Template file to normalize to. Mutually exclusive with inputs:
parameter_file
.
- DCT_period_cutoffa float
Cutoff of for DCT bases.
- affine_regularization_type‘mni’ or ‘size’ or ‘none’
Mni, size, none.
- apply_to_filesa list of items which are a pathlike object or string representing an existing file or a list of items which are a pathlike object or string representing an existing file
Files to apply transformation to.
- jobtype‘estwrite’ or ‘est’ or ‘write’
Estimate, Write or do both. (Nipype default value:
estwrite
)- matlab_cmda unicode string
Matlab command to use.
- mfilea boolean
Run m-code using m-file. (Nipype default value:
True
)- nonlinear_iterationsan integer (int or long)
Number of iterations of nonlinear warping.
- nonlinear_regularizationa float
The amount of the regularization for the nonlinear part of the normalization.
- out_prefixa string
Normalized output prefix. (Nipype default value:
w
)- pathsa list of items which are a pathlike object or string representing a directory
Paths to add to matlabpath.
- source_image_smoothinga float
Source smoothing.
- source_weighta pathlike object or string representing a file
Name of weighting image for source.
- template_image_smoothinga float
Template smoothing.
- template_weighta pathlike object or string representing a file
Name of weighting image for template.
- use_mcra boolean
Run m-code using SPM MCR.
- use_v8structa boolean
Generate SPM8 and higher compatible jobs. (Nipype default value:
True
)- write_bounding_boxa list of from 2 to 2 items which are a list of from 3 to 3 items which are a float
3x2-element list of lists.
- write_interp0 <= a long integer <= 7
Degree of b-spline used for interpolation.
- write_preservea boolean
True/False warped images are modulated.
- write_voxel_sizesa list of from 3 to 3 items which are a float
3-element list.
- write_wrapa list of items which are an integer (int or long)
Check if interpolation should wrap in [x,y,z] - list of bools.
- normalization_parametersa list of items which are a pathlike object or string representing an existing file
MAT files containing the normalization parameters.
- normalized_filesa list of items which are a pathlike object or string representing an existing file
Normalized other files.
- normalized_sourcea list of items which are a pathlike object or string representing an existing file
Normalized source files.
Normalize12¶
Bases: SPMCommand
uses SPM12’s new Normalise routine for warping an image to a template. Spatial normalisation is now done via the segmentation routine (which was known as
New Segment
in SPM8). Note that the normalisation in SPM12 is done towards a file containing multiple tissue probability maps, which was not the case in SPM8.http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=49
Examples
>>> import nipype.interfaces.spm as spm >>> norm12 = spm.Normalize12() >>> norm12.inputs.image_to_align = 'structural.nii' >>> norm12.inputs.apply_to_files = 'functional.nii' >>> norm12.run()
- deformation_filea pathlike object or string representing a file
File y_*.nii containing 3 deformation fields for the deformation in x, y and z dimension. Mutually exclusive with inputs:
image_to_align
,tpm
.- image_to_aligna pathlike object or string representing an existing file
File to estimate normalization parameters with. Mutually exclusive with inputs:
deformation_file
.
- affine_regularization_type‘mni’ or ‘size’ or ‘none’
Mni, size, none.
- apply_to_filesa list of items which are a pathlike object or string representing an existing file or a list of items which are a pathlike object or string representing an existing file
Files to apply transformation to.
- bias_fwhm30 or 40 or 50 or 60 or 70 or 80 or 90 or 100 or 110 or 120 or 130 or 140 or 150 or ‘Inf’
FWHM of Gaussian smoothness of bias.
- bias_regularization0 or 1e-05 or 0.0001 or 0.001 or 0.01 or 0.1 or 1 or 10
No(0) - extremely heavy (10).
- jobtype‘estwrite’ or ‘est’ or ‘write’
Estimate, Write or do Both. (Nipype default value:
estwrite
)- matlab_cmda unicode string
Matlab command to use.
- mfilea boolean
Run m-code using m-file. (Nipype default value:
True
)- out_prefixa string
Normalized output prefix. (Nipype default value:
w
)- pathsa list of items which are a pathlike object or string representing a directory
Paths to add to matlabpath.
- sampling_distancea float
Sampling distance on data for parameter estimation.
- smoothnessa float
Value (in mm) to smooth the data before normalization.
- tpma pathlike object or string representing an existing file
Template in form of tissue probablitiy maps to normalize to. Mutually exclusive with inputs:
deformation_file
.- use_mcra boolean
Run m-code using SPM MCR.
- use_v8structa boolean
Generate SPM8 and higher compatible jobs. (Nipype default value:
True
)- warping_regularizationa list of from 5 to 5 items which are a float
Controls balance between parameters and data.
- write_bounding_boxa list of from 2 to 2 items which are a list of from 3 to 3 items which are a float
3x2-element list of lists representing the bounding box (in mm) to be written.
- write_interp0 <= a long integer <= 7
Degree of b-spline used for interpolation.
- write_voxel_sizesa list of from 3 to 3 items which are a float
3-element list representing the voxel sizes (in mm) of the written normalised images.
- deformation_fielda list of items which are a pathlike object or string representing an existing file
NIfTI file containing 3 deformation fields for the deformation in x, y and z dimension.
- normalized_filesa list of items which are a pathlike object or string representing an existing file
Normalized other files.
- normalized_imagea list of items which are a pathlike object or string representing an existing file
Normalized file that needed to be aligned.
Realign¶
Bases: SPMCommand
Use spm_realign for estimating within modality rigid body alignment
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=25
Examples
>>> import nipype.interfaces.spm as spm >>> realign = spm.Realign() >>> realign.inputs.in_files = 'functional.nii' >>> realign.inputs.register_to_mean = True >>> realign.run()
- in_filesa list of items which are a pathlike object or string representing an existing file or a list of items which are a pathlike object or string representing an existing file
List of filenames to realign.
- fwhma floating point number >= 0.0
Gaussian smoothing kernel width.
- interp0 <= a long integer <= 7
Degree of b-spline used for interpolation.
- jobtype‘estwrite’ or ‘estimate’ or ‘write’
One of: estimate, write, estwrite. (Nipype default value:
estwrite
)- matlab_cmda unicode string
Matlab command to use.
- mfilea boolean
Run m-code using m-file. (Nipype default value:
True
)- out_prefixa string
Realigned output prefix. (Nipype default value:
r
)- pathsa list of items which are a pathlike object or string representing a directory
Paths to add to matlabpath.
- quality0.0 <= a floating point number <= 1.0
0.1 = fast, 1.0 = precise.
- register_to_meana boolean
Indicate whether realignment is done to the mean image.
- separationa floating point number >= 0.0
Sampling separation in mm.
- use_mcra boolean
Run m-code using SPM MCR.
- use_v8structa boolean
Generate SPM8 and higher compatible jobs. (Nipype default value:
True
)- weight_imga pathlike object or string representing an existing file
Filename of weighting image.
- wrapa list of from 3 to 3 items which are an integer (int or long)
Check if interpolation should wrap in [x,y,z].
- write_interp0 <= a long integer <= 7
Degree of b-spline used for interpolation.
- write_maska boolean
True/False mask output image.
- write_whicha list of items which are a value of class ‘int’
Determines which images to reslice. (Nipype default value:
[2, 1]
)- write_wrapa list of from 3 to 3 items which are an integer (int or long)
Check if interpolation should wrap in [x,y,z].
- mean_imagea pathlike object or string representing an existing file
Mean image file from the realignment.
- modified_in_filesa list of items which are a list of items which are a pathlike object or string representing an existing file or a pathlike object or string representing an existing file
Copies of all files passed to in_files. Headers will have been modified to align all images with the first, or optionally to first do that, extract a mean image, and re-align to that mean image.
- realigned_filesa list of items which are a list of items which are a pathlike object or string representing an existing file or a pathlike object or string representing an existing file
If jobtype is write or estwrite, these will be the resliced files. Otherwise, they will be copies of in_files that have had their headers rewritten.
- realignment_parametersa list of items which are a pathlike object or string representing an existing file
Estimated translation and rotation parameters.
RealignUnwarp¶
Bases: SPMCommand
Use spm_uw_estimate for estimating within subject registration and unwarping of time series. Function accepts only one single field map. If in_files is a list of files they will be treated as separate sessions but associated to the same fieldmap.
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=31
Examples
>>> import nipype.interfaces.spm as spm >>> realignUnwarp = spm.RealignUnwarp() >>> realignUnwarp.inputs.in_files = ['functional.nii', 'functional2.nii'] >>> realignUnwarp.inputs.phase_map = 'voxeldisplacemap.vdm' >>> realignUnwarp.inputs.register_to_mean = True >>> realignUnwarp.run()
- in_filesa list of items which are a pathlike object or string representing an existing file or a list of items which are a pathlike object or string representing an existing file
List of filenames to realign and unwarp.
- est_basis_funca list of from 2 to 2 items which are an integer (int or long)
Number of basis functions to use for each dimension.
- est_first_order_effectsa list of from 1 to 6 items which are an integer (int or long)
First order effects should only depend on pitch and roll, i.e. [4 5].
- est_jacobian_deformationsa boolean
Jacobian deformations. In theory a good idea to include them, in practice a bad idea. Default: No.
- est_num_of_iterationsa list of items which are a value of class ‘int’
Number of iterations. (Nipype default value:
[5]
)- est_re_est_mov_para boolean
Re-estimate movement parameters at each unwarping iteration.
- est_reg_factora list of items which are a value of class ‘int’
Regularisation factor. Default: 100000 (medium). (Nipype default value:
[100000]
)- est_reg_order0 <= a long integer <= 3
This parameter determines how to balance the compromise between likelihood maximization and smoothness maximization of the estimated field.
- est_second_order_effectsa list of from 1 to 6 items which are an integer (int or long)
List of second order terms to model second derivatives of.
- est_taylor_expansion_pointa string
Point in position space to perform Taylor-expansion around. (Nipype default value:
Average
)- est_unwarp_fwhma floating point number >= 0.0
Gaussian smoothing kernel width for unwarp.
- fwhma floating point number >= 0.0
Gaussian smoothing kernel width.
- interp0 <= 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
)- out_prefixa string
Realigned and unwarped output prefix. (Nipype default value:
u
)- pathsa list of items which are a pathlike object or string representing a directory
Paths to add to matlabpath.
- phase_mapa pathlike object or string representing a file
Voxel displacement map to use in unwarping. Unlike SPM standard behaviour, the same map will be used for all sessions.
- quality0.0 <= a floating point number <= 1.0
0.1 = fast, 1.0 = precise.
- register_to_meana boolean
Indicate whether realignment is done to the mean image.
- reslice_interp0 <= a long integer <= 7
Degree of b-spline used for interpolation.
- reslice_maska boolean
True/False mask output image.
- reslice_whicha list of items which are a value of class ‘int’
Determines which images to reslice. (Nipype default value:
[2, 1]
)- reslice_wrapa list of from 3 to 3 items which are an integer (int or long)
Check if interpolation should wrap in [x,y,z].
- separationa floating point number >= 0.0
Sampling separation in mm.
- use_mcra boolean
Run m-code using SPM MCR.
- use_v8structa boolean
Generate SPM8 and higher compatible jobs. (Nipype default value:
True
)- weight_imga pathlike object or string representing an existing file
Filename of weighting image.
- wrapa list of from 3 to 3 items which are an integer (int or long)
Check if interpolation should wrap in [x,y,z].
- mean_imagea pathlike object or string representing an existing file
Mean image file from the realignment & unwarping.
- modified_in_filesa list of items which are a list of items which are a pathlike object or string representing an existing file or a pathlike object or string representing an existing file
Copies of all files passed to in_files. Headers will have been modified to align all images with the first, or optionally to first do that, extract a mean image, and re-align to that mean image.
- realigned_unwarped_filesa list of items which are a list of items which are a pathlike object or string representing an existing file or a pathlike object or string representing an existing file
Realigned and unwarped files written to disc.
- realignment_parametersa list of items which are a pathlike object or string representing an existing file
Estimated translation and rotation parameters.
Segment¶
Bases: SPMCommand
use spm_segment to separate structural images into different tissue classes.
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=209
Examples
>>> import nipype.interfaces.spm as spm >>> seg = spm.Segment() >>> seg.inputs.data = 'structural.nii' >>> seg.run()
- dataa list of items which are a pathlike object or string representing an existing file
One scan per subject.
- affine_regularization‘mni’ or ‘eastern’ or ‘subj’ or ‘none’ or ‘’
Possible options: “mni”, “eastern”, “subj”, “none” (no reguralisation), “” (no affine registration).
- bias_fwhm30 or 40 or 50 or 60 or 70 or 80 or 90 or 100 or 110 or 120 or 130 or ‘Inf’
FWHM of Gaussian smoothness of bias.
- bias_regularization0 or 1e-05 or 0.0001 or 0.001 or 0.01 or 0.1 or 1 or 10
No(0) - extremely heavy (10).
- clean_masks‘no’ or ‘light’ or ‘thorough’
Clean using estimated brain mask (‘no’,’light’,’thorough’).
csf_output_type : a list of from 3 to 3 items which are a boolean
Options to produce CSF images: c3*.img, wc3*.img and mwc3*.img. None: [False,False,False], Native Space: [False,False,True], Unmodulated Normalised: [False,True,False], Modulated Normalised: [True,False,False], Native + Unmodulated Normalised: [False,True,True], Native + Modulated Normalised: [True,False,True], Native + Modulated + Unmodulated: [True,True,True], Modulated + Unmodulated Normalised: [True,True,False].
- gaussians_per_classa list of items which are an integer (int or long)
Num Gaussians capture intensity distribution.
- gm_output_typea list of from 3 to 3 items which are a boolean
- Options to produce grey matter images: c1*.img, wc1*.img and mwc1*.img.
None: [False,False,False], Native Space: [False,False,True], Unmodulated Normalised: [False,True,False], Modulated Normalised: [True,False,False], Native + Unmodulated Normalised: [False,True,True], Native + Modulated Normalised: [True,False,True], Native + Modulated + Unmodulated: [True,True,True], Modulated + Unmodulated Normalised: [True,True,False].
- mask_imagea pathlike object or string representing an existing file
Binary image to restrict parameter estimation .
- 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.
- sampling_distancea float
Sampling distance on data for parameter estimation.
- save_bias_correcteda boolean
True/False produce a bias corrected image.
- tissue_prob_mapsa list of items which are a pathlike object or string representing an existing file
List of gray, white & csf prob. (opt,).
- use_mcra boolean
Run m-code using SPM MCR.
- use_v8structa boolean
Generate SPM8 and higher compatible jobs. (Nipype default value:
True
)- warp_frequency_cutoffa float
Cutoff of DCT bases.
- warping_regularizationa float
Controls balance between parameters and data.
wm_output_type : a list of from 3 to 3 items which are a boolean
Options to produce white matter images: c2*.img, wc2*.img and mwc2*.img. None: [False,False,False], Native Space: [False,False,True], Unmodulated Normalised: [False,True,False], Modulated Normalised: [True,False,False], Native + Unmodulated Normalised: [False,True,True], Native + Modulated Normalised: [True,False,True], Native + Modulated + Unmodulated: [True,True,True], Modulated + Unmodulated Normalised: [True,True,False].
- bias_corrected_imagea pathlike object or string representing a file
Bias-corrected version of input image.
- inverse_transformation_mata pathlike object or string representing an existing file
Inverse normalization info.
- modulated_csf_imagea pathlike object or string representing a file
Modulated, normalized csf probability map.
- modulated_gm_imagea pathlike object or string representing a file
Modulated, normalized grey probability map.
- modulated_input_imagea pathlike object or string representing a file
Bias-corrected version of input image.
- modulated_wm_imagea pathlike object or string representing a file
Modulated, normalized white probability map.
- native_csf_imagea pathlike object or string representing a file
Native space csf probability map.
- native_gm_imagea pathlike object or string representing a file
Native space grey probability map.
- native_wm_imagea pathlike object or string representing a file
Native space white probability map.
- normalized_csf_imagea pathlike object or string representing a file
Normalized csf probability map.
- normalized_gm_imagea pathlike object or string representing a file
Normalized grey probability map.
- normalized_wm_imagea pathlike object or string representing a file
Normalized white probability map.
- transformation_mata pathlike object or string representing an existing file
Normalization transformation.
SliceTiming¶
Bases: SPMCommand
Use spm to perform slice timing correction.
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=19
Examples
>>> from nipype.interfaces.spm import SliceTiming >>> st = SliceTiming() >>> st.inputs.in_files = 'functional.nii' >>> st.inputs.num_slices = 32 >>> st.inputs.time_repetition = 6.0 >>> st.inputs.time_acquisition = 6. - 6./32. >>> st.inputs.slice_order = list(range(32,0,-1)) >>> st.inputs.ref_slice = 1 >>> st.run()
- in_filesa list of items which are a list of items which are a pathlike object or string representing an existing file or a pathlike object or string representing an existing file
List of filenames to apply slice timing.
- num_slicesan integer (int or long)
Number of slices in a volume.
- ref_slicean integer (int or long) or a float
1-based Number of the reference slice or reference time point if slice_order is in onsets (ms).
- slice_ordera list of items which are an integer (int or long) or a float
1-based order or onset (in ms) in which slices are acquired.
- time_acquisitiona float
Time of volume acquisition. usually calculated as TR-(TR/num_slices).
- time_repetitiona float
Time between volume acquisitions (start to start time).
- matlab_cmda unicode string
Matlab command to use.
- mfilea boolean
Run m-code using m-file. (Nipype default value:
True
)- out_prefixa string
Slicetimed output prefix. (Nipype default value:
a
)- 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
)
- timecorrected_filesa list of items which are a list of items which are a pathlike object or string representing an existing file or a pathlike object or string representing an existing file
Slice time corrected files.
Smooth¶
Bases: SPMCommand
Use spm_smooth for 3D Gaussian smoothing of image volumes.
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=55
Examples
>>> import nipype.interfaces.spm as spm >>> smooth = spm.Smooth() >>> smooth.inputs.in_files = 'functional.nii' >>> smooth.inputs.fwhm = [4, 4, 4] >>> smooth.run()
- in_filesa list of items which are a pathlike object or string representing an existing file
List of files to smooth.
- data_typean integer (int or long)
Data type of the output images.
- fwhma list of from 3 to 3 items which are a float or a float
3-list of fwhm for each dimension.
- implicit_maskinga boolean
A mask implied by a particular voxel value.
- matlab_cmda unicode string
Matlab command to use.
- mfilea boolean
Run m-code using m-file. (Nipype default value:
True
)- out_prefixa string
Smoothed output prefix. (Nipype default value:
s
)- 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
)
- smoothed_filesa list of items which are a pathlike object or string representing an existing file
Smoothed files.
VBMSegment¶
Bases: SPMCommand
Use VBM8 toolbox to separate structural images into different tissue classes.
Example
>>> import nipype.interfaces.spm as spm >>> seg = spm.VBMSegment() >>> seg.inputs.tissues = 'TPM.nii' >>> seg.inputs.dartel_template = 'Template_1_IXI550_MNI152.nii' >>> seg.inputs.bias_corrected_native = True >>> seg.inputs.gm_native = True >>> seg.inputs.wm_native = True >>> seg.inputs.csf_native = True >>> seg.inputs.pve_label_native = True >>> seg.inputs.deformation_field = (True, False) >>> seg.run()
- in_filesa list of items which are a pathlike object or string representing an existing file
A list of files to be segmented.
- bias_corrected_affinea boolean
(Nipype default value:
False
)- bias_corrected_nativea boolean
(Nipype default value:
False
)- bias_corrected_normalizeda boolean
(Nipype default value:
True
)- bias_fwhm30 or 40 or 50 or 60 or 70 or 80 or 90 or 100 or 110 or 120 or 130 or ‘Inf’
FWHM of Gaussian smoothness of bias. (Nipype default value:
60
)- bias_regularization0 or 1e-05 or 0.0001 or 0.001 or 0.01 or 0.1 or 1 or 10
No(0) - extremely heavy (10). (Nipype default value:
0.0001
)- cleanup_partitionsan integer (int or long)
0=None,1=light,2=thorough. (Nipype default value:
1
)- csf_dartel0 <= a long integer <= 2
0=None,1=rigid(SPM8 default),2=affine. (Nipype default value:
0
)- csf_modulated_normalized0 <= a long integer <= 2
0=none,1=affine+non-linear(SPM8 default),2=non-linear only. (Nipype default value:
2
)- csf_nativea boolean
(Nipype default value:
False
)- csf_normalizeda boolean
(Nipype default value:
False
)dartel_template : a pathlike object or string representing an existing file deformation_field : a tuple of the form: (a boolean, a boolean)
Forward and inverse field. (Nipype default value:
(0, 0)
)
- display_resultsa boolean
(Nipype default value:
True
)- gaussians_per_classa tuple of the form: (an integer (int or long), an integer (int or long), an integer (int or long), an integer (int or long), an integer (int or long), an integer (int or long))
Number of gaussians for each tissue class. (Nipype default value:
(2, 2, 2, 3, 4, 2)
)- gm_dartel0 <= a long integer <= 2
0=None,1=rigid(SPM8 default),2=affine. (Nipype default value:
0
)- gm_modulated_normalized0 <= a long integer <= 2
0=none,1=affine+non-linear(SPM8 default),2=non-linear only. (Nipype default value:
2
)- gm_nativea boolean
(Nipype default value:
False
)- gm_normalizeda boolean
(Nipype default value:
False
)- jacobian_determinanta boolean
(Nipype default value:
False
)- matlab_cmda unicode string
Matlab command to use.
- mfilea boolean
Run m-code using m-file. (Nipype default value:
True
)- mrf_weightinga float
(Nipype default value:
0.15
)- pathsa list of items which are a pathlike object or string representing a directory
Paths to add to matlabpath.
- pve_label_dartel0 <= a long integer <= 2
0=None,1=rigid(SPM8 default),2=affine. (Nipype default value:
0
)- pve_label_nativea boolean
(Nipype default value:
False
)- pve_label_normalizeda boolean
(Nipype default value:
False
)- sampling_distancea float
Sampling distance on data for parameter estimation. (Nipype default value:
3
)- spatial_normalization‘high’ or ‘low’
(Nipype default value:
high
)- tissuesa pathlike object or string representing an existing file
Tissue probability map.
- use_mcra boolean
Run m-code using SPM MCR.
- use_sanlm_denoising_filter0 <= a long integer <= 2
0=No denoising, 1=denoising,2=denoising multi-threaded. (Nipype default value:
2
)- use_v8structa boolean
Generate SPM8 and higher compatible jobs. (Nipype default value:
True
)- warping_regularizationa float
Controls balance between parameters and data. (Nipype default value:
4
)- wm_dartel0 <= a long integer <= 2
0=None,1=rigid(SPM8 default),2=affine. (Nipype default value:
0
)- wm_modulated_normalized0 <= a long integer <= 2
0=none,1=affine+non-linear(SPM8 default),2=non-linear only. (Nipype default value:
2
)- wm_nativea boolean
(Nipype default value:
False
)- wm_normalizeda boolean
(Nipype default value:
False
)
- bias_corrected_imagesa list of items which are a pathlike object or string representing an existing file
Bias corrected images.
- dartel_input_imagesa list of items which are a list of items which are a pathlike object or string representing an existing file
Dartel imported class images.
forward_deformation_field : a list of items which are a pathlike object or string representing an existing file inverse_deformation_field : a list of items which are a pathlike object or string representing an existing file jacobian_determinant_images : a list of items which are a pathlike object or string representing an existing file modulated_class_images : a list of items which are a list of items which are a pathlike object or string representing an existing file
Modulated+normalized class images.
- native_class_imagesa list of items which are a list of items which are a pathlike object or string representing an existing file
Native space probability maps.
- normalized_bias_corrected_imagesa list of items which are a pathlike object or string representing an existing file
Bias corrected images.
- normalized_class_imagesa list of items which are a list of items which are a pathlike object or string representing an existing file
Normalized class images.
pve_label_native_images : a list of items which are a pathlike object or string representing an existing file pve_label_normalized_images : a list of items which are a pathlike object or string representing an existing file pve_label_registered_images : a list of items which are a pathlike object or string representing an existing file transformation_mat : a list of items which are a pathlike object or string representing an existing file
Normalization transformation.