interfaces.freesurfer.registration

EMRegister

Link to code

Wraps the executable command 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'

Inputs:

[Mandatory]
in_file: (an existing file name)
        in brain volume
        argument: ``%s``, position: -3
template: (an existing file name)
        template gca
        argument: ``%s``, position: -2

[Optional]
out_file: (a file name)
        output transform
        argument: ``%s``, position: -1
skull: (a boolean)
        align to atlas containing skull (uns=5)
        argument: ``-skull``
mask: (an existing file name)
        use volume as a mask
        argument: ``-mask %s``
nbrspacing: (an integer (int or long))
        align to atlas containing skull setting unknown_nbr_spacing =
        nbrspacing
        argument: ``-uns %d``
transform: (an existing file name)
        Previously computed transform
        argument: ``-t %s``
num_threads: (an integer (int or long))
        allows for specifying more threads
subjects_dir: (an existing directory name)
        subjects directory
args: (a unicode string)
        Additional parameters to the command
        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', nipype default value: {})
        Environment variables

Outputs:

out_file: (a file name)
        output transform

MPRtoMNI305

Link to code

Wraps the executable command 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() 

Inputs:

[Mandatory]
reference_dir: (an existing directory name, nipype default value: )
        TODO
target: (a string, nipype default value: )
        input atlas file

[Optional]
in_file: (a file name, nipype default value: )
        the input file prefix for MPRtoMNI305
        argument: ``%s``
subjects_dir: (an existing directory name)
        subjects directory
args: (a unicode string)
        Additional parameters to the command
        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', nipype default value: {})
        Environment variables

Outputs:

out_file: (a file name)
        The output file '<in_file>_to_<target>_t4_vox2vox.txt'
log_file: (an existing file name, nipype default value:
          output.nipype)
        The output log

MRICoreg

Link to code

Wraps the executable command 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 .'

Inputs:

[Mandatory]
source_file: (a file name)
        source file to be registered
        argument: ``--mov %s``
reference_file: (a file name)
        reference (target) file
        argument: ``--ref %s``
        mutually_exclusive: subject_id
subject_id: (a unicode string)
        freesurfer subject ID (implies ``reference_mask == aparc+aseg.mgz``
        unless otherwise specified)
        argument: ``--s %s``, position: 1
        mutually_exclusive: reference_file
        requires: subjects_dir

[Optional]
out_lta_file: (a bool or None or a file name, nipype default value:
          True)
        output registration file (LTA format)
        argument: ``--lta %s``
out_reg_file: (a bool or None or a file name)
        output registration file (REG format)
        argument: ``--regdat %s``
out_params_file: (a bool or None or a file name)
        output parameters file
        argument: ``--params %s``
subjects_dir: (an existing directory name)
        FreeSurfer SUBJECTS_DIR
        argument: ``--sd %s``
dof: (6 or 9 or 12)
        number of transform degrees of freedom
        argument: ``--dof %d``
reference_mask: (a bool or None or a unicode string)
        mask reference volume with given mask, or None if ``False``
        argument: ``--ref-mask %s``, position: 2
source_mask: (a unicode string)
        mask source file with given mask
        argument: ``--mov-mask``
num_threads: (an integer (int or long))
        number of OpenMP threads
        argument: ``--threads %d``
no_coord_dithering: (a boolean)
        turn off coordinate dithering
        argument: ``--no-coord-dither``
no_intensity_dithering: (a boolean)
        turn off intensity dithering
        argument: ``--no-intensity-dither``
sep: (a list of from 1 to 2 items which are any value)
        set spatial scales, in voxels (default [2, 4])
        argument: ``--sep %s...``
initial_translation: (a tuple of the form: (a float, a float, a
          float))
        initial translation in mm (implies no_cras0)
        argument: ``--trans %g %g %g``
initial_rotation: (a tuple of the form: (a float, a float, a float))
        initial rotation in degrees
        argument: ``--rot %g %g %g``
initial_scale: (a tuple of the form: (a float, a float, a float))
        initial scale
        argument: ``--scale %g %g %g``
initial_shear: (a tuple of the form: (a float, a float, a float))
        initial shear (Hxy, Hxz, Hyz)
        argument: ``--shear %g %g %g``
no_cras0: (a boolean)
        do not set translation parameters to align centers of source and
        reference files
        argument: ``--no-cras0``
max_iters: (a long integer >= 1)
        maximum iterations (default: 4)
        argument: ``--nitersmax %d``
ftol: (a float)
        floating-point tolerance (default=1e-7)
        argument: ``--ftol %e``
linmintol: (a float)
        argument: ``--linmintol %e``
saturation_threshold: (0.0 <= a floating point number <= 100.0)
        saturation threshold (default=9.999)
        argument: ``--sat %g``
conform_reference: (a boolean)
        conform reference without rescaling
        argument: ``--conf-ref``
no_brute_force: (a boolean)
        do not brute force search
        argument: ``--no-bf``
brute_force_limit: (a float)
        constrain brute force search to +/- lim
        argument: ``--bf-lim %g``
        mutually_exclusive: no_brute_force
brute_force_samples: (an integer (int or long))
        number of samples in brute force search
        argument: ``--bf-nsamp %d``
        mutually_exclusive: no_brute_force
no_smooth: (a boolean)
        do not apply smoothing to either reference or source file
        argument: ``--no-smooth``
ref_fwhm: (a float)
        apply smoothing to reference file
        argument: ``--ref-fwhm``
source_oob: (a boolean)
        count source voxels that are out-of-bounds as 0
        argument: ``--mov-oob``
args: (a unicode string)
        Additional parameters to the command
        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', nipype default value: {})
        Environment variables

Outputs:

out_reg_file: (an existing file name)
        output registration file
out_lta_file: (an existing file name)
        output LTA-style registration file
out_params_file: (an existing file name)
        output parameters file

Paint

Link to code

Wraps the executable command 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'

Inputs:

[Mandatory]
in_surf: (an existing file name)
        Surface file with grid (vertices) onto which the template data is to
        be sampled or 'painted'
        argument: ``%s``, position: -2
template: (an existing file name)
        Template file
        argument: ``%s``, position: -3

[Optional]
template_param: (an integer (int or long))
        Frame number of the input template
averages: (an integer (int or long))
        Average curvature patterns
        argument: ``-a %d``
out_file: (a file name)
        File containing a surface-worth of per-vertex values, saved in
        'curvature' format.
        argument: ``%s``, position: -1
subjects_dir: (an existing directory name)
        subjects directory
args: (a unicode string)
        Additional parameters to the command
        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', nipype default value: {})
        Environment variables

Outputs:

out_file: (a file name)
        File containing a surface-worth of per-vertex values, saved in
        'curvature' format.

Register

Link to code

Wraps the executable command 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'

Inputs:

[Mandatory]
in_surf: (an existing file name)
        Surface to register, often {hemi}.sphere
        argument: ``%s``, position: -3
target: (an existing file name)
        The data to register to. In normal recon-all usage, this is a
        template file for average surface.
        argument: ``%s``, position: -2
in_sulc: (an existing file name)
        Undocumented mandatory input file
        ${SUBJECTS_DIR}/surf/{hemisphere}.sulc

[Optional]
out_file: (a file name)
        Output surface file to capture registration
        argument: ``%s``, position: -1
curv: (a boolean)
        Use smoothwm curvature for final alignment
        argument: ``-curv``
        requires: in_smoothwm
in_smoothwm: (an existing file name)
        Undocumented input file ${SUBJECTS_DIR}/surf/{hemisphere}.smoothwm
subjects_dir: (an existing directory name)
        subjects directory
args: (a unicode string)
        Additional parameters to the command
        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', nipype default value: {})
        Environment variables

Outputs:

out_file: (a file name)
        Output surface file to capture registration

RegisterAVItoTalairach

Link to code

Wraps the executable command 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() 

Inputs:

[Mandatory]
in_file: (an existing file name)
        The input file
        argument: ``%s``, position: 0
target: (an existing file name)
        The target file
        argument: ``%s``, position: 1
vox2vox: (an existing file name)
        The vox2vox file
        argument: ``%s``, position: 2

[Optional]
out_file: (a file name, nipype default value: talairach.auto.xfm)
        The transform output
        argument: ``%s``, position: 3
subjects_dir: (an existing directory name)
        subjects directory
args: (a unicode string)
        Additional parameters to the command
        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', nipype default value: {})
        Environment variables

Outputs:

out_file: (a file name)
        The output file for RegisterAVItoTalairach
log_file: (an existing file name, nipype default value:
          output.nipype)
        The output log