Use spm_coreg for estimating cross-modality rigid body alignment
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=39
>>> import nipype.interfaces.spm as spm
>>> coreg = spm.Coregister()
>>> coreg.inputs.target = 'functional.nii'
>>> coreg.inputs.source = 'structural.nii'
>>> coreg.run()
Inputs:
[Mandatory]
target : (an existing file name)
reference file to register to
[Optional]
apply_to_files : (an existing file name)
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
fwhm : (a float)
gaussian smoothing kernel width (mm)
jobtype : ('estwrite' or 'estimate' or 'write')
one of: estimate, write, estwrite
matlab_cmd : (a string)
Unknown
mfile : (a boolean)
Run m-code using m-file
paths : (a directory name)
Paths to add to matlabpath
separation : (a list of items which are a float)
sampling separation in mm
source : (an existing file name)
file to register to target
tolerance : (a list of items which are a float)
acceptable tolerance for each of 12 params
write_interp : (an integer >= 0)
degree of b-spline used for interpolation
write_mask : (a boolean)
True/False mask output image
write_wrap : (a list of from 3 to 3 items which are a boolean)
Check if interpolation should wrap in [x,y,z]
Outputs:
coregistered_files : (an existing file name)
Coregistered other files
coregistered_source : (an existing file name)
Coregistered source files
Use spm_preproc8 (New Segment) to separate structural images into different tissue classes. Supports multiple modalities.
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=185
>>> import nipype.interfaces.spm as spm
>>> seg = spm.NewSegment()
>>> seg.inputs.channel_files = 'structural.nii'
>>> seg.run()
Inputs:
[Mandatory]
channel_files : (an existing file name)
A list of files to be segmented
[Optional]
affine_regularization : ('mni' or 'eastern' or 'subj' or 'none')
mni, eastern, subj, none
channel_info : (a list of items which are a tuple of the form: (a float, a float, a tuple of the form: (a boolean, a boolean)))
A list of tuples (one per channel/modality)
with the following fields:
- bias reguralisation (0-10)
- FWHM of Gaussian smoothness of bias
- which maps to save (Corrected, Field) - a tuple of two boolean values
matlab_cmd : (a string)
Unknown
mfile : (a boolean)
Run m-code using m-file
paths : (a directory name)
Paths to add to matlabpath
sampling_distance : (a float)
Sampling distance on data for parameter estimation
tissues : (a list of items which are a tuple of the form: (a list of items which are an existing file name, an integer, 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
- number of gaussians
- which maps to save [Native, DARTEL] - a tuple of two boolean values
- which maps to save [Modulated, Unmodualted] - a tuple of two boolean values
warping_regularization : (a float)
Aproximate distance between sampling points.
write_deformation_fields : (a list of from 2 to 2 items which are a boolean)
Which deformation fields to write:[Inverse, Forward]
Outputs:
native_class_images : (an existing file name)
native space grey probability map
transformation_mat : (an existing file name)
Normalization transformation
use spm_normalise for warping an image to a template
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=51
>>> import nipype.interfaces.spm as spm
>>> norm = spm.Normalize()
>>> norm.inputs.source = 'functional.nii'
>>> norm.run()
Inputs:
[Mandatory]
parameter_file : (a file name)
normalization parameter file*_sn.mat
exclusive: source,template
source : (an existing file name)
file to normalize to template
exclusive: parameter_file
template : (an existing file name)
template file to normalize to
exclusive: parameter_file
[Optional]
DCT_period_cutoff : (a float)
Cutoff of for DCT bases (opt)
affine_regularization_type : ('mni' or 'size' or 'none')
mni, size, none (opt)
apply_to_files : (an existing file name)
files to apply transformation to (opt)
jobtype : ('estwrite' or 'estimate' or 'write')
one of: estimate, write, estwrite (opt, estwrite)
matlab_cmd : (a string)
Unknown
mfile : (a boolean)
Run m-code using m-file
nonlinear_iterations : (an integer)
Number of iterations of nonlinear warping (opt)
nonlinear_regularization : (a float)
the amount of the regularization for the nonlinear part of the normalization (opt)
paths : (a directory name)
Paths to add to matlabpath
source_image_smoothing : (a float)
source smoothing (opt)
source_weight : (a file name)
name of weighting image for source (opt)
template_image_smoothing : (a float)
template smoothing (opt)
template_weight : (a file name)
name of weighting image for template (opt)
write_bounding_box : (a list of from 6 to 6 items which are a float)
6-element list (opt)
write_interp : (an integer >= 0)
degree of b-spline used for interpolation
write_preserve : (a boolean)
True/False warped images are modulated (opt,)
write_voxel_sizes : (a list of from 3 to 3 items which are a float)
3-element list (opt)
write_wrap : (a list of items which are a boolean)
Check if interpolation should wrap in [x,y,z] - list of bools (opt)
Outputs:
normalization_parameters : (an existing file name)
MAT files containing the normalization parameters
normalized_files : (an existing file name)
Normalized other files
normalized_source : (an existing file name)
Normalized source files
Use spm_realign for estimating within modality rigid body alignment
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=25
>>> import nipype.interfaces.spm as spm
>>> realign = spm.Realign()
>>> realign.inputs.in_files = 'functional.nii'
>>> realign.inputs.register_to_mean = True
>>> realign.run()
Inputs:
[Mandatory]
in_files : (a list of items which are an existing file name or an existing file name)
list of filenames to realign
[Optional]
fwhm : (a floating point number >= 0.0)
gaussian smoothing kernel width
interp : (0 <= an integer <= 7)
degree of b-spline used for interpolation
jobtype : ('estwrite' or 'estimate' or 'write')
one of: estimate, write, estwrite
matlab_cmd : (a string)
Unknown
mfile : (a boolean)
Run m-code using m-file
paths : (a directory name)
Paths to add to matlabpath
quality : (0.0 <= a floating point number <= 1.0)
0.1 = fast, 1.0 = precise
register_to_mean : (a boolean)
Indicate whether realignment is done to the mean image
separation : (a floating point number >= 0.0)
sampling separation in mm
weight_img : (an existing file name)
filename of weighting image
wrap : (a tuple of the form: (an integer, an integer, an integer))
Check if interpolation should wrap in [x,y,z]
write_interp : (0 <= an integer <= 7)
degree of b-spline used for interpolation
write_mask : (a boolean)
True/False mask output image
write_which : (a tuple of the form: (an integer, an integer))
determines which images to reslice
write_wrap : (a tuple of the form: (an integer, an integer, an integer))
Check if interpolation should wrap in [x,y,z]
Outputs:
mean_image : (an existing file name)
Mean image file from the realignment
realigned_files : (a list of items which are an existing file name or an existing file name)
Realigned files
realignment_parameters : (an existing file name)
Estimated translation and rotation parameters
use spm_segment to separate structural images into different tissue classes.
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=43
>>> import nipype.interfaces.spm as spm
>>> seg = spm.Segment()
>>> seg.inputs.data = 'structural.nii'
>>> seg.run()
Inputs:
[Mandatory]
data : (an existing file name)
one scan per subject
[Optional]
affine_regularization : ('mni' or 'eastern' or 'subj' or 'none')
mni, eastern, subj, none
bias_fwhm : (30 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_regularization : (0 or 1.0000000000000001e-05 or 0.0001 or 0.001 or 0.01 or 0.10000000000000001 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: [0,0,0],
Native Space: [0,0,1],
Unmodulated Normalised: [0,1,0],
Modulated Normalised: [1,0,0],
Native + Unmodulated Normalised: [0,1,1],
Native + Modulated Normalised: [1,0,1],
Native + Modulated + Unmodulated: [1,1,1],
Modulated + Unmodulated Normalised: [1,1,0]
gaussians_per_class : (a list of items which are an integer)
num Gaussians capture intensity distribution
gm_output_type : (a 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: [0,0,0],
Native Space: [0,0,1],
Unmodulated Normalised: [0,1,0],
Modulated Normalised: [1,0,0],
Native + Unmodulated Normalised: [0,1,1],
Native + Modulated Normalised: [1,0,1],
Native + Modulated + Unmodulated: [1,1,1],
Modulated + Unmodulated Normalised: [1,1,0]
mask_image : (an existing file name)
Binary image to restrict parameter estimation
matlab_cmd : (a string)
Unknown
mfile : (a boolean)
Run m-code using m-file
paths : (a directory name)
Paths to add to matlabpath
sampling_distance : (a float)
Sampling distance on data for parameter estimation
save_bias_corrected : (a boolean)
True/False produce a bias corrected image
tissue_prob_maps : (a list of items which are an existing file name)
list of gray, white & csf prob. (opt,)
warp_frequency_cutoff : (a float)
Cutoff of DCT bases
warping_regularization : (a 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: [0,0,0],
Native Space: [0,0,1],
Unmodulated Normalised: [0,1,0],
Modulated Normalised: [1,0,0],
Native + Unmodulated Normalised: [0,1,1],
Native + Modulated Normalised: [1,0,1],
Native + Modulated + Unmodulated: [1,1,1],
Modulated + Unmodulated Normalised: [1,1,0]
Outputs:
inverse_transformation_mat : (an existing file name)
Inverse normalization info
modulated_csf_image : (an existing file name)
modulated, normalized csf probability map
modulated_gm_image : (an existing file name)
modulated, normalized grey probability map
modulated_input_image : (an existing file name)
modulated version of input image
modulated_wm_image : (an existing file name)
modulated, normalized white probability map
native_csf_image : (an existing file name)
native space csf probability map
native_gm_image : (an existing file name)
native space grey probability map
native_wm_image : (an existing file name)
native space white probability map
normalized_csf_image : (an existing file name)
normalized csf probability map
normalized_gm_image : (an existing file name)
normalized grey probability map
normalized_wm_image : (an existing file name)
normalized white probability map
transformation_mat : (an existing file name)
Normalization transformation
Use spm to perform slice timing correction.
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=19
>>> 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 = range(32,0,-1)
>>> st.inputs.ref_slice = 1
>>> st.run()
Inputs:
[Mandatory]
in_files : (a list of items which are an existing file name or an existing file name)
list of filenames to apply slice timing
[Optional]
matlab_cmd : (a string)
Unknown
mfile : (a boolean)
Run m-code using m-file
num_slices : (an integer)
number of slices in a volume
paths : (a directory name)
Paths to add to matlabpath
ref_slice : (an integer)
1-based Number of the reference slice
slice_order : (a list of items which are an integer)
1-based order in which slices are acquired
time_acquisition : (a float)
time of volume acquisition. usually calculated as TR-(TR/num_slices)
time_repetition : (a float)
time between volume acquisitions (start to start time)
Outputs:
timecorrected_files : (a file name)
Unknown
Use spm_smooth for 3D Gaussian smoothing of image volumes.
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=57
>>> import nipype.interfaces.spm as spm
>>> smooth = spm.Smooth()
>>> smooth.inputs.in_files = 'functional.nii'
>>> smooth.inputs.fwhm = [4, 4, 4]
>>> smooth.run()
Inputs:
[Mandatory]
in_files : (an existing file name)
list of files to smooth
[Optional]
data_type : (an integer)
Data type of the output images (opt)
fwhm : (a list of from 3 to 3 items which are a float or a float)
3-list of fwhm for each dimension (opt)
matlab_cmd : (a string)
Unknown
mfile : (a boolean)
Run m-code using m-file
paths : (a directory name)
Paths to add to matlabpath
Outputs:
smoothed_files : (an existing file name)
smoothed files