cmtklib.interfaces.freesurfer module
The FreeSurfer module provides Nipype interfaces for Freesurfer tools missing in nipype or modified.
BBRegister
Bases: nipype.interfaces.freesurfer.base.FSCommand
Wrapped executable:
bbregister
.Use FreeSurfer bbregister to register a volume to the Freesurfer anatomical.
- This program performs within-subject, cross-modal registration using a
boundary-based cost function. The registration is constrained to be 6 DOF (rigid).
- It is required that you have an anatomical scan of the subject that has
already been
recon-all
-ed using freesurfer.Examples
>>> from cmtklib.interfaces.freesurfer import BBRegister >>> bbreg = BBRegister(subject_id='me', >>> source_file='structural.nii', >>> init='header', >>> contrast_type='t2') >>> bbreg.run()
- contrast_type‘t1’ or ‘t2’ or ‘dti’
Contrast type of image. Maps to a command-line argument:
--%s
.- init‘spm’ or ‘fsl’ or ‘header’
Initialize registration spm, fsl, header. Maps to a command-line argument:
--init-%s
. Mutually exclusive with inputs:init_reg_file
.- init_reg_filea pathlike object or string representing an existing file
Existing registration file. Mutually exclusive with inputs:
init
.- 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. Maps to a command-line argument:
--s %s
.
- 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:
{}
)- epi_maska boolean
Mask out B0 regions in stages 1 and 2. Maps to a command-line argument:
--epi-mask
.- intermediate_filea pathlike object or string representing an existing file
Intermediate image, e.g. in case of partial FOV. Maps to a command-line argument:
--int %s
.- out_fsl_filea boolean or a pathlike object or string representing a file
Write the transformation matrix in FSL FLIRT format. Maps to a command-line argument:
--fslmat %s
.- out_reg_filea pathlike object or string representing a file
Output registration file. Maps to a command-line argument:
--reg %s
.- reg_framean integer
0-based frame index for 4D source file. Maps to a command-line argument:
--frame %d
. Mutually exclusive with inputs:reg_middle_frame
.- reg_middle_framea boolean
Register middle frame of 4D source file. Maps to a command-line argument:
--mid-frame
. Mutually exclusive with inputs:reg_frame
.- registered_filea boolean or a pathlike object or string representing a file
Output warped sourcefile either True or filename. Maps to a command-line argument:
--o %s
.- spm_niftia boolean
Force use of nifti rather than analyze with SPM. Maps to a command-line argument:
--spm-nii
.- subjects_dira pathlike object or string representing an existing directory
Subjects directory.
- min_cost_filea pathlike object or string representing an existing file
Output registration minimum cost file.
- out_fsl_filea pathlike object or string representing a file
Output FLIRT-style registration file.
- out_reg_filea pathlike object or string representing an existing file
Output registration file.
- registered_filea pathlike object or string representing a file
Registered and resampled source file.
Tkregister2
Bases: nipype.interfaces.base.core.CommandLine
Wrapped executable:
tkregister2
.Performs image co-registration using Freesurfer
tkregister2
.Examples
>>> from cmtklib.interfaces.freesurfer import Tkregister2 >>> tkreg = Tkregister2() >>> tkreg.inputs.in_file = 'sub-01_desc-brain_mask.nii.gz' >>> tkreg.inputs.subject_dir = '/path/to/output_dir/freesurfer/sub-01' >>> tkreg.inputs.subjects_dir = '/path/to/output_dir/freesurfer' >>> tkreg.inputs.subject_id = 'sub-01' >>> tkreg.inputs.regheader = True >>> tkreg.inputs.in_file = '/path/to/moving_image.nii.gz' >>> tkreg.inputs.target_file = '/path/to/fixed_image.nii.gz' >>> tkreg.inputs.fslreg_out = 'motions.par' >>> tkreg.inputs.noedit = True >>> tkreg.run()
- fslreg_outa string
FSL-Style registration output matrix. Maps to a command-line argument:
--fslregout %s
.- in_filea pathlike object or string representing a file
Movable volume. Maps to a command-line argument:
--mov %s
.- reg_outa string
Input/output registration file. Maps to a command-line argument:
--reg %s
.- target_filea pathlike object or string representing a file
Target volume. Maps to a command-line argument:
--targ %s
.
- 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:
{}
)- noedita boolean
Do not open edit window (exit) - for conversions. Maps to a command-line argument:
--noedit
.- regheadera boolean
Compute registration from headers. Maps to a command-line argument:
--regheader
.- subject_ida string
Set subject id. Maps to a command-line argument:
--s %s
.- subjects_dira pathlike object or string representing an existing directory
Use dir as SUBJECTS_DIR. Maps to a command-line argument:
--sd %s
.
- fslregout_filea pathlike object or string representing a file
Resulting FSL-Style registration matrix.
- regout_filea pathlike object or string representing a file
Resulting registration file.
copyBrainMaskToFreesurfer
Bases: nipype.interfaces.io.IOBase
Copy a custom brain mask in the freesurfer subject
mri/
directory.
- It replaces the brainmask files generated by Freesurfer recon-all
in order to re-run recon-all with a custom brain mask.
Examples
>>> from cmtklib.interfaces.freesurfer import copyBrainMaskToFreesurfer >>> copy_mask_fs = copyBrainMaskToFreesurfer() >>> copy_mask_fs.inputs.in_file = 'sub-01_desc-brain_mask.nii.gz' >>> copy_mask_fs.inputs.subject_dir = '/path/to/output_dir/freesurfer/sub-01' >>> copy_mask_fs.run()in_file : a pathlike object or string representing an existing file subject_dir : a pathlike object or string representing an existing directory
out_brainmask_file : a pathlike object or string representing an existing file out_brainmaskauto_file : a pathlike object or string representing an existing file
copyFileToFreesurfer
Bases: nipype.interfaces.io.IOBase
Copy a file to an output specified.
Note
Not used.
in_file : a pathlike object or string representing an existing file out_file : a pathlike object or string representing a file
out_file : a pathlike object or string representing an existing file