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_filea pathlike object or string representing an existing file
In brain volume. Maps to a command-line argument:
%s
(position: -3).- templatea pathlike object or string representing an existing file
Template gca. Maps to a command-line argument:
%s
(position: -2).
- argsa string
Additional parameters to the command. Maps to a command-line argument:
%s
.- environa 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:
{}
)- maska pathlike object or string representing an existing file
Use volume as a mask. Maps to a command-line argument:
-mask %s
.- nbrspacingan integer
Align to atlas containing skull setting unknown_nbr_spacing = nbrspacing. Maps to a command-line argument:
-uns %d
.- num_threadsan integer
Allows for specifying more threads.
- out_filea pathlike object or string representing a file
Output transform. Maps to a command-line argument:
%s
(position: -1).- skulla boolean
Align to atlas containing skull (uns=5). Maps to a command-line argument:
-skull
.- subjects_dira pathlike object or string representing an existing directory
Subjects directory.
- transforma pathlike object or string representing an existing file
Previously computed transform. Maps to a command-line argument:
-t %s
.
- out_filea 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 = '.' >>> mprtomni305.cmdline 'mpr2mni305 output' >>> mprtomni305.inputs.out_file = 'struct_out' >>> mprtomni305.cmdline 'mpr2mni305 struct_out' >>> mprtomni305.inputs.environ['REFDIR'] == os.path.join(Info.home(), 'average') True >>> mprtomni305.inputs.environ['MPR2MNI305_TARGET'] 'structural' >>> mprtomni305.run()
- reference_dira pathlike object or string representing an existing directory
TODO. (Nipype default value:
""
)- targeta string
Input atlas file. (Nipype default value:
""
)
- argsa string
Additional parameters to the command. Maps to a command-line argument:
%s
.- environa 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_filea 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_dira pathlike object or string representing an existing directory
Subjects directory.
- log_filea pathlike object or string representing an existing file
The output log. (Nipype default value:
output.nipype
)- out_filea 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 '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 '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 'mri_coreg --s fsaverage --no-ref-mask --lta .../registration.lta --sep 4 --mov moving1.nii --sd .'>>> coreg.inputs.sep = [4, 5] >>> coreg.cmdline 'mri_coreg --s fsaverage --no-ref-mask --lta .../registration.lta --sep 4 --sep 5 --mov moving1.nii --sd .'
- reference_filea 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_filea pathlike object or string representing a file
Source file to be registered. Maps to a command-line argument:
--mov %s
.- subject_ida string
Freesurfer subject ID (implies
reference_mask == aparc+aseg.mgz
unless otherwise specified). Maps to a command-line argument:--s %s
(position: 1). Mutually exclusive with inputs:reference_file
. Requires inputs:subjects_dir
.
- argsa string
Additional parameters to the command. Maps to a command-line argument:
%s
.- brute_force_limita 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_samplesan integer
Number of samples in brute force search. Maps to a command-line argument:
--bf-nsamp %d
. Mutually exclusive with inputs:no_brute_force
.- conform_referencea boolean
Conform reference without rescaling. Maps to a command-line argument:
--conf-ref
.- dof6 or 9 or 12
Number of transform degrees of freedom. Maps to a command-line argument:
--dof %d
.- environa 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:
{}
)- ftola float
Floating-point tolerance (default=1e-7). Maps to a command-line argument:
--ftol %e
.- initial_rotationa 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_scalea tuple of the form: (a float, a float, a float)
Initial scale. Maps to a command-line argument:
--scale %g %g %g
.- initial_sheara 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_translationa 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
.- linmintola float
Maps to a command-line argument:
--linmintol %e
.- max_itersan integer >= 1
Maximum iterations (default: 4). Maps to a command-line argument:
--nitersmax %d
.- no_brute_forcea boolean
Do not brute force search. Maps to a command-line argument:
--no-bf
.- no_coord_ditheringa boolean
Turn off coordinate dithering. Maps to a command-line argument:
--no-coord-dither
.- no_cras0a boolean
Do not set translation parameters to align centers of source and reference files. Maps to a command-line argument:
--no-cras0
.- no_intensity_ditheringa boolean
Turn off intensity dithering. Maps to a command-line argument:
--no-intensity-dither
.- no_smootha boolean
Do not apply smoothing to either reference or source file. Maps to a command-line argument:
--no-smooth
.- num_threadsan integer
Number of OpenMP threads. Maps to a command-line argument:
--threads %d
.- out_lta_filea 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_filea 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_filea 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_fwhma float
Apply smoothing to reference file. Maps to a command-line argument:
--ref-fwhm
.- reference_maska bool or None or a string
Mask reference volume with given mask, or None if
False
. Maps to a command-line argument:--ref-mask %s
(position: 2).- saturation_threshold0.0 <= a floating point number <= 100.0
Saturation threshold (default=9.999). Maps to a command-line argument:
--sat %g
.- sepa 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_maska string
Mask source file with given mask. Maps to a command-line argument:
--mov-mask
.- source_ooba boolean
Count source voxels that are out-of-bounds as 0. Maps to a command-line argument:
--mov-oob
.- subjects_dira pathlike object or string representing an existing directory
FreeSurfer SUBJECTS_DIR. Maps to a command-line argument:
--sd %s
.
- out_lta_filea pathlike object or string representing an existing file
Output LTA-style registration file.
- out_params_filea pathlike object or string representing an existing file
Output parameters file.
- out_reg_filea 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_surfa 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).- templatea pathlike object or string representing an existing file
Template file. Maps to a command-line argument:
%s
(position: -3).
- argsa string
Additional parameters to the command. Maps to a command-line argument:
%s
.- averagesan integer
Average curvature patterns. Maps to a command-line argument:
-a %d
.- environa 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_filea 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_dira pathlike object or string representing an existing directory
Subjects directory.
- template_paraman integer
Frame number of the input template.
- out_filea 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_sulca pathlike object or string representing an existing file
Undocumented mandatory input file ${SUBJECTS_DIR}/surf/{hemisphere}.sulc .
- in_surfa pathlike object or string representing an existing file
Surface to register, often {hemi}.sphere. Maps to a command-line argument:
%s
(position: -3).- targeta 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).
- argsa string
Additional parameters to the command. Maps to a command-line argument:
%s
.- curva boolean
Use smoothwm curvature for final alignment. Maps to a command-line argument:
-curv
. Requires inputs:in_smoothwm
.- environa 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_smoothwma pathlike object or string representing an existing file
Undocumented input file ${SUBJECTS_DIR}/surf/{hemisphere}.smoothwm .
- out_filea pathlike object or string representing a file
Output surface file to capture registration. Maps to a command-line argument:
%s
(position: -1).- subjects_dira pathlike object or string representing an existing directory
Subjects directory.
- out_filea 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' >>> register.inputs.target = 'mni305.cor.mgz' >>> register.inputs.vox2vox = 'talsrcimg_to_structural_t4_vox2vox.txt' >>> register.cmdline 'avi2talxfm structural.mgz mni305.cor.mgz talsrcimg_to_structural_t4_vox2vox.txt talairach.auto.xfm'>>> register.run()
- in_filea pathlike object or string representing an existing file
The input file. Maps to a command-line argument:
%s
(position: 0).- targeta pathlike object or string representing an existing file
The target file. Maps to a command-line argument:
%s
(position: 1).- vox2voxa pathlike object or string representing an existing file
The vox2vox file. Maps to a command-line argument:
%s
(position: 2).
- argsa string
Additional parameters to the command. Maps to a command-line argument:
%s
.- environa 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_filea 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_dira pathlike object or string representing an existing directory
Subjects directory.
- log_filea pathlike object or string representing an existing file
The output log. (Nipype default value:
output.nipype
)- out_filea pathlike object or string representing a file
The output file for RegisterAVItoTalairach.