interfaces.freesurfer.preprocess¶
ApplyVolTransform¶
Wraps the executable command mri_vol2vol
.
Use FreeSurfer mri_vol2vol to apply a transform.
Examples¶
>>> from nipype.interfaces.freesurfer import ApplyVolTransform
>>> applyreg = ApplyVolTransform()
>>> applyreg.inputs.source_file = 'structural.nii'
>>> applyreg.inputs.reg_file = 'register.dat'
>>> applyreg.inputs.transformed_file = 'struct_warped.nii'
>>> applyreg.inputs.fs_target = True
>>> applyreg.cmdline
'mri_vol2vol --fstarg --reg register.dat --mov structural.nii --o struct_warped.nii'
Inputs:
[Mandatory]
fsl_reg_file: (an existing file name)
fslRAS-to-fslRAS matrix (FSL format)
argument: ``--fsl %s``
mutually_exclusive: reg_file, lta_file, lta_inv_file, fsl_reg_file,
xfm_reg_file, reg_header, mni_152_reg, subject
mni_152_reg: (a boolean)
target MNI152 space
argument: ``--regheader``
mutually_exclusive: reg_file, lta_file, lta_inv_file, fsl_reg_file,
xfm_reg_file, reg_header, mni_152_reg, subject
lta_inv_file: (an existing file name)
LTA, invert
argument: ``--lta-inv %s``
mutually_exclusive: reg_file, lta_file, lta_inv_file, fsl_reg_file,
xfm_reg_file, reg_header, mni_152_reg, subject
target_file: (an existing file name)
Output template volume
argument: ``--targ %s``
mutually_exclusive: target_file, tal, fs_target
lta_file: (an existing file name)
Linear Transform Array file
argument: ``--lta %s``
mutually_exclusive: reg_file, lta_file, lta_inv_file, fsl_reg_file,
xfm_reg_file, reg_header, mni_152_reg, subject
reg_file: (an existing file name)
tkRAS-to-tkRAS matrix (tkregister2 format)
argument: ``--reg %s``
mutually_exclusive: reg_file, lta_file, lta_inv_file, fsl_reg_file,
xfm_reg_file, reg_header, mni_152_reg, subject
reg_header: (a boolean)
ScannerRAS-to-ScannerRAS matrix = identity
argument: ``--regheader``
mutually_exclusive: reg_file, lta_file, lta_inv_file, fsl_reg_file,
xfm_reg_file, reg_header, mni_152_reg, subject
source_file: (an existing file name)
Input volume you wish to transform
argument: ``--mov %s``
fs_target: (a boolean)
use orig.mgz from subject in regfile as target
argument: ``--fstarg``
mutually_exclusive: target_file, tal, fs_target
requires: reg_file
tal: (a boolean)
map to a sub FOV of MNI305 (with --reg only)
argument: ``--tal``
mutually_exclusive: target_file, tal, fs_target
xfm_reg_file: (an existing file name)
ScannerRAS-to-ScannerRAS matrix (MNI format)
argument: ``--xfm %s``
mutually_exclusive: reg_file, lta_file, lta_inv_file, fsl_reg_file,
xfm_reg_file, reg_header, mni_152_reg, subject
subject: (a unicode string)
set matrix = identity and use subject for any templates
argument: ``--s %s``
mutually_exclusive: reg_file, lta_file, lta_inv_file, fsl_reg_file,
xfm_reg_file, reg_header, mni_152_reg, subject
[Optional]
no_ded_m3z_path: (a boolean)
To be used with the m3z flag. Instructs the code not to look for
them3z morph in the default location
(SUBJECTS_DIR/subj/mri/transforms), but instead just use the path
indicated in --m3z.
argument: ``--noDefM3zPath``
requires: m3z_file
interp: (u'trilin' or u'nearest' or u'cubic')
Interpolation method (<trilin> or nearest)
argument: ``--interp %s``
no_resample: (a boolean)
Do not resample; just change vox2ras matrix
argument: ``--no-resample``
inverse: (a boolean)
sample from target to source
argument: ``--inv``
invert_morph: (a boolean)
Compute and use the inverse of the non-linear morph to resample the
input volume. To be used by --m3z.
argument: ``--inv-morph``
requires: m3z_file
m3z_file: (a file name)
This is the morph to be applied to the volume. Unless the morph is
in mri/transforms (eg.: for talairach.m3z computed by reconall), you
will need to specify the full path to this morph and use the
--noDefM3zPath flag.
argument: ``--m3z %s``
args: (a unicode string)
Additional parameters to the command
argument: ``%s``
subjects_dir: (an existing directory name)
subjects directory
transformed_file: (a file name)
Output volume
argument: ``--o %s``
environ: (a dictionary with keys which are a newbytes or None or a
newstr or None and with values which are a newbytes or None or a
newstr or None, nipype default value: {})
Environment variables
tal_resolution: (a float)
Resolution to sample when using tal
argument: ``--talres %.10f``
Outputs:
transformed_file: (an existing file name)
Path to output file if used normally
BBRegister¶
Wraps the executable command 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. It is required that you have an anatomical scan of the subject that has already been recon-all-ed using freesurfer.
Examples¶
>>> from nipype.interfaces.freesurfer import BBRegister
>>> bbreg = BBRegister(subject_id='me', source_file='structural.nii', init='header', contrast_type='t2')
>>> bbreg.cmdline
'bbregister --t2 --init-header --reg structural_bbreg_me.dat --mov structural.nii --s me'
Inputs:
[Mandatory]
contrast_type: (u't1' or u't2' or u'bold' or u'dti')
contrast type of image
argument: ``--%s``
subject_id: (a unicode string)
freesurfer subject id
argument: ``--s %s``
source_file: (a file name)
source file to be registered
argument: ``--mov %s``
[Optional]
init_reg_file: (an existing file name)
existing registration file
argument: ``--init-reg %s``
mutually_exclusive: init
reg_frame: (an integer (int or long))
0-based frame index for 4D source file
argument: ``--frame %d``
mutually_exclusive: reg_middle_frame
registered_file: (a boolean or a file name)
output warped sourcefile either True or filename
argument: ``--o %s``
out_fsl_file: (a boolean or a file name)
write the transformation matrix in FSL FLIRT format
argument: ``--fslmat %s``
spm_nifti: (a boolean)
force use of nifti rather than analyze with SPM
argument: ``--spm-nii``
args: (a unicode string)
Additional parameters to the command
argument: ``%s``
dof: (6 or 9 or 12)
number of transform degrees of freedom
argument: ``--%d``
out_lta_file: (a boolean or a file name)
write the transformation matrix in LTA format
argument: ``--lta %s``
out_reg_file: (a file name)
output registration file
argument: ``--reg %s``
intermediate_file: (an existing file name)
Intermediate image, e.g. in case of partial FOV
argument: ``--int %s``
init: (u'coreg' or u'rr' or u'spm' or u'fsl' or u'header' or u'best')
initialize registration with mri_coreg, spm, fsl, or header
argument: ``--init-%s``
mutually_exclusive: init_reg_file
reg_middle_frame: (a boolean)
Register middle frame of 4D source file
argument: ``--mid-frame``
mutually_exclusive: reg_frame
subjects_dir: (an existing directory name)
subjects directory
init_cost_file: (a boolean or a file name)
output initial registration cost file
argument: ``--initcost %s``
environ: (a dictionary with keys which are a newbytes or None or a
newstr or None and with values which are a newbytes or None or a
newstr or None, nipype default value: {})
Environment variables
fsldof: (an integer (int or long))
degrees of freedom for initial registration (FSL)
argument: ``--fsl-dof %d``
epi_mask: (a boolean)
mask out B0 regions in stages 1 and 2
argument: ``--epi-mask``
Outputs:
registered_file: (an existing file name)
Registered and resampled source file
out_fsl_file: (an existing file name)
Output FLIRT-style registration file
out_lta_file: (an existing file name)
Output LTA-style registration file
out_reg_file: (an existing file name)
Output registration file
init_cost_file: (an existing file name)
Output initial registration cost file
min_cost_file: (an existing file name)
Output registration minimum cost file
CALabel¶
Wraps the executable command mri_ca_label
.
For complete details, see the FS Documentation
Examples¶
>>> from nipype.interfaces import freesurfer
>>> ca_label = freesurfer.CALabel()
>>> ca_label.inputs.in_file = "norm.mgz"
>>> ca_label.inputs.out_file = "out.mgz"
>>> ca_label.inputs.transform = "trans.mat"
>>> ca_label.inputs.template = "Template_6.nii" # in practice use .gcs extension
>>> ca_label.cmdline
'mri_ca_label norm.mgz trans.mat Template_6.nii out.mgz'
Inputs:
[Mandatory]
in_file: (an existing file name)
Input volume for CALabel
argument: ``%s``, position: -4
out_file: (a file name)
Output file for CALabel
argument: ``%s``, position: -1
template: (an existing file name)
Input template for CALabel
argument: ``%s``, position: -2
transform: (an existing file name)
Input transform for CALabel
argument: ``%s``, position: -3
[Optional]
num_threads: (an integer (int or long))
allows for specifying more threads
no_big_ventricles: (a boolean)
No big ventricles
argument: ``-nobigventricles``
align: (a boolean)
Align CALabel
argument: ``-align``
args: (a unicode string)
Additional parameters to the command
argument: ``%s``
in_vol: (an existing file name)
set input volume
argument: ``-r %s``
prior: (a float)
Prior for CALabel
argument: ``-prior %.1f``
intensities: (an existing file name)
input label intensities file(used in longitudinal processing)
argument: ``-r %s``
label: (a file name)
Undocumented flag. Autorecon3 uses
../label/{hemisphere}.cortex.label as input file
argument: ``-l %s``
subjects_dir: (an existing directory name)
subjects directory
environ: (a dictionary with keys which are a newbytes or None or a
newstr or None and with values which are a newbytes or None or a
newstr or None, nipype default value: {})
Environment variables
relabel_unlikely: (a tuple of the form: (an integer (int or long), a
float))
Reclassify voxels at least some std devs from the mean using some
size Gaussian window
argument: ``-relabel_unlikely %d %.1f``
aseg: (a file name)
Undocumented flag. Autorecon3 uses ../mri/aseg.presurf.mgz as input
file
argument: ``-aseg %s``
Outputs:
out_file: (a file name)
Output volume from CALabel
CANormalize¶
Wraps the executable command mri_ca_normalize
.
This program creates a normalized volume using the brain volume and an input gca file.
For complete details, see the FS Documentation
Examples¶
>>> from nipype.interfaces import freesurfer
>>> ca_normalize = freesurfer.CANormalize()
>>> ca_normalize.inputs.in_file = "T1.mgz"
>>> ca_normalize.inputs.atlas = "atlas.nii.gz" # in practice use .gca atlases
>>> ca_normalize.inputs.transform = "trans.mat" # in practice use .lta transforms
>>> ca_normalize.cmdline
'mri_ca_normalize T1.mgz atlas.nii.gz trans.mat T1_norm.mgz'
Inputs:
[Mandatory]
atlas: (an existing file name)
The atlas file in gca format
argument: ``%s``, position: -3
transform: (an existing file name)
The tranform file in lta format
argument: ``%s``, position: -2
in_file: (an existing file name)
The input file for CANormalize
argument: ``%s``, position: -4
[Optional]
out_file: (a file name)
The output file for CANormalize
argument: ``%s``, position: -1
args: (a unicode string)
Additional parameters to the command
argument: ``%s``
mask: (an existing file name)
Specifies volume to use as mask
argument: ``-mask %s``
environ: (a dictionary with keys which are a newbytes or None or a
newstr or None and with values which are a newbytes or None or a
newstr or None, nipype default value: {})
Environment variables
long_file: (a file name)
undocumented flag used in longitudinal processing
argument: ``-long %s``
subjects_dir: (an existing directory name)
subjects directory
control_points: (a file name)
File name for the output control points
argument: ``-c %s``
Outputs:
out_file: (a file name)
The output file for Normalize
control_points: (a file name)
The output control points for Normalize
CARegister¶
Wraps the executable command mri_ca_register
.
Generates a multi-dimensional talairach transform from a gca file and talairach.lta file
For complete details, see the FS Documentation
Examples¶
>>> from nipype.interfaces import freesurfer
>>> ca_register = freesurfer.CARegister()
>>> ca_register.inputs.in_file = "norm.mgz"
>>> ca_register.inputs.out_file = "talairach.m3z"
>>> ca_register.cmdline
'mri_ca_register norm.mgz talairach.m3z'
Inputs:
[Mandatory]
in_file: (an existing file name)
The input volume for CARegister
argument: ``%s``, position: -3
[Optional]
A: (an integer (int or long))
undocumented flag used in longitudinal processing
argument: ``-A %d``
num_threads: (an integer (int or long))
allows for specifying more threads
l_files: (a list of items which are a file name)
undocumented flag used in longitudinal processing
argument: ``-l %s``
out_file: (a file name)
The output volume for CARegister
argument: ``%s``, position: -1
invert_and_save: (a boolean)
Invert and save the .m3z multi-dimensional talaraich transform to x,
y, and z .mgz files
argument: ``-invert-and-save``, position: -4
align: (a string)
Specifies when to perform alignment
argument: ``-align-%s``
args: (a unicode string)
Additional parameters to the command
argument: ``%s``
mask: (an existing file name)
Specifies volume to use as mask
argument: ``-mask %s``
transform: (an existing file name)
Specifies transform in lta format
argument: ``-T %s``
no_big_ventricles: (a boolean)
No big ventricles
argument: ``-nobigventricles``
levels: (an integer (int or long))
defines how many surrounding voxels will be used in interpolations,
default is 6
argument: ``-levels %d``
environ: (a dictionary with keys which are a newbytes or None or a
newstr or None and with values which are a newbytes or None or a
newstr or None, nipype default value: {})
Environment variables
template: (an existing file name)
The template file in gca format
argument: ``%s``, position: -2
subjects_dir: (an existing directory name)
subjects directory
Outputs:
out_file: (a file name)
The output file for CARegister
ConcatenateLTA¶
Wraps the executable command mri_concatenate_lta
.
Concatenates two consecutive LTA transformations into one overall transformation
Out = LTA2*LTA1
Examples¶
>>> from nipype.interfaces.freesurfer import ConcatenateLTA
>>> conc_lta = ConcatenateLTA()
>>> conc_lta.inputs.in_lta1 = 'lta1.lta'
>>> conc_lta.inputs.in_lta2 = 'lta2.lta'
>>> conc_lta.cmdline
'mri_concatenate_lta lta1.lta lta2.lta lta1_concat.lta'
You can use ‘identity.nofile’ as the filename for in_lta2, e.g.:
>>> conc_lta.inputs.in_lta2 = 'identity.nofile'
>>> conc_lta.inputs.invert_1 = True
>>> conc_lta.inputs.out_file = 'inv1.lta'
>>> conc_lta.cmdline
'mri_concatenate_lta -invert1 lta1.lta identity.nofile inv1.lta'
To create a RAS2RAS transform:
>>> conc_lta.inputs.out_type = 'RAS2RAS'
>>> conc_lta.cmdline
'mri_concatenate_lta -invert1 -out_type 1 lta1.lta identity.nofile inv1.lta'
Inputs:
[Mandatory]
in_lta1: (an existing file name)
maps some src1 to dst1
argument: ``%s``, position: -3
in_lta2: (an existing file name or u'identity.nofile')
maps dst1(src2) to dst2
argument: ``%s``, position: -2
[Optional]
invert_2: (a boolean)
invert in_lta2 before applying it
argument: ``-invert2``
out_file: (a file name)
the combined LTA maps: src1 to dst2 = LTA2*LTA1
argument: ``%s``, position: -1
invert_1: (a boolean)
invert in_lta1 before applying it
argument: ``-invert1``
args: (a unicode string)
Additional parameters to the command
argument: ``%s``
invert_out: (a boolean)
invert output LTA
argument: ``-invertout``
tal_template_file: (a file name)
if in_lta2 is talairach.xfm, specify template for talairach
argument: ``%s``, position: -4
requires: tal_source_file
tal_source_file: (a file name)
if in_lta2 is talairach.xfm, specify source for talairach
argument: ``-tal %s``, position: -5
requires: tal_template_file
subjects_dir: (an existing directory name)
subjects directory
environ: (a dictionary with keys which are a newbytes or None or a
newstr or None and with values which are a newbytes or None or a
newstr or None, nipype default value: {})
Environment variables
out_type: (u'VOX2VOX' or u'RAS2RAS')
set final LTA type
argument: ``-out_type %d``
subject: (a unicode string)
set subject in output LTA
argument: ``-subject %s``
Outputs:
out_file: (a file name)
the combined LTA maps: src1 to dst2 = LTA2*LTA1
DICOMConvert¶
Wraps the executable command mri_convert
.
use fs mri_convert to convert dicom files
Examples¶
>>> from nipype.interfaces.freesurfer import DICOMConvert
>>> cvt = DICOMConvert()
>>> cvt.inputs.dicom_dir = 'dicomdir'
>>> cvt.inputs.file_mapping = [('nifti', '*.nii'), ('info', 'dicom*.txt'), ('dti', '*dti.bv*')]
Inputs:
[Mandatory]
dicom_dir: (an existing directory name)
dicom directory from which to convert dicom files
base_output_dir: (a directory name)
directory in which subject directories are created
[Optional]
args: (a unicode string)
Additional parameters to the command
argument: ``%s``
ignore_single_slice: (a boolean)
ignore volumes containing a single slice
requires: dicom_info
subject_id: (any value)
subject identifier to insert into template
out_type: (u'cor' or u'mgh' or u'mgz' or u'minc' or u'analyze' or
u'analyze4d' or u'spm' or u'afni' or u'brik' or u'bshort' or
u'bfloat' or u'sdt' or u'outline' or u'otl' or u'gdf' or u'nifti1'
or u'nii' or u'niigz', nipype default value: niigz)
defines the type of output file produced
seq_list: (a list of items which are a unicode string)
list of pulse sequence names to be converted.
requires: dicom_info
environ: (a dictionary with keys which are a newbytes or None or a
newstr or None and with values which are a newbytes or None or a
newstr or None, nipype default value: {})
Environment variables
subjects_dir: (an existing directory name)
subjects directory
subject_dir_template: (a unicode string, nipype default value:
S.%04d)
template for subject directory name
file_mapping: (a list of items which are a tuple of the form: (a
unicode string, a unicode string))
defines the output fields of interface
dicom_info: (an existing file name)
File containing summary information from mri_parse_sdcmdir
Outputs:
None
EditWMwithAseg¶
Wraps the executable command mri_edit_wm_with_aseg
.
Edits a wm file using a segmentation
Examples¶
>>> from nipype.interfaces.freesurfer import EditWMwithAseg
>>> editwm = EditWMwithAseg()
>>> editwm.inputs.in_file = "T1.mgz"
>>> editwm.inputs.brain_file = "norm.mgz"
>>> editwm.inputs.seg_file = "aseg.mgz"
>>> editwm.inputs.out_file = "wm.asegedit.mgz"
>>> editwm.inputs.keep_in = True
>>> editwm.cmdline
'mri_edit_wm_with_aseg -keep-in T1.mgz norm.mgz aseg.mgz wm.asegedit.mgz'
Inputs:
[Mandatory]
in_file: (an existing file name)
Input white matter segmentation file
argument: ``%s``, position: -4
seg_file: (an existing file name)
Input presurf segmentation file
argument: ``%s``, position: -2
out_file: (a file name)
File to be written as output
argument: ``%s``, position: -1
brain_file: (an existing file name)
Input brain/T1 file
argument: ``%s``, position: -3
[Optional]
args: (a unicode string)
Additional parameters to the command
argument: ``%s``
keep_in: (a boolean)
Keep edits as found in input volume
argument: ``-keep-in``
subjects_dir: (an existing directory name)
subjects directory
environ: (a dictionary with keys which are a newbytes or None or a
newstr or None and with values which are a newbytes or None or a
newstr or None, nipype default value: {})
Environment variables
Outputs:
out_file: (a file name)
Output edited WM file
FitMSParams¶
Wraps the executable command mri_ms_fitparms
.
Estimate tissue paramaters from a set of FLASH images.
Examples¶
>>> from nipype.interfaces.freesurfer import FitMSParams
>>> msfit = FitMSParams()
>>> msfit.inputs.in_files = ['flash_05.mgz', 'flash_30.mgz']
>>> msfit.inputs.out_dir = 'flash_parameters'
>>> msfit.cmdline
'mri_ms_fitparms flash_05.mgz flash_30.mgz flash_parameters'
Inputs:
[Mandatory]
in_files: (a list of items which are an existing file name)
list of FLASH images (must be in mgh format)
argument: ``%s``, position: -2
[Optional]
flip_list: (a list of items which are an integer (int or long))
list of flip angles of the input files
out_dir: (a directory name)
directory to store output in
argument: ``%s``, position: -1
args: (a unicode string)
Additional parameters to the command
argument: ``%s``
environ: (a dictionary with keys which are a newbytes or None or a
newstr or None and with values which are a newbytes or None or a
newstr or None, nipype default value: {})
Environment variables
xfm_list: (a list of items which are an existing file name)
list of transform files to apply to each FLASH image
subjects_dir: (an existing directory name)
subjects directory
tr_list: (a list of items which are an integer (int or long))
list of TRs of the input files (in msec)
te_list: (a list of items which are a float)
list of TEs of the input files (in msec)
Outputs:
t2star_image: (an existing file name)
image of estimated T2* values
pd_image: (an existing file name)
image of estimated proton density values
t1_image: (an existing file name)
image of estimated T1 relaxation values
MNIBiasCorrection¶
Wraps the executable command mri_nu_correct.mni
.
Wrapper for nu_correct, a program from the Montreal Neurological Insitute (MNI) used for correcting intensity non-uniformity (ie, bias fields). You must have the MNI software installed on your system to run this. See [www.bic.mni.mcgill.ca/software/N3] for more info.
mri_nu_correct.mni uses float internally instead of uchar. It also rescales the output so that the global mean is the same as that of the input. These two changes are linked and can be turned off with –no-float
Examples¶
>>> from nipype.interfaces.freesurfer import MNIBiasCorrection
>>> correct = MNIBiasCorrection()
>>> correct.inputs.in_file = "norm.mgz"
>>> correct.inputs.iterations = 6
>>> correct.inputs.protocol_iterations = 1000
>>> correct.inputs.distance = 50
>>> correct.cmdline
'mri_nu_correct.mni --distance 50 --i norm.mgz --n 6 --o norm_output.mgz --proto-iters 1000'
References:¶
[http://freesurfer.net/fswiki/mri_nu_correct.mni] [http://www.bic.mni.mcgill.ca/software/N3] [https://github.com/BIC-MNI/N3]
Inputs:
[Mandatory]
in_file: (an existing file name)
input volume. Input can be any format accepted by mri_convert.
argument: ``--i %s``
[Optional]
distance: (an integer (int or long))
N3 -distance option
argument: ``--distance %d``
out_file: (a file name)
output volume. Output can be any format accepted by mri_convert. If
the output format is COR, then the directory must exist.
argument: ``--o %s``
protocol_iterations: (an integer (int or long))
Passes Np as argument of the -iterations flag of nu_correct. This is
different than the --n flag above. Default is not to pass nu_correct
the -iterations flag.
argument: ``--proto-iters %d``
mask: (an existing file name)
brainmask volume. Input can be any format accepted by mri_convert.
argument: ``--mask %s``
args: (a unicode string)
Additional parameters to the command
argument: ``%s``
stop: (a float)
Convergence threshold below which iteration stops (suggest 0.01 to
0.0001)
argument: ``--stop %f``
transform: (an existing file name)
tal.xfm. Use mri_make_uchar instead of conforming
argument: ``--uchar %s``
environ: (a dictionary with keys which are a newbytes or None or a
newstr or None and with values which are a newbytes or None or a
newstr or None, nipype default value: {})
Environment variables
iterations: (an integer (int or long), nipype default value: 4)
Number of iterations to run nu_correct. Default is 4. This is the
number of times that nu_correct is repeated (ie, using the output
from the previous run as the input for the next). This is different
than the -iterations option to nu_correct.
argument: ``--n %d``
subjects_dir: (an existing directory name)
subjects directory
shrink: (an integer (int or long))
Shrink parameter for finer sampling (default is 4)
argument: ``--shrink %d``
no_rescale: (a boolean)
do not rescale so that global mean of output == input global mean
argument: ``--no-rescale``
Outputs:
out_file: (an existing file name)
output volume
MRIConvert¶
Wraps the executable command mri_convert
.
use fs mri_convert to manipulate files
Note
Adds niigz as an output type option
Examples¶
>>> mc = MRIConvert()
>>> mc.inputs.in_file = 'structural.nii'
>>> mc.inputs.out_file = 'outfile.mgz'
>>> mc.inputs.out_type = 'mgz'
>>> mc.cmdline
'mri_convert --out_type mgz --input_volume structural.nii --output_volume outfile.mgz'
Inputs:
[Mandatory]
in_file: (an existing file name)
File to read/convert
argument: ``--input_volume %s``, position: -2
[Optional]
conform_min: (a boolean)
conform to smallest size
argument: ``--conform_min``
in_like: (an existing file name)
input looks like
argument: ``--in_like %s``
in_center: (a list of at most 3 items which are a float)
<R coordinate> <A coordinate> <S coordinate>
argument: ``--in_center %s``
no_translate: (a boolean)
~~~
argument: ``--no_translate``
out_i_size: (an integer (int or long))
output i size
argument: ``--out_i_size %d``
unwarp_gradient: (a boolean)
unwarp gradient nonlinearity
argument: ``--unwarp_gradient_nonlinearity``
fwhm: (a float)
smooth input volume by fwhm mm
argument: ``--fwhm %f``
drop_n: (an integer (int or long))
drop the last n frames
argument: ``--ndrop %d``
slice_bias: (a float)
apply half-cosine bias field
argument: ``--slice-bias %f``
out_center: (a tuple of the form: (a float, a float, a float))
<R coordinate> <A coordinate> <S coordinate>
argument: ``--out_center %f %f %f``
tr: (an integer (int or long))
TR in msec
argument: ``-tr %d``
template_type: (u'cor' or u'mgh' or u'mgz' or u'minc' or u'analyze'
or u'analyze4d' or u'spm' or u'afni' or u'brik' or u'bshort' or
u'bfloat' or u'sdt' or u'outline' or u'otl' or u'gdf' or u'nifti1'
or u'nii' or u'niigz' or u'ge' or u'gelx' or u'lx' or u'ximg' or
u'siemens' or u'dicom' or u'siemens_dicom')
template file type
argument: ``--template_type %s``
ti: (an integer (int or long))
TI in msec (note upper case flag)
argument: ``-ti %d``
cut_ends: (an integer (int or long))
remove ncut slices from the ends
argument: ``--cutends %d``
te: (an integer (int or long))
TE in msec
argument: ``-te %d``
in_stats: (a boolean)
display input stats
argument: ``--in_stats``
crop_center: (a tuple of the form: (an integer (int or long), an
integer (int or long), an integer (int or long)))
<x> <y> <z> crop to 256 around center (x, y, z)
argument: ``--crop %d %d %d``
parse_only: (a boolean)
parse input only
argument: ``--parse_only``
vox_size: (a tuple of the form: (a float, a float, a float))
<size_x> <size_y> <size_z> specify the size (mm) - useful for
upsampling or downsampling
argument: ``-voxsize %f %f %f``
smooth_parcellation: (a boolean)
smooth parcellation
argument: ``--smooth_parcellation``
out_datatype: (u'uchar' or u'short' or u'int' or u'float')
output data type <uchar|short|int|float>
argument: ``--out_data_type %s``
conform: (a boolean)
conform to 1mm voxel size in coronal slice direction with 256^3 or
more
argument: ``--conform``
force_ras: (a boolean)
use default when orientation info absent
argument: ``--force_ras_good``
frame: (an integer (int or long))
keep only 0-based frame number
argument: ``--frame %d``
out_i_dir: (a tuple of the form: (a float, a float, a float))
<R direction> <A direction> <S direction>
argument: ``--out_i_direction %f %f %f``
resample_type: (u'interpolate' or u'weighted' or u'nearest' or
u'sinc' or u'cubic')
<interpolate|weighted|nearest|sinc|cubic> (default is interpolate)
argument: ``--resample_type %s``
slice_crop: (a tuple of the form: (an integer (int or long), an
integer (int or long)))
s_start s_end : keep slices s_start to s_end
argument: ``--slice-crop %d %d``
conform_size: (a float)
conform to size_in_mm
argument: ``--conform_size %s``
out_k_size: (an integer (int or long))
output k size
argument: ``--out_k_size %d``
zero_outlines: (a boolean)
zero outlines
argument: ``--zero_outlines``
sdcm_list: (an existing file name)
list of DICOM files for conversion
argument: ``--sdcmlist %s``
color_file: (an existing file name)
color file
argument: ``--color_file %s``
out_orientation: (u'LAI' or u'LIA' or u'ALI' or u'AIL' or u'ILA' or
u'IAL' or u'LAS' or u'LSA' or u'ALS' or u'ASL' or u'SLA' or u'SAL'
or u'LPI' or u'LIP' or u'PLI' or u'PIL' or u'ILP' or u'IPL' or
u'LPS' or u'LSP' or u'PLS' or u'PSL' or u'SLP' or u'SPL' or u'RAI'
or u'RIA' or u'ARI' or u'AIR' or u'IRA' or u'IAR' or u'RAS' or
u'RSA' or u'ARS' or u'ASR' or u'SRA' or u'SAR' or u'RPI' or u'RIP'
or u'PRI' or u'PIR' or u'IRP' or u'IPR' or u'RPS' or u'RSP' or
u'PRS' or u'PSR' or u'SRP' or u'SPR')
specify the output orientation
argument: ``--out_orientation %s``
fill_parcellation: (a boolean)
fill parcellation
argument: ``--fill_parcellation``
args: (a unicode string)
Additional parameters to the command
argument: ``%s``
subject_name: (a unicode string)
subject name ???
argument: ``--subject_name %s``
out_matrix: (a boolean)
display output matrix
argument: ``--out_matrix``
cw256: (a boolean)
confrom to dimensions of 256^3
argument: ``--cw256``
devolve_transform: (a unicode string)
subject id
argument: ``--devolvexfm %s``
invert_contrast: (a float)
threshold for inversting contrast
argument: ``--invert_contrast %f``
apply_inv_transform: (an existing file name)
apply inverse transformation xfm file
argument: ``--apply_inverse_transform %s``
out_info: (a boolean)
display output info
argument: ``--out_info``
autoalign_matrix: (an existing file name)
text file with autoalign matrix
argument: ``--autoalign %s``
no_change: (a boolean)
don't change type of input to that of template
argument: ``--nochange``
out_j_count: (an integer (int or long))
some count ?? in j direction
argument: ``--out_j_count %d``
apply_transform: (an existing file name)
apply xfm file
argument: ``--apply_transform %s``
in_info: (a boolean)
display input info
argument: ``--in_info``
no_scale: (a boolean)
dont rescale values for COR
argument: ``--no_scale 1``
zero_ge_z_offset: (a boolean)
zero ge z offset ???
argument: ``--zero_ge_z_offset``
slice_reverse: (a boolean)
reverse order of slices, update vox2ras
argument: ``--slice-reverse``
out_k_dir: (a tuple of the form: (a float, a float, a float))
<R direction> <A direction> <S direction>
argument: ``--out_k_direction %f %f %f``
reorder: (a tuple of the form: (an integer (int or long), an integer
(int or long), an integer (int or long)))
olddim1 olddim2 olddim3
argument: ``--reorder %d %d %d``
midframe: (a boolean)
keep only the middle frame
argument: ``--mid-frame``
out_type: (u'cor' or u'mgh' or u'mgz' or u'minc' or u'analyze' or
u'analyze4d' or u'spm' or u'afni' or u'brik' or u'bshort' or
u'bfloat' or u'sdt' or u'outline' or u'otl' or u'gdf' or u'nifti1'
or u'nii' or u'niigz')
output file type
argument: ``--out_type %s``
in_scale: (a float)
input intensity scale factor
argument: ``--scale %f``
subjects_dir: (an existing directory name)
subjects directory
out_j_dir: (a tuple of the form: (a float, a float, a float))
<R direction> <A direction> <S direction>
argument: ``--out_j_direction %f %f %f``
reslice_like: (an existing file name)
reslice output to match file
argument: ``--reslice_like %s``
out_file: (a file name)
output filename or True to generate one
argument: ``--output_volume %s``, position: -1
in_k_size: (an integer (int or long))
input k size
argument: ``--in_k_size %d``
in_orientation: (u'LAI' or u'LIA' or u'ALI' or u'AIL' or u'ILA' or
u'IAL' or u'LAS' or u'LSA' or u'ALS' or u'ASL' or u'SLA' or u'SAL'
or u'LPI' or u'LIP' or u'PLI' or u'PIL' or u'ILP' or u'IPL' or
u'LPS' or u'LSP' or u'PLS' or u'PSL' or u'SLP' or u'SPL' or u'RAI'
or u'RIA' or u'ARI' or u'AIR' or u'IRA' or u'IAR' or u'RAS' or
u'RSA' or u'ARS' or u'ASR' or u'SRA' or u'SAR' or u'RPI' or u'RIP'
or u'PRI' or u'PIR' or u'IRP' or u'IPR' or u'RPS' or u'RSP' or
u'PRS' or u'PSR' or u'SRP' or u'SPR')
specify the input orientation
argument: ``--in_orientation %s``
out_scale: (a float)
output intensity scale factor
argument: ``--out-scale %d``
ascii: (a boolean)
save output as ascii col>row>slice>frame
argument: ``--ascii``
crop_size: (a tuple of the form: (an integer (int or long), an
integer (int or long), an integer (int or long)))
<dx> <dy> <dz> crop to size <dx, dy, dz>
argument: ``--cropsize %d %d %d``
read_only: (a boolean)
read the input volume
argument: ``--read_only``
in_j_dir: (a tuple of the form: (a float, a float, a float))
<R direction> <A direction> <S direction>
argument: ``--in_j_direction %f %f %f``
split: (a boolean)
split output frames into separate output files.
argument: ``--split``
crop_gdf: (a boolean)
apply GDF cropping
argument: ``--crop_gdf``
in_j_size: (an integer (int or long))
input j size
argument: ``--in_j_size %d``
skip_n: (an integer (int or long))
skip the first n frames
argument: ``--nskip %d``
in_i_dir: (a tuple of the form: (a float, a float, a float))
<R direction> <A direction> <S direction>
argument: ``--in_i_direction %f %f %f``
in_matrix: (a boolean)
display input matrix
argument: ``--in_matrix``
out_k_count: (an integer (int or long))
some count ?? in k direction
argument: ``--out_k_count %d``
template_info: (a boolean)
dump info about template
argument: ``--template_info``
frame_subsample: (a tuple of the form: (an integer (int or long), an
integer (int or long), an integer (int or long)))
start delta end : frame subsampling (end = -1 for end)
argument: ``--fsubsample %d %d %d``
status_file: (a file name)
status file for DICOM conversion
argument: ``--status %s``
in_type: (u'cor' or u'mgh' or u'mgz' or u'minc' or u'analyze' or
u'analyze4d' or u'spm' or u'afni' or u'brik' or u'bshort' or
u'bfloat' or u'sdt' or u'outline' or u'otl' or u'gdf' or u'nifti1'
or u'nii' or u'niigz' or u'ge' or u'gelx' or u'lx' or u'ximg' or
u'siemens' or u'dicom' or u'siemens_dicom')
input file type
argument: ``--in_type %s``
in_k_dir: (a tuple of the form: (a float, a float, a float))
<R direction> <A direction> <S direction>
argument: ``--in_k_direction %f %f %f``
sphinx: (a boolean)
change orientation info to sphinx
argument: ``--sphinx``
out_j_size: (an integer (int or long))
output j size
argument: ``--out_j_size %d``
no_write: (a boolean)
do not write output
argument: ``--no_write``
environ: (a dictionary with keys which are a newbytes or None or a
newstr or None and with values which are a newbytes or None or a
newstr or None, nipype default value: {})
Environment variables
out_i_count: (an integer (int or long))
some count ?? in i direction
argument: ``--out_i_count %d``
out_stats: (a boolean)
display output stats
argument: ``--out_stats``
in_i_size: (an integer (int or long))
input i size
argument: ``--in_i_size %d``
Outputs:
out_file: (a list of items which are an existing file name)
converted output file
MRIsCALabel¶
Wraps the executable command mris_ca_label
.
For a single subject, produces an annotation file, in which each cortical surface vertex is assigned a neuroanatomical label.This automatic procedure employs data from a previously-prepared atlas file. An atlas file is created from a training set, capturing region data manually drawn by neuroanatomists combined with statistics on variability correlated to geometric information derived from the cortical model (sulcus and curvature). Besides the atlases provided with FreeSurfer, new ones can be prepared using mris_ca_train).
Examples¶
>>> from nipype.interfaces import freesurfer
>>> ca_label = freesurfer.MRIsCALabel()
>>> ca_label.inputs.subject_id = "test"
>>> ca_label.inputs.hemisphere = "lh"
>>> ca_label.inputs.canonsurf = "lh.pial"
>>> ca_label.inputs.curv = "lh.pial"
>>> ca_label.inputs.sulc = "lh.pial"
>>> ca_label.inputs.classifier = "im1.nii" # in pracice, use .gcs extension
>>> ca_label.inputs.smoothwm = "lh.pial"
>>> ca_label.cmdline
'mris_ca_label test lh lh.pial im1.nii lh.aparc.annot'
Inputs:
[Mandatory]
curv: (an existing file name)
implicit input {hemisphere}.curv
subject_id: (a string, nipype default value: subject_id)
Subject name or ID
argument: ``%s``, position: -5
canonsurf: (an existing file name)
Input canonical surface file
argument: ``%s``, position: -3
hemisphere: (u'lh' or u'rh')
Hemisphere ('lh' or 'rh')
argument: ``%s``, position: -4
classifier: (an existing file name)
Classifier array input file
argument: ``%s``, position: -2
smoothwm: (an existing file name)
implicit input {hemisphere}.smoothwm
sulc: (an existing file name)
implicit input {hemisphere}.sulc
[Optional]
num_threads: (an integer (int or long))
allows for specifying more threads
out_file: (a file name)
Annotated surface output file
argument: ``%s``, position: -1
args: (a unicode string)
Additional parameters to the command
argument: ``%s``
copy_inputs: (a boolean)
Copies implicit inputs to node directory and creates a temp
subjects_directory. Use this when running as a node
label: (a file name)
Undocumented flag. Autorecon3 uses
../label/{hemisphere}.cortex.label as input file
argument: ``-l %s``
seed: (an integer (int or long))
argument: ``-seed %d``
environ: (a dictionary with keys which are a newbytes or None or a
newstr or None and with values which are a newbytes or None or a
newstr or None, nipype default value: {})
Environment variables
subjects_dir: (an existing directory name)
subjects directory
aseg: (a file name)
Undocumented flag. Autorecon3 uses ../mri/aseg.presurf.mgz as input
file
argument: ``-aseg %s``
Outputs:
out_file: (a file name)
Output volume from MRIsCALabel
Normalize¶
Wraps the executable command mri_normalize
.
Normalize the white-matter, optionally based on control points. The input volume is converted into a new volume where white matter image values all range around 110.
Examples¶
>>> from nipype.interfaces import freesurfer
>>> normalize = freesurfer.Normalize()
>>> normalize.inputs.in_file = "T1.mgz"
>>> normalize.inputs.gradient = 1
>>> normalize.cmdline
'mri_normalize -g 1 T1.mgz T1_norm.mgz'
Inputs:
[Mandatory]
in_file: (an existing file name)
The input file for Normalize
argument: ``%s``, position: -2
[Optional]
segmentation: (an existing file name)
The input segmentation for Normalize
argument: ``-aseg %s``
out_file: (a file name)
The output file for Normalize
argument: ``%s``, position: -1
gradient: (an integer (int or long))
use max intensity/mm gradient g (default=1)
argument: ``-g %d``
args: (a unicode string)
Additional parameters to the command
argument: ``%s``
mask: (an existing file name)
The input mask file for Normalize
argument: ``-mask %s``
transform: (an existing file name)
Tranform file from the header of the input file
environ: (a dictionary with keys which are a newbytes or None or a
newstr or None and with values which are a newbytes or None or a
newstr or None, nipype default value: {})
Environment variables
subjects_dir: (an existing directory name)
subjects directory
Outputs:
out_file: (a file name)
The output file for Normalize
ParseDICOMDir¶
Wraps the executable command mri_parse_sdcmdir
.
Uses mri_parse_sdcmdir to get information from dicom directories
Examples¶
>>> from nipype.interfaces.freesurfer import ParseDICOMDir
>>> dcminfo = ParseDICOMDir()
>>> dcminfo.inputs.dicom_dir = '.'
>>> dcminfo.inputs.sortbyrun = True
>>> dcminfo.inputs.summarize = True
>>> dcminfo.cmdline
'mri_parse_sdcmdir --d . --o dicominfo.txt --sortbyrun --summarize'
Inputs:
[Mandatory]
dicom_dir: (an existing directory name)
path to siemens dicom directory
argument: ``--d %s``
[Optional]
args: (a unicode string)
Additional parameters to the command
argument: ``%s``
dicom_info_file: (a file name, nipype default value: dicominfo.txt)
file to which results are written
argument: ``--o %s``
environ: (a dictionary with keys which are a newbytes or None or a
newstr or None and with values which are a newbytes or None or a
newstr or None, nipype default value: {})
Environment variables
subjects_dir: (an existing directory name)
subjects directory
summarize: (a boolean)
only print out info for run leaders
argument: ``--summarize``
sortbyrun: (a boolean)
assign run numbers
argument: ``--sortbyrun``
Outputs:
dicom_info_file: (an existing file name)
text file containing dicom information
ReconAll¶
Wraps the executable command recon-all
.
Uses recon-all to generate surfaces and parcellations of structural data from anatomical images of a subject.
Examples¶
>>> from nipype.interfaces.freesurfer import ReconAll
>>> reconall = ReconAll()
>>> reconall.inputs.subject_id = 'foo'
>>> reconall.inputs.directive = 'all'
>>> reconall.inputs.subjects_dir = '.'
>>> reconall.inputs.T1_files = 'structural.nii'
>>> reconall.cmdline
'recon-all -all -i structural.nii -subjid foo -sd .'
>>> reconall.inputs.flags = "-qcache"
>>> reconall.cmdline
'recon-all -all -i structural.nii -qcache -subjid foo -sd .'
>>> reconall.inputs.flags = ["-cw256", "-qcache"]
>>> reconall.cmdline
'recon-all -all -i structural.nii -cw256 -qcache -subjid foo -sd .'
Hemisphere may be specified regardless of directive:
>>> reconall.inputs.flags = []
>>> reconall.inputs.hemi = 'lh'
>>> reconall.cmdline
'recon-all -all -i structural.nii -hemi lh -subjid foo -sd .'
-autorecon-hemi
uses the -hemi
input to specify the hemisphere
to operate upon:
>>> reconall.inputs.directive = 'autorecon-hemi'
>>> reconall.cmdline
'recon-all -autorecon-hemi lh -i structural.nii -subjid foo -sd .'
Hippocampal subfields can accept T1 and T2 images:
>>> reconall_subfields = ReconAll()
>>> reconall_subfields.inputs.subject_id = 'foo'
>>> reconall_subfields.inputs.directive = 'all'
>>> reconall_subfields.inputs.subjects_dir = '.'
>>> reconall_subfields.inputs.T1_files = 'structural.nii'
>>> reconall_subfields.inputs.hippocampal_subfields_T1 = True
>>> reconall_subfields.cmdline
'recon-all -all -i structural.nii -hippocampal-subfields-T1 -subjid foo -sd .'
>>> reconall_subfields.inputs.hippocampal_subfields_T2 = (
... 'structural.nii', 'test')
>>> reconall_subfields.cmdline
'recon-all -all -i structural.nii -hippocampal-subfields-T1T2 structural.nii test -subjid foo -sd .'
>>> reconall_subfields.inputs.hippocampal_subfields_T1 = False
>>> reconall_subfields.cmdline
'recon-all -all -i structural.nii -hippocampal-subfields-T2 structural.nii test -subjid foo -sd .'
Inputs:
[Optional]
mprage: (a boolean)
Assume scan parameters are MGH MP-RAGE protocol, which produces
darker gray matter
argument: ``-mprage``
mri_segstats: (a unicode string)
Flags to pass to mri_segstats commands
mutually_exclusive: expert
mri_remove_neck: (a unicode string)
Flags to pass to mri_remove_neck commands
mutually_exclusive: expert
mris_register: (a unicode string)
Flags to pass to mris_register commands
mutually_exclusive: expert
mri_ca_register: (a unicode string)
Flags to pass to mri_ca_register commands
mutually_exclusive: expert
mri_aparc2aseg: (a unicode string)
Flags to pass to mri_aparc2aseg commands
mutually_exclusive: expert
openmp: (an integer (int or long))
Number of processors to use in parallel
argument: ``-openmp %d``
mri_watershed: (a unicode string)
Flags to pass to mri_watershed commands
mutually_exclusive: expert
FLAIR_file: (an existing file name)
Convert FLAIR image to orig directory
argument: ``-FLAIR %s``
expert: (an existing file name)
Set parameters using expert file
argument: ``-expert %s``
xopts: (u'use' or u'clean' or u'overwrite')
Use, delete or overwrite existing expert options file
argument: ``-xopts-%s``
mris_anatomical_stats: (a unicode string)
Flags to pass to mris_anatomical_stats commands
mutually_exclusive: expert
hippocampal_subfields_T2: (a tuple of the form: (an existing file
name, a unicode string))
segment hippocampal subfields using T2 scan, identified by ID (may
be combined with hippocampal_subfields_T1)
argument: ``-hippocampal-subfields-T2 %s %s``
subject_id: (a unicode string, nipype default value: recon_all)
subject name
argument: ``-subjid %s``
mris_surf2vol: (a unicode string)
Flags to pass to mris_surf2vol commands
mutually_exclusive: expert
mri_ca_label: (a unicode string)
Flags to pass to mri_ca_label commands
mutually_exclusive: expert
mri_edit_wm_with_aseg: (a unicode string)
Flags to pass to mri_edit_wm_with_aseg commands
mutually_exclusive: expert
mri_segment: (a unicode string)
Flags to pass to mri_segment commands
mutually_exclusive: expert
mri_tessellate: (a unicode string)
Flags to pass to mri_tessellate commands
mutually_exclusive: expert
talairach: (a unicode string)
Flags to pass to talairach commands
mutually_exclusive: expert
environ: (a dictionary with keys which are a newbytes or None or a
newstr or None and with values which are a newbytes or None or a
newstr or None, nipype default value: {})
Environment variables
mri_em_register: (a unicode string)
Flags to pass to mri_em_register commands
mutually_exclusive: expert
hemi: (u'lh' or u'rh')
hemisphere to process
argument: ``-hemi %s``
hires: (a boolean)
Conform to minimum voxel size (for voxels < 1mm)
argument: ``-hires``
mris_ca_label: (a unicode string)
Flags to pass to mris_ca_label commands
mutually_exclusive: expert
T1_files: (a list of items which are an existing file name)
name of T1 file to process
argument: ``-i %s...``
mri_normalize: (a unicode string)
Flags to pass to mri_normalize commands
mutually_exclusive: expert
args: (a unicode string)
Additional parameters to the command
argument: ``%s``
mris_fix_topology: (a unicode string)
Flags to pass to mris_fix_topology commands
mutually_exclusive: expert
mri_ca_normalize: (a unicode string)
Flags to pass to mri_ca_normalize commands
mutually_exclusive: expert
use_T2: (a boolean)
Use T2 image to refine the pial surface
argument: ``-T2pial``
mutually_exclusive: use_FLAIR
subjects_dir: (an existing directory name)
path to subjects directory
argument: ``-sd %s``
mris_sphere: (a unicode string)
Flags to pass to mris_sphere commands
mutually_exclusive: expert
mri_mask: (a unicode string)
Flags to pass to mri_mask commands
mutually_exclusive: expert
mri_fill: (a unicode string)
Flags to pass to mri_fill commands
mutually_exclusive: expert
mris_make_surfaces: (a unicode string)
Flags to pass to mris_make_surfaces commands
mutually_exclusive: expert
T2_file: (an existing file name)
Convert T2 image to orig directory
argument: ``-T2 %s``
mris_smooth: (a unicode string)
Flags to pass to mri_smooth commands
mutually_exclusive: expert
mris_inflate: (a unicode string)
Flags to pass to mri_inflate commands
mutually_exclusive: expert
mri_pretess: (a unicode string)
Flags to pass to mri_pretess commands
mutually_exclusive: expert
mrisp_paint: (a unicode string)
Flags to pass to mrisp_paint commands
mutually_exclusive: expert
big_ventricles: (a boolean)
For use in subjects with enlarged ventricles
argument: ``-bigventricles``
directive: (u'all' or u'autorecon1' or u'autorecon2' or
u'autorecon2-volonly' or u'autorecon2-perhemi' or
u'autorecon2-inflate1' or u'autorecon2-cp' or u'autorecon2-wm' or
u'autorecon3' or u'autorecon3-T2pial' or u'autorecon-pial' or u
'autorecon-hemi' or u'localGI' or u'qcache', nipype default value:
all)
process directive
argument: ``-%s``, position: 0
brainstem: (a boolean)
Segment brainstem structures
argument: ``-brainstem-structures``
flags: (a list of items which are a unicode string)
additional parameters
argument: ``%s``
use_FLAIR: (a boolean)
Use FLAIR image to refine the pial surface
argument: ``-FLAIRpial``
mutually_exclusive: use_T2
parallel: (a boolean)
Enable parallel execution
argument: ``-parallel``
hippocampal_subfields_T1: (a boolean)
segment hippocampal subfields using input T1 scan
argument: ``-hippocampal-subfields-T1``
Outputs:
curv: (a list of items which are an existing file name)
Maps of surface curvature
curv_pial: (a list of items which are an existing file name)
Curvature of pial surface
curv_stats: (a list of items which are an existing file name)
Curvature statistics files
avg_curv: (a list of items which are an existing file name)
Average atlas curvature, sampled to subject
annot: (a list of items which are an existing file name)
Surface annotation files
sphere: (a list of items which are an existing file name)
Spherical surface meshes
aseg_stats: (a list of items which are an existing file name)
Automated segmentation statistics file
inflated: (a list of items which are an existing file name)
Inflated surface meshes
BA_stats: (a list of items which are an existing file name)
Brodmann Area statistics files
sphere_reg: (a list of items which are an existing file name)
Spherical registration file
orig: (an existing file name)
Base image conformed to Freesurfer space
aparc_a2009s_stats: (a list of items which are an existing file name)
Aparc a2009s parcellation statistics files
subject_id: (a unicode string)
Subject name for whom to retrieve data
brainmask: (an existing file name)
Skull-stripped (brain-only) volume
thickness: (a list of items which are an existing file name)
Surface maps of cortical thickness
ribbon: (a list of items which are an existing file name)
Volumetric maps of cortical ribbons
rawavg: (an existing file name)
Volume formed by averaging input images
white: (a list of items which are an existing file name)
White/gray matter surface meshes
sulc: (a list of items which are an existing file name)
Surface maps of sulcal depth
nu: (an existing file name)
Non-uniformity corrected whole-head volume
norm: (an existing file name)
Normalized skull-stripped volume
jacobian_white: (a list of items which are an existing file name)
Distortion required to register to spherical atlas
wm: (an existing file name)
Segmented white-matter volume
wmparc: (an existing file name)
Aparc parcellation projected into subcortical white matter
T1: (an existing file name)
Intensity normalized whole-head volume
volume: (a list of items which are an existing file name)
Surface maps of cortical volume
area_pial: (a list of items which are an existing file name)
Mean area of triangles each vertex on the pial surface is associated
with
entorhinal_exvivo_stats: (a list of items which are an existing file
name)
Entorhinal exvivo statistics files
subjects_dir: (an existing directory name)
Freesurfer subjects directory.
aseg: (an existing file name)
Volumetric map of regions from automatic segmentation
aparc_stats: (a list of items which are an existing file name)
Aparc parcellation statistics files
brain: (an existing file name)
Intensity normalized brain-only volume
label: (a list of items which are an existing file name)
Volume and surface label files
graymid: (a list of items which are an existing file name)
Graymid/midthickness surface meshes
filled: (an existing file name)
Subcortical mass volume
pial: (a list of items which are an existing file name)
Gray matter/pia mater surface meshes
wmparc_stats: (a list of items which are an existing file name)
White matter parcellation statistics file
aparc_aseg: (a list of items which are an existing file name)
Aparc parcellation projected into aseg volume
smoothwm: (a list of items which are an existing file name)
Smoothed original surface meshes
Resample¶
Wraps the executable command mri_convert
.
Use FreeSurfer mri_convert to up or down-sample image files
Examples¶
>>> from nipype.interfaces import freesurfer
>>> resampler = freesurfer.Resample()
>>> resampler.inputs.in_file = 'structural.nii'
>>> resampler.inputs.resampled_file = 'resampled.nii'
>>> resampler.inputs.voxel_size = (2.1, 2.1, 2.1)
>>> resampler.cmdline
'mri_convert -vs 2.10 2.10 2.10 -i structural.nii -o resampled.nii'
Inputs:
[Mandatory]
voxel_size: (a tuple of the form: (a float, a float, a float))
triplet of output voxel sizes
argument: ``-vs %.2f %.2f %.2f``
in_file: (an existing file name)
file to resample
argument: ``-i %s``, position: -2
[Optional]
resampled_file: (a file name)
output filename
argument: ``-o %s``, position: -1
args: (a unicode string)
Additional parameters to the command
argument: ``%s``
environ: (a dictionary with keys which are a newbytes or None or a
newstr or None and with values which are a newbytes or None or a
newstr or None, nipype default value: {})
Environment variables
subjects_dir: (an existing directory name)
subjects directory
Outputs:
resampled_file: (an existing file name)
output filename
RobustRegister¶
Wraps the executable command mri_robust_register
.
Perform intramodal linear registration (translation and rotation) using robust statistics.
Examples¶
>>> from nipype.interfaces.freesurfer import RobustRegister
>>> reg = RobustRegister()
>>> reg.inputs.source_file = 'structural.nii'
>>> reg.inputs.target_file = 'T1.nii'
>>> reg.inputs.auto_sens = True
>>> reg.inputs.init_orient = True
>>> reg.cmdline # doctest: +ELLIPSIS
'mri_robust_register --satit --initorient --lta .../structural_robustreg.lta --mov structural.nii --dst T1.nii'
References¶
- Reuter, M, Rosas, HD, and Fischl, B, (2010). Highly Accurate Inverse
- Consistent Registration: A Robust Approach. Neuroimage 53(4) 1181-96.
Inputs:
[Mandatory]
source_file: (an existing file name)
volume to be registered
argument: ``--mov %s``
auto_sens: (a boolean)
auto-detect good sensitivity
argument: ``--satit``
mutually_exclusive: outlier_sens
outlier_sens: (a float)
set outlier sensitivity explicitly
argument: ``--sat %.4f``
mutually_exclusive: auto_sens
target_file: (an existing file name)
target volume for the registration
argument: ``--dst %s``
[Optional]
no_init: (a boolean)
skip transform init
argument: ``--noinit``
init_orient: (a boolean)
use moments for initial orient (recommended for stripped brains)
argument: ``--initorient``
outlier_limit: (a float)
set maximal outlier limit in satit
argument: ``--wlimit %.3f``
force_float: (a boolean)
use float intensities
argument: ``--floattype``
half_targ: (a boolean or a file name)
write target volume mapped to halfway space
argument: ``--halfdst %s``
max_iterations: (an integer (int or long))
maximum # of times on each resolution
argument: ``--maxit %d``
write_vo2vox: (a boolean)
output vox2vox matrix (default is RAS2RAS)
argument: ``--vox2vox``
high_iterations: (an integer (int or long))
max # of times on highest resolution
argument: ``--highit %d``
half_source: (a boolean or a file name)
write source volume mapped to halfway space
argument: ``--halfmov %s``
force_double: (a boolean)
use double-precision intensities
argument: ``--doubleprec``
out_reg_file: (a bool or None or a file name, nipype default value:
True)
registration file; either True or filename
argument: ``--lta %s``
half_source_xfm: (a boolean or a file name)
write transform from source to halfway space
argument: ``--halfmovlta %s``
subsample_thresh: (an integer (int or long))
subsample if dimension is above threshold size
argument: ``--subsample %d``
no_multi: (a boolean)
work on highest resolution
argument: ``--nomulti``
trans_only: (a boolean)
find 3 parameter translation only
argument: ``--transonly``
in_xfm_file: (an existing file name)
use initial transform on source
argument: ``--transform``
registered_file: (a boolean or a file name)
registered image; either True or filename
argument: ``--warp %s``
least_squares: (a boolean)
use least squares instead of robust estimator
argument: ``--leastsquares``
args: (a unicode string)
Additional parameters to the command
argument: ``%s``
mask_source: (an existing file name)
image to mask source volume with
argument: ``--maskmov %s``
subjects_dir: (an existing directory name)
subjects directory
mask_target: (an existing file name)
image to mask target volume with
argument: ``--maskdst %s``
half_weights: (a boolean or a file name)
write weights volume mapped to halfway space
argument: ``--halfweights %s``
est_int_scale: (a boolean)
estimate intensity scale (recommended for unnormalized images)
argument: ``--iscale``
weights_file: (a boolean or a file name)
weights image to write; either True or filename
argument: ``--weights %s``
half_targ_xfm: (a boolean or a file name)
write transform from target to halfway space
argument: ``--halfdstlta %s``
iteration_thresh: (a float)
stop iterations when below threshold
argument: ``--epsit %.3f``
environ: (a dictionary with keys which are a newbytes or None or a
newstr or None and with values which are a newbytes or None or a
newstr or None, nipype default value: {})
Environment variables
Outputs:
out_reg_file: (an existing file name)
output registration file
half_weights: (an existing file name)
weights image mapped to halfway space
registered_file: (an existing file name)
output image with registration applied
half_source: (an existing file name)
source image mapped to halfway space
half_targ: (an existing file name)
target image mapped to halfway space
weights_file: (an existing file name)
image of weights used
half_targ_xfm: (an existing file name)
transform file to map target image to halfway space
half_source_xfm: (an existing file name)
transform file to map source image to halfway space
SegmentCC¶
Wraps the executable command mri_cc
.
This program segments the corpus callosum into five separate labels in the subcortical segmentation volume ‘aseg.mgz’. The divisions of the cc are equally spaced in terms of distance along the primary eigendirection (pretty much the long axis) of the cc. The lateral extent can be changed with the -T <thickness> parameter, where <thickness> is the distance off the midline (so -T 1 would result in the who CC being 3mm thick). The default is 2 so it’s 5mm thick. The aseg.stats values should be volume.
Examples¶
>>> from nipype.interfaces import freesurfer
>>> SegmentCC_node = freesurfer.SegmentCC()
>>> SegmentCC_node.inputs.in_file = "aseg.mgz"
>>> SegmentCC_node.inputs.in_norm = "norm.mgz"
>>> SegmentCC_node.inputs.out_rotation = "cc.lta"
>>> SegmentCC_node.inputs.subject_id = "test"
>>> SegmentCC_node.cmdline
'mri_cc -aseg aseg.mgz -o aseg.auto.mgz -lta cc.lta test'
Inputs:
[Mandatory]
in_norm: (an existing file name)
Required undocumented input {subject}/mri/norm.mgz
subject_id: (a string, nipype default value: subject_id)
Subject name
argument: ``%s``, position: -1
out_rotation: (a file name)
Global filepath for writing rotation lta
argument: ``-lta %s``
in_file: (an existing file name)
Input aseg file to read from subjects directory
argument: ``-aseg %s``
[Optional]
out_file: (a file name)
Filename to write aseg including CC
argument: ``-o %s``
args: (a unicode string)
Additional parameters to the command
argument: ``%s``
copy_inputs: (a boolean)
If running as a node, set this to True.This will copy the input
files to the node directory.
environ: (a dictionary with keys which are a newbytes or None or a
newstr or None and with values which are a newbytes or None or a
newstr or None, nipype default value: {})
Environment variables
subjects_dir: (an existing directory name)
subjects directory
Outputs:
out_file: (a file name)
Output segmentation uncluding corpus collosum
out_rotation: (a file name)
Output lta rotation file
SegmentWM¶
Wraps the executable command mri_segment
.
This program segments white matter from the input volume. The input volume should be normalized such that white matter voxels are ~110-valued, and the volume is conformed to 256^3.
Examples¶
>>> from nipype.interfaces import freesurfer
>>> SegmentWM_node = freesurfer.SegmentWM()
>>> SegmentWM_node.inputs.in_file = "norm.mgz"
>>> SegmentWM_node.inputs.out_file = "wm.seg.mgz"
>>> SegmentWM_node.cmdline
'mri_segment norm.mgz wm.seg.mgz'
Inputs:
[Mandatory]
out_file: (a file name)
File to be written as output for SegmentWM
argument: ``%s``, position: -1
in_file: (an existing file name)
Input file for SegmentWM
argument: ``%s``, position: -2
[Optional]
args: (a unicode string)
Additional parameters to the command
argument: ``%s``
environ: (a dictionary with keys which are a newbytes or None or a
newstr or None and with values which are a newbytes or None or a
newstr or None, nipype default value: {})
Environment variables
subjects_dir: (an existing directory name)
subjects directory
Outputs:
out_file: (a file name)
Output white matter segmentation
Smooth¶
Wraps the executable command mris_volsmooth
.
Use FreeSurfer mris_volsmooth to smooth a volume
This function smoothes cortical regions on a surface and non-cortical regions in volume.
Note
Cortical voxels are mapped to the surface (3D->2D) and then the smoothed values from the surface are put back into the volume to fill the cortical ribbon. If data is smoothed with this algorithm, one has to be careful about how further processing is interpreted.
Examples¶
>>> from nipype.interfaces.freesurfer import Smooth
>>> smoothvol = Smooth(in_file='functional.nii', smoothed_file = 'foo_out.nii', reg_file='register.dat', surface_fwhm=10, vol_fwhm=6)
>>> smoothvol.cmdline
'mris_volsmooth --i functional.nii --reg register.dat --o foo_out.nii --fwhm 10.000000 --vol-fwhm 6.000000'
Inputs:
[Mandatory]
surface_fwhm: (a floating point number >= 0.0)
surface FWHM in mm
argument: ``--fwhm %f``
mutually_exclusive: num_iters
requires: reg_file
reg_file: (an existing file name)
registers volume to surface anatomical
argument: ``--reg %s``
num_iters: (an integer >= 1)
number of iterations instead of fwhm
argument: ``--niters %d``
mutually_exclusive: surface_fwhm
in_file: (an existing file name)
source volume
argument: ``--i %s``
[Optional]
proj_frac_avg: (a tuple of the form: (a float, a float, a float))
average a long normal min max delta
argument: ``--projfrac-avg %.2f %.2f %.2f``
mutually_exclusive: proj_frac
vol_fwhm: (a floating point number >= 0.0)
volume smoothing outside of surface
argument: ``--vol-fwhm %f``
args: (a unicode string)
Additional parameters to the command
argument: ``%s``
environ: (a dictionary with keys which are a newbytes or None or a
newstr or None and with values which are a newbytes or None or a
newstr or None, nipype default value: {})
Environment variables
subjects_dir: (an existing directory name)
subjects directory
proj_frac: (a float)
project frac of thickness a long surface normal
argument: ``--projfrac %s``
mutually_exclusive: proj_frac_avg
smoothed_file: (a file name)
output volume
argument: ``--o %s``
Outputs:
smoothed_file: (an existing file name)
smoothed input volume
SynthesizeFLASH¶
Wraps the executable command mri_synthesize
.
Synthesize a FLASH acquisition from T1 and proton density maps.
Examples¶
>>> from nipype.interfaces.freesurfer import SynthesizeFLASH
>>> syn = SynthesizeFLASH(tr=20, te=3, flip_angle=30)
>>> syn.inputs.t1_image = 'T1.mgz'
>>> syn.inputs.pd_image = 'PD.mgz'
>>> syn.inputs.out_file = 'flash_30syn.mgz'
>>> syn.cmdline
'mri_synthesize 20.00 30.00 3.000 T1.mgz PD.mgz flash_30syn.mgz'
Inputs:
[Mandatory]
pd_image: (an existing file name)
image of proton density values
argument: ``%s``, position: 6
te: (a float)
echo time (in msec)
argument: ``%.3f``, position: 4
tr: (a float)
repetition time (in msec)
argument: ``%.2f``, position: 2
t1_image: (an existing file name)
image of T1 values
argument: ``%s``, position: 5
flip_angle: (a float)
flip angle (in degrees)
argument: ``%.2f``, position: 3
[Optional]
out_file: (a file name)
image to write
argument: ``%s``
args: (a unicode string)
Additional parameters to the command
argument: ``%s``
fixed_weighting: (a boolean)
use a fixed weighting to generate optimal gray/white contrast
argument: ``-w``, position: 1
environ: (a dictionary with keys which are a newbytes or None or a
newstr or None and with values which are a newbytes or None or a
newstr or None, nipype default value: {})
Environment variables
subjects_dir: (an existing directory name)
subjects directory
Outputs:
out_file: (an existing file name)
synthesized FLASH acquisition
UnpackSDICOMDir¶
Wraps the executable command unpacksdcmdir
.
Use unpacksdcmdir to convert dicom files
Call unpacksdcmdir -help from the command line to see more information on using this command.
Examples¶
>>> from nipype.interfaces.freesurfer import UnpackSDICOMDir
>>> unpack = UnpackSDICOMDir()
>>> unpack.inputs.source_dir = '.'
>>> unpack.inputs.output_dir = '.'
>>> unpack.inputs.run_info = (5, 'mprage', 'nii', 'struct')
>>> unpack.inputs.dir_structure = 'generic'
>>> unpack.cmdline
'unpacksdcmdir -generic -targ . -run 5 mprage nii struct -src .'
Inputs:
[Mandatory]
seq_config: (an existing file name)
specify unpacking rules based on sequence
argument: ``-seqcfg %s``
mutually_exclusive: run_info, config, seq_config
run_info: (a tuple of the form: (an integer (int or long), a unicode
string, a unicode string, a unicode string))
runno subdir format name : spec unpacking rules on cmdline
argument: ``-run %d %s %s %s``
mutually_exclusive: run_info, config, seq_config
config: (an existing file name)
specify unpacking rules in file
argument: ``-cfg %s``
mutually_exclusive: run_info, config, seq_config
source_dir: (an existing directory name)
directory with the DICOM files
argument: ``-src %s``
[Optional]
spm_zeropad: (an integer (int or long))
set frame number zero padding width for SPM
argument: ``-nspmzeropad %d``
dir_structure: (u'fsfast' or u'generic')
unpack to specified directory structures
argument: ``-%s``
args: (a unicode string)
Additional parameters to the command
argument: ``%s``
no_info_dump: (a boolean)
do not create infodump file
argument: ``-noinfodump``
environ: (a dictionary with keys which are a newbytes or None or a
newstr or None and with values which are a newbytes or None or a
newstr or None, nipype default value: {})
Environment variables
output_dir: (a directory name)
top directory into which the files will be unpacked
argument: ``-targ %s``
subjects_dir: (an existing directory name)
subjects directory
scan_only: (an existing file name)
only scan the directory and put result in file
argument: ``-scanonly %s``
log_file: (an existing file name)
explicilty set log file
argument: ``-log %s``
no_unpack_err: (a boolean)
do not try to unpack runs with errors
argument: ``-no-unpackerr``
Outputs:
None
WatershedSkullStrip¶
Wraps the executable command mri_watershed
.
This program strips skull and other outer non-brain tissue and produces the brain volume from T1 volume or the scanned volume.
The “watershed” segmentation algorithm was used to dertermine the intensity values for white matter, grey matter, and CSF. A force field was then used to fit a spherical surface to the brain. The shape of the surface fit was then evaluated against a previously derived template.
The default parameters are: -w 0.82 -b 0.32 -h 10 -seedpt -ta -wta
(Segonne 2004)
Examples¶
>>> from nipype.interfaces.freesurfer import WatershedSkullStrip
>>> skullstrip = WatershedSkullStrip()
>>> skullstrip.inputs.in_file = "T1.mgz"
>>> skullstrip.inputs.t1 = True
>>> skullstrip.inputs.transform = "transforms/talairach_with_skull.lta"
>>> skullstrip.inputs.out_file = "brainmask.auto.mgz"
>>> skullstrip.cmdline
'mri_watershed -T1 transforms/talairach_with_skull.lta T1.mgz brainmask.auto.mgz'
Inputs:
[Mandatory]
out_file: (a file name, nipype default value: brainmask.auto.mgz)
output volume
argument: ``%s``, position: -1
in_file: (an existing file name)
input volume
argument: ``%s``, position: -2
[Optional]
args: (a unicode string)
Additional parameters to the command
argument: ``%s``
transform: (a file name)
undocumented
argument: ``%s``, position: -3
t1: (a boolean)
specify T1 input volume (T1 grey value = 110)
argument: ``-T1``
brain_atlas: (an existing file name)
argument: ``-brain_atlas %s``, position: -4
environ: (a dictionary with keys which are a newbytes or None or a
newstr or None and with values which are a newbytes or None or a
newstr or None, nipype default value: {})
Environment variables
subjects_dir: (an existing directory name)
subjects directory
Outputs:
out_file: (a file name)
skull stripped brain volume