nipype.interfaces.freesurfer.registration module¶
Provides interfaces to various longitudinal commands provided by freesurfer
EMRegister¶
Bases: FSCommandOpenMP
Wrapped executable:
mri_em_register.This program creates a tranform in lta format
Examples
>>> from nipype.interfaces.freesurfer import EMRegister >>> register = EMRegister() >>> register.inputs.in_file = 'norm.mgz' >>> register.inputs.template = 'aseg.mgz' >>> register.inputs.out_file = 'norm_transform.lta' >>> register.inputs.skull = True >>> register.inputs.nbrspacing = 9 >>> register.cmdline 'mri_em_register -uns 9 -skull norm.mgz aseg.mgz norm_transform.lta'
- in_file : a pathlike object or string representing an existing file
- In brain volume. Maps to a command-line argument:
%s(position: -3).- template : a pathlike object or string representing an existing file
- Template gca. Maps to a command-line argument:
%s(position: -2).
- args : a unicode string
- Additional parameters to the command. Maps to a command-line argument:
%s.- environ : a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’
- Environment variables. (Nipype default value:
{})- mask : a pathlike object or string representing an existing file
- Use volume as a mask. Maps to a command-line argument:
-mask %s.- nbrspacing : an integer (int or long)
- Align to atlas containing skull setting unknown_nbr_spacing = nbrspacing. Maps to a command-line argument:
-uns %d.- num_threads : an integer (int or long)
- Allows for specifying more threads.
- out_file : a pathlike object or string representing a file
- Output transform. Maps to a command-line argument:
%s(position: -1).- skull : a boolean
- Align to atlas containing skull (uns=5). Maps to a command-line argument:
-skull.- subjects_dir : a pathlike object or string representing an existing directory
- Subjects directory.
- transform : a pathlike object or string representing an existing file
- Previously computed transform. Maps to a command-line argument:
-t %s.
- out_file : a pathlike object or string representing a file
- Output transform.
MPRtoMNI305¶
Bases: FSScriptCommand
Wrapped executable:
mpr2mni305.For complete details, see FreeSurfer documentation
Examples
>>> from nipype.interfaces.freesurfer import MPRtoMNI305, Info >>> mprtomni305 = MPRtoMNI305() >>> mprtomni305.inputs.target = 'structural.nii' >>> mprtomni305.inputs.reference_dir = '.' # doctest: +SKIP >>> mprtomni305.cmdline # doctest: +SKIP 'mpr2mni305 output' >>> mprtomni305.inputs.out_file = 'struct_out' # doctest: +SKIP >>> mprtomni305.cmdline # doctest: +SKIP 'mpr2mni305 struct_out' # doctest: +SKIP >>> mprtomni305.inputs.environ['REFDIR'] == os.path.join(Info.home(), 'average') # doctest: +SKIP True >>> mprtomni305.inputs.environ['MPR2MNI305_TARGET'] # doctest: +SKIP 'structural' >>> mprtomni305.run() # doctest: +SKIP
- reference_dir : a pathlike object or string representing an existing directory
- TODO. (Nipype default value:
"")- target : a string
- Input atlas file. (Nipype default value:
"")
- args : a unicode string
- Additional parameters to the command. Maps to a command-line argument:
%s.- environ : a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’
- Environment variables. (Nipype default value:
{})- in_file : a pathlike object or string representing a file
- The input file prefix for MPRtoMNI305. Maps to a command-line argument:
%s. (Nipype default value:<undefined>)- subjects_dir : a pathlike object or string representing an existing directory
- Subjects directory.
- log_file : a pathlike object or string representing an existing file
- The output log. (Nipype default value:
output.nipype)- out_file : a pathlike object or string representing a file
- The output file ‘<in_file>_to_<target>_t4_vox2vox.txt’.
MRICoreg¶
Bases: FSCommand
Wrapped executable:
mri_coreg.This program registers one volume to another
mri_coreg is a C reimplementation of spm_coreg in FreeSurfer
Examples
>>> from nipype.interfaces.freesurfer import MRICoreg >>> coreg = MRICoreg() >>> coreg.inputs.source_file = 'moving1.nii' >>> coreg.inputs.reference_file = 'fixed1.nii' >>> coreg.inputs.subjects_dir = '.' >>> coreg.cmdline # doctest: +ELLIPSIS 'mri_coreg --lta .../registration.lta --ref fixed1.nii --mov moving1.nii --sd .'If passing a subject ID, the reference mask may be disabled:
>>> coreg = MRICoreg() >>> coreg.inputs.source_file = 'moving1.nii' >>> coreg.inputs.subjects_dir = '.' >>> coreg.inputs.subject_id = 'fsaverage' >>> coreg.inputs.reference_mask = False >>> coreg.cmdline # doctest: +ELLIPSIS 'mri_coreg --s fsaverage --no-ref-mask --lta .../registration.lta --mov moving1.nii --sd .'Spatial scales may be specified as a list of one or two separations:
>>> coreg.inputs.sep = [4] >>> coreg.cmdline # doctest: +ELLIPSIS 'mri_coreg --s fsaverage --no-ref-mask --lta .../registration.lta --sep 4 --mov moving1.nii --sd .'>>> coreg.inputs.sep = [4, 5] >>> coreg.cmdline # doctest: +ELLIPSIS 'mri_coreg --s fsaverage --no-ref-mask --lta .../registration.lta --sep 4 --sep 5 --mov moving1.nii --sd .'
- reference_file : a pathlike object or string representing a file
- Reference (target) file. Maps to a command-line argument:
--ref %s. Mutually exclusive with inputs:subject_id.- source_file : a pathlike object or string representing a file
- Source file to be registered. Maps to a command-line argument:
--mov %s.- subject_id : a unicode string
- Freesurfer subject ID (implies
reference_mask == aparc+aseg.mgzunless otherwise specified). Maps to a command-line argument:--s %s(position: 1). Mutually exclusive with inputs:reference_file. Requires inputs:subjects_dir.
- args : a unicode string
- Additional parameters to the command. Maps to a command-line argument:
%s.- brute_force_limit : a float
- Constrain brute force search to +/- lim. Maps to a command-line argument:
--bf-lim %g. Mutually exclusive with inputs:no_brute_force.- brute_force_samples : an integer (int or long)
- Number of samples in brute force search. Maps to a command-line argument:
--bf-nsamp %d. Mutually exclusive with inputs:no_brute_force.- conform_reference : a boolean
- Conform reference without rescaling. Maps to a command-line argument:
--conf-ref.- dof : 6 or 9 or 12
- Number of transform degrees of freedom. Maps to a command-line argument:
--dof %d.- environ : a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’
- Environment variables. (Nipype default value:
{})- ftol : a float
- Floating-point tolerance (default=1e-7). Maps to a command-line argument:
--ftol %e.- initial_rotation : a tuple of the form: (a float, a float, a float)
- Initial rotation in degrees. Maps to a command-line argument:
--rot %g %g %g.- initial_scale : a tuple of the form: (a float, a float, a float)
- Initial scale. Maps to a command-line argument:
--scale %g %g %g.- initial_shear : a tuple of the form: (a float, a float, a float)
- Initial shear (Hxy, Hxz, Hyz). Maps to a command-line argument:
--shear %g %g %g.- initial_translation : a tuple of the form: (a float, a float, a float)
- Initial translation in mm (implies no_cras0). Maps to a command-line argument:
--trans %g %g %g.- linmintol : a float
- Maps to a command-line argument:
--linmintol %e.- max_iters : a long integer >= 1
- Maximum iterations (default: 4). Maps to a command-line argument:
--nitersmax %d.- no_brute_force : a boolean
- Do not brute force search. Maps to a command-line argument:
--no-bf.- no_coord_dithering : a boolean
- Turn off coordinate dithering. Maps to a command-line argument:
--no-coord-dither.- no_cras0 : a boolean
- Do not set translation parameters to align centers of source and reference files. Maps to a command-line argument:
--no-cras0.- no_intensity_dithering : a boolean
- Turn off intensity dithering. Maps to a command-line argument:
--no-intensity-dither.- no_smooth : a boolean
- Do not apply smoothing to either reference or source file. Maps to a command-line argument:
--no-smooth.- num_threads : an integer (int or long)
- Number of OpenMP threads. Maps to a command-line argument:
--threads %d.- out_lta_file : a bool or None or a pathlike object or string representing a file
- Output registration file (LTA format). Maps to a command-line argument:
--lta %s. (Nipype default value:True)- out_params_file : a bool or None or a pathlike object or string representing a file
- Output parameters file. Maps to a command-line argument:
--params %s.- out_reg_file : a bool or None or a pathlike object or string representing a file
- Output registration file (REG format). Maps to a command-line argument:
--regdat %s.- ref_fwhm : a float
- Apply smoothing to reference file. Maps to a command-line argument:
--ref-fwhm.- reference_mask : a bool or None or a unicode string
- Mask reference volume with given mask, or None if
False. Maps to a command-line argument:--ref-mask %s(position: 2).- saturation_threshold : 0.0 <= a floating point number <= 100.0
- Saturation threshold (default=9.999). Maps to a command-line argument:
--sat %g.- sep : a list of from 1 to 2 items which are any value
- Set spatial scales, in voxels (default [2, 4]). Maps to a command-line argument:
--sep %s....- source_mask : a unicode string
- Mask source file with given mask. Maps to a command-line argument:
--mov-mask.- source_oob : a boolean
- Count source voxels that are out-of-bounds as 0. Maps to a command-line argument:
--mov-oob.- subjects_dir : a pathlike object or string representing an existing directory
- FreeSurfer SUBJECTS_DIR. Maps to a command-line argument:
--sd %s.
- out_lta_file : a pathlike object or string representing an existing file
- Output LTA-style registration file.
- out_params_file : a pathlike object or string representing an existing file
- Output parameters file.
- out_reg_file : a pathlike object or string representing an existing file
- Output registration file.
Paint¶
Bases: FSCommand
Wrapped executable:
mrisp_paint.This program is useful for extracting one of the arrays (“a variable”) from a surface-registration template file. The output is a file containing a surface-worth of per-vertex values, saved in “curvature” format. Because the template data is sampled to a particular surface mesh, this conjures the idea of “painting to a surface”.
Examples
>>> from nipype.interfaces.freesurfer import Paint >>> paint = Paint() >>> paint.inputs.in_surf = 'lh.pial' >>> paint.inputs.template = 'aseg.mgz' >>> paint.inputs.averages = 5 >>> paint.inputs.out_file = 'lh.avg_curv' >>> paint.cmdline 'mrisp_paint -a 5 aseg.mgz lh.pial lh.avg_curv'
- in_surf : a pathlike object or string representing an existing file
- Surface file with grid (vertices) onto which the template data is to be sampled or ‘painted’. Maps to a command-line argument:
%s(position: -2).- template : a pathlike object or string representing an existing file
- Template file. Maps to a command-line argument:
%s(position: -3).
- args : a unicode string
- Additional parameters to the command. Maps to a command-line argument:
%s.- averages : an integer (int or long)
- Average curvature patterns. Maps to a command-line argument:
-a %d.- environ : a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’
- Environment variables. (Nipype default value:
{})- out_file : a pathlike object or string representing a file
- File containing a surface-worth of per-vertex values, saved in ‘curvature’ format. Maps to a command-line argument:
%s(position: -1).- subjects_dir : a pathlike object or string representing an existing directory
- Subjects directory.
- template_param : an integer (int or long)
- Frame number of the input template.
- out_file : a pathlike object or string representing a file
- File containing a surface-worth of per-vertex values, saved in ‘curvature’ format.
Register¶
Bases: FSCommand
Wrapped executable:
mris_register.This program registers a surface to an average surface template.
Examples
>>> from nipype.interfaces.freesurfer import Register >>> register = Register() >>> register.inputs.in_surf = 'lh.pial' >>> register.inputs.in_smoothwm = 'lh.pial' >>> register.inputs.in_sulc = 'lh.pial' >>> register.inputs.target = 'aseg.mgz' >>> register.inputs.out_file = 'lh.pial.reg' >>> register.inputs.curv = True >>> register.cmdline 'mris_register -curv lh.pial aseg.mgz lh.pial.reg'
- in_sulc : a pathlike object or string representing an existing file
- Undocumented mandatory input file ${SUBJECTS_DIR}/surf/{hemisphere}.sulc .
- in_surf : a pathlike object or string representing an existing file
- Surface to register, often {hemi}.sphere. Maps to a command-line argument:
%s(position: -3).- target : a pathlike object or string representing an existing file
- The data to register to. In normal recon-all usage, this is a template file for average surface. Maps to a command-line argument:
%s(position: -2).
- args : a unicode string
- Additional parameters to the command. Maps to a command-line argument:
%s.- curv : a boolean
- Use smoothwm curvature for final alignment. Maps to a command-line argument:
-curv. Requires inputs:in_smoothwm.- environ : a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’
- Environment variables. (Nipype default value:
{})- in_smoothwm : a pathlike object or string representing an existing file
- Undocumented input file ${SUBJECTS_DIR}/surf/{hemisphere}.smoothwm .
- out_file : a pathlike object or string representing a file
- Output surface file to capture registration. Maps to a command-line argument:
%s(position: -1).- subjects_dir : a pathlike object or string representing an existing directory
- Subjects directory.
- out_file : a pathlike object or string representing a file
- Output surface file to capture registration.
RegisterAVItoTalairach¶
Bases: FSScriptCommand
Wrapped executable:
avi2talxfm.converts the vox2vox from talairach_avi to a talairach.xfm file
This is a script that converts the vox2vox from talairach_avi to a talairach.xfm file. It is meant to replace the following cmd line:
tkregister2_cmdl –mov $InVol –targ $FREESURFER_HOME/average/mni305.cor.mgz –xfmout ${XFM} –vox2vox talsrcimg_to_${target}_t4_vox2vox.txt –noedit –reg talsrcimg.reg.tmp.dat set targ = $FREESURFER_HOME/average/mni305.cor.mgz set subject = mgh-02407836-v2 set InVol = $SUBJECTS_DIR/$subject/mri/orig.mgz set vox2vox = $SUBJECTS_DIR/$subject/mri/transforms/talsrcimg_to_711-2C_as_mni_average_305_t4_vox2vox.txt
Examples
>>> from nipype.interfaces.freesurfer import RegisterAVItoTalairach >>> register = RegisterAVItoTalairach() >>> register.inputs.in_file = 'structural.mgz' # doctest: +SKIP >>> register.inputs.target = 'mni305.cor.mgz' # doctest: +SKIP >>> register.inputs.vox2vox = 'talsrcimg_to_structural_t4_vox2vox.txt' # doctest: +SKIP >>> register.cmdline # doctest: +SKIP 'avi2talxfm structural.mgz mni305.cor.mgz talsrcimg_to_structural_t4_vox2vox.txt talairach.auto.xfm'>>> register.run() # doctest: +SKIP
- in_file : a pathlike object or string representing an existing file
- The input file. Maps to a command-line argument:
%s(position: 0).- target : a pathlike object or string representing an existing file
- The target file. Maps to a command-line argument:
%s(position: 1).- vox2vox : a pathlike object or string representing an existing file
- The vox2vox file. Maps to a command-line argument:
%s(position: 2).
- args : a unicode string
- Additional parameters to the command. Maps to a command-line argument:
%s.- environ : a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’
- Environment variables. (Nipype default value:
{})- out_file : a pathlike object or string representing a file
- The transform output. Maps to a command-line argument:
%s(position: 3). (Nipype default value:talairach.auto.xfm)- subjects_dir : a pathlike object or string representing an existing directory
- Subjects directory.
- log_file : a pathlike object or string representing an existing file
- The output log. (Nipype default value:
output.nipype)- out_file : a pathlike object or string representing a file
- The output file for RegisterAVItoTalairach.
