nipype.interfaces.freesurfer.model module

The freesurfer module provides basic functions for interfacing with freesurfer tools.

Binarize

Link to code

Bases: FSCommand

Wrapped executable: mri_binarize.

Use FreeSurfer mri_binarize to threshold an input volume

Examples

>>> binvol = Binarize(in_file='structural.nii', min=10, binary_file='foo_out.nii')
>>> binvol.cmdline
'mri_binarize --o foo_out.nii --i structural.nii --min 10.000000'
in_file : a pathlike object or string representing an existing file
Input volume. Maps to a command-line argument: --i %s.
abs : a boolean
Take abs of invol first (ie, make unsigned). Maps to a command-line argument: --abs.
args : a unicode string
Additional parameters to the command. Maps to a command-line argument: %s.
bin_col_num : a boolean
Set binarized voxel value to its column number. Maps to a command-line argument: --bincol.
bin_val : an integer (int or long)
Set vox within thresh to val (default is 1). Maps to a command-line argument: --binval %d.
bin_val_not : an integer (int or long)
Set vox outside range to val (default is 0). Maps to a command-line argument: --binvalnot %d.
binary_file : a pathlike object or string representing a file
Binary output volume. Maps to a command-line argument: --o %s.
count_file : a boolean or a pathlike object or string representing a file
Save number of hits in ascii file (hits, ntotvox, pct). Maps to a command-line argument: --count %s.
dilate : an integer (int or long)
Niters: dilate binarization in 3D. Maps to a command-line argument: --dilate %d.
environ : a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’
Environment variables. (Nipype default value: {})
erode : an integer (int or long)
Nerode: erode binarization in 3D (after any dilation). Maps to a command-line argument: --erode  %d.
erode2d : an integer (int or long)
Nerode2d: erode binarization in 2D (after any 3D erosion). Maps to a command-line argument: --erode2d %d.
frame_no : an integer (int or long)
Use 0-based frame of input (default is 0). Maps to a command-line argument: --frame %s.
invert : a boolean
Set binval=0, binvalnot=1. Maps to a command-line argument: --inv.
mask_file : a pathlike object or string representing an existing file
Must be within mask. Maps to a command-line argument: --mask maskvol.
mask_thresh : a float
Set thresh for mask. Maps to a command-line argument: --mask-thresh %f.
match : a list of items which are an integer (int or long)
Match instead of threshold. Maps to a command-line argument: --match %d....
max : a float
Max thresh. Maps to a command-line argument: --max %f. Mutually exclusive with inputs: wm_ven_csf.
merge_file : a pathlike object or string representing an existing file
Merge with mergevol. Maps to a command-line argument: --merge %s.
min : a float
Min thresh. Maps to a command-line argument: --min %f. Mutually exclusive with inputs: wm_ven_csf.
out_type : ‘nii’ or ‘nii.gz’ or ‘mgz’
Output file type.
rmax : a float
Compute max based on rmax*globalmean. Maps to a command-line argument: --rmax %f.
rmin : a float
Compute min based on rmin*globalmean. Maps to a command-line argument: --rmin %f.
subjects_dir : a pathlike object or string representing an existing directory
Subjects directory.
ventricles : a boolean
Set match vals those for aseg ventricles+choroid (not 4th). Maps to a command-line argument: --ventricles.
wm : a boolean
Set match vals to 2 and 41 (aseg for cerebral WM). Maps to a command-line argument: --wm.
wm_ven_csf : a boolean
WM and ventricular CSF, including choroid (not 4th). Maps to a command-line argument: --wm+vcsf. Mutually exclusive with inputs: min, max.
zero_edges : a boolean
Zero the edge voxels. Maps to a command-line argument: --zero-edges.
zero_slice_edge : a boolean
Zero the edge slice voxels. Maps to a command-line argument: --zero-slice-edges.
binary_file : a pathlike object or string representing an existing file
Binarized output volume.
count_file : a pathlike object or string representing a file
Ascii file containing number of hits.

Concatenate

Link to code

Bases: FSCommand

Wrapped executable: mri_concat.

Use Freesurfer mri_concat to combine several input volumes into one output volume. Can concatenate by frames, or compute a variety of statistics on the input volumes.

Examples

Combine two input volumes into one volume with two frames

>>> concat = Concatenate()
>>> concat.inputs.in_files = ['cont1.nii', 'cont2.nii']
>>> concat.inputs.concatenated_file = 'bar.nii'
>>> concat.cmdline
'mri_concat --o bar.nii --i cont1.nii --i cont2.nii'
in_files : a list of items which are a pathlike object or string representing an existing file
Individual volumes to be concatenated. Maps to a command-line argument: --i %s....
add_val : a float
Add some amount to the input volume. Maps to a command-line argument: --add %f.
args : a unicode string
Additional parameters to the command. Maps to a command-line argument: %s.
combine : a boolean
Combine non-zero values into single frame volume. Maps to a command-line argument: --combine.
concatenated_file : a pathlike object or string representing a file
Output volume. Maps to a command-line argument: --o %s.
environ : a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’
Environment variables. (Nipype default value: {})
gmean : an integer (int or long)
Create matrix to average Ng groups, Nper=Ntot/Ng. Maps to a command-line argument: --gmean %d.
keep_dtype : a boolean
Keep voxelwise precision type (default is float. Maps to a command-line argument: --keep-datatype.
mask_file : a pathlike object or string representing an existing file
Mask input with a volume. Maps to a command-line argument: --mask %s.
max_bonfcor : a boolean
Compute max and bonferroni correct (assumes -log10(ps)). Maps to a command-line argument: --max-bonfcor.
max_index : a boolean
Compute the index of max voxel in concatenated volumes. Maps to a command-line argument: --max-index.
mean_div_n : a boolean
Compute mean/nframes (good for var). Maps to a command-line argument: --mean-div-n.
multiply_by : a float
Multiply input volume by some amount. Maps to a command-line argument: --mul %f.
multiply_matrix_file : a pathlike object or string representing an existing file
Multiply input by an ascii matrix in file. Maps to a command-line argument: --mtx %s.
paired_stats : ‘sum’ or ‘avg’ or ‘diff’ or ‘diff-norm’ or ‘diff-norm1’ or ‘diff-norm2’
Compute paired sum, avg, or diff. Maps to a command-line argument: --paired-%s.
sign : ‘abs’ or ‘pos’ or ‘neg’
Take only pos or neg voxles from input, or take abs. Maps to a command-line argument: --%s.
sort : a boolean
Sort each voxel by ascending frame value. Maps to a command-line argument: --sort.
stats : ‘sum’ or ‘var’ or ‘std’ or ‘max’ or ‘min’ or ‘mean’
Compute the sum, var, std, max, min or mean of the input volumes. Maps to a command-line argument: --%s.
subjects_dir : a pathlike object or string representing an existing directory
Subjects directory.
vote : a boolean
Most frequent value at each voxel and fraction of occurances. Maps to a command-line argument: --vote.
concatenated_file : a pathlike object or string representing an existing file
Path/name of the output volume.

GLMFit

Link to code

Bases: FSCommand

Wrapped executable: mri_glmfit.

Use FreeSurfer’s mri_glmfit to specify and estimate a general linear model.

Examples

>>> glmfit = GLMFit()
>>> glmfit.inputs.in_file = 'functional.nii'
>>> glmfit.inputs.one_sample = True
>>> glmfit.cmdline == 'mri_glmfit --glmdir %s --y functional.nii --osgm'%os.getcwd()
True
in_file : a pathlike object or string representing a file
Input 4D file. Maps to a command-line argument: --y %s.
allow_ill_cond : a boolean
Allow ill-conditioned design matrices. Maps to a command-line argument: --illcond.
allow_repeated_subjects : a boolean
Allow subject names to repeat in the fsgd file (must appear before –fsgd. Maps to a command-line argument: --allowsubjrep.
args : a unicode string
Additional parameters to the command. Maps to a command-line argument: %s.
calc_AR1 : a boolean
Compute and save temporal AR1 of residual. Maps to a command-line argument: --tar1.
check_opts : a boolean
Don’t run anything, just check options and exit. Maps to a command-line argument: --checkopts.
compute_log_y : a boolean
Compute natural log of y prior to analysis. Maps to a command-line argument: --logy.
contrast : a list of items which are a pathlike object or string representing an existing file
Contrast file. Maps to a command-line argument: --C %s....
cortex : a boolean
Use subjects ?h.cortex.label as label. Maps to a command-line argument: --cortex. Mutually exclusive with inputs: label_file.
debug : a boolean
Turn on debugging. Maps to a command-line argument: --debug.
design : a pathlike object or string representing an existing file
Design matrix file. Maps to a command-line argument: --X %s. Mutually exclusive with inputs: fsgd, design, one_sample.
diag : an integer (int or long)
Gdiag_no : set diagnositc level. Maps to a command-line argument: --diag %d.
diag_cluster : a boolean
Save sig volume and exit from first sim loop. Maps to a command-line argument: --diag-cluster.
environ : a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’
Environment variables. (Nipype default value: {})
fixed_fx_dof : an integer (int or long)
Dof for fixed effects analysis. Maps to a command-line argument: --ffxdof %d. Mutually exclusive with inputs: fixed_fx_dof_file.
fixed_fx_dof_file : a pathlike object or string representing a file
Text file with dof for fixed effects analysis. Maps to a command-line argument: --ffxdofdat %d. Mutually exclusive with inputs: fixed_fx_dof.
fixed_fx_var : a pathlike object or string representing an existing file
For fixed effects analysis. Maps to a command-line argument: --yffxvar %s.
force_perm : a boolean
Force perumtation test, even when design matrix is not orthog. Maps to a command-line argument: --perm-force.
fsgd : a tuple of the form: (a pathlike object or string representing an existing file, ‘doss’ or ‘dods’)
Freesurfer descriptor file. Maps to a command-line argument: --fsgd %s %s. Mutually exclusive with inputs: fsgd, design, one_sample.
fwhm : a floating point number >= 0.0
Smooth input by fwhm. Maps to a command-line argument: --fwhm %f.
glm_dir : a unicode string
Save outputs to dir. Maps to a command-line argument: --glmdir %s.
hemi : ‘lh’ or ‘rh’
Surface hemisphere.
invert_mask : a boolean
Invert mask. Maps to a command-line argument: --mask-inv.
label_file : a pathlike object or string representing an existing file
Use label as mask, surfaces only. Maps to a command-line argument: --label %s. Mutually exclusive with inputs: cortex.
mask_file : a pathlike object or string representing an existing file
Binary mask. Maps to a command-line argument: --mask %s.
no_contrast_ok : a boolean
Do not fail if no contrasts specified. Maps to a command-line argument: --no-contrasts-ok.
no_est_fwhm : a boolean
Turn off FWHM output estimation. Maps to a command-line argument: --no-est-fwhm.
no_mask_smooth : a boolean
Do not mask when smoothing. Maps to a command-line argument: --no-mask-smooth.
no_prune : a boolean
Do not prune. Maps to a command-line argument: --no-prune. Mutually exclusive with inputs: prunethresh.
one_sample : a boolean
Construct X and C as a one-sample group mean. Maps to a command-line argument: --osgm. Mutually exclusive with inputs: one_sample, fsgd, design, contrast.
pca : a boolean
Perform pca/svd analysis on residual. Maps to a command-line argument: --pca.
per_voxel_reg : a list of items which are a pathlike object or string representing an existing file
Per-voxel regressors. Maps to a command-line argument: --pvr %s....
profile : an integer (int or long)
Niters : test speed. Maps to a command-line argument: --profile %d.
prune : a boolean
Remove voxels that do not have a non-zero value at each frame (def). Maps to a command-line argument: --prune.
prune_thresh : a float
Prune threshold. Default is FLT_MIN. Maps to a command-line argument: --prune_thr %f. Mutually exclusive with inputs: noprune.
resynth_test : an integer (int or long)
Test GLM by resynthsis. Maps to a command-line argument: --resynthtest %d.
save_cond : a boolean
Flag to save design matrix condition at each voxel. Maps to a command-line argument: --save-cond.
save_estimate : a boolean
Save signal estimate (yhat). Maps to a command-line argument: --yhat-save.
save_res_corr_mtx : a boolean
Save residual error spatial correlation matrix (eres.scm). Big!. Maps to a command-line argument: --eres-scm.
save_residual : a boolean
Save residual error (eres). Maps to a command-line argument: --eres-save.
seed : an integer (int or long)
Used for synthesizing noise. Maps to a command-line argument: --seed %d.
self_reg : a tuple of the form: (an integer (int or long), an integer (int or long), an integer (int or long))
Self-regressor from index col row slice. Maps to a command-line argument: --selfreg %d %d %d.
sim_done_file : a pathlike object or string representing a file
Create file when simulation finished. Maps to a command-line argument: --sim-done %s.
sim_sign : ‘abs’ or ‘pos’ or ‘neg’
Abs, pos, or neg. Maps to a command-line argument: --sim-sign %s.
simulation : a tuple of the form: (‘perm’ or ‘mc-full’ or ‘mc-z’, an integer (int or long), a float, a unicode string)
Nulltype nsim thresh csdbasename. Maps to a command-line argument: --sim %s %d %f %s.
subject_id : a unicode string
Subject id for surface geometry.
subjects_dir : a pathlike object or string representing an existing directory
Subjects directory.
surf : a boolean
Analysis is on a surface mesh. Maps to a command-line argument: --surf %s %s %s. Requires inputs: subject_id, hemi.
surf_geo : a unicode string
Surface geometry name (e.g. white, pial). (Nipype default value: white)
synth : a boolean
Replace input with gaussian. Maps to a command-line argument: --synth.
uniform : a tuple of the form: (a float, a float)
Use uniform distribution instead of gaussian. Maps to a command-line argument: --uniform %f %f.
var_fwhm : a floating point number >= 0.0
Smooth variance by fwhm. Maps to a command-line argument: --var-fwhm %f.
vox_dump : a tuple of the form: (an integer (int or long), an integer (int or long), an integer (int or long))
Dump voxel GLM and exit. Maps to a command-line argument: --voxdump %d %d %d.
weight_file : a pathlike object or string representing an existing file
Weight for each input at each voxel. Mutually exclusive with inputs: weighted_ls.
weight_inv : a boolean
Invert weights. Maps to a command-line argument: --w-inv. Mutually exclusive with inputs: weighted_ls.
weight_sqrt : a boolean
Sqrt of weights. Maps to a command-line argument: --w-sqrt. Mutually exclusive with inputs: weighted_ls.
weighted_ls : a pathlike object or string representing an existing file
Weighted least squares. Maps to a command-line argument: --wls %s. Mutually exclusive with inputs: weight_file, weight_inv, weight_sqrt.
beta_file : a pathlike object or string representing an existing file
Map of regression coefficients.
dof_file : a pathlike object or string representing a file
Text file with effective degrees-of-freedom for the analysis.
error_file : a pathlike object or string representing a file
Map of residual error.
error_stddev_file : a pathlike object or string representing a file
Map of residual error standard deviation.
error_var_file : a pathlike object or string representing a file
Map of residual error variance.
estimate_file : a pathlike object or string representing a file
Map of the estimated Y values.
frame_eigenvectors : a pathlike object or string representing a file
Matrix of frame eigenvectors from residual PCA.
ftest_file : a list of items which are any value
Map of test statistic values.
fwhm_file : a pathlike object or string representing a file
Text file with estimated smoothness.
gamma_file : a list of items which are any value
Map of contrast of regression coefficients.
gamma_var_file : a list of items which are any value
Map of regression contrast variance.
glm_dir : a pathlike object or string representing an existing directory
Output directory.
mask_file : a pathlike object or string representing a file
Map of the mask used in the analysis.
sig_file : a list of items which are any value
Map of F-test significance (in -log10p).
singular_values : a pathlike object or string representing a file
Matrix singular values from residual PCA.
spatial_eigenvectors : a pathlike object or string representing a file
Map of spatial eigenvectors from residual PCA.
svd_stats_file : a pathlike object or string representing a file
Text file summarizing the residual PCA.

Label2Annot

Link to code

Bases: FSCommand

Wrapped executable: mris_label2annot.

Converts a set of surface labels to an annotation file

Examples

>>> from nipype.interfaces.freesurfer import Label2Annot
>>> l2a = Label2Annot()
>>> l2a.inputs.hemisphere = 'lh'
>>> l2a.inputs.subject_id = '10335'
>>> l2a.inputs.in_labels = ['lh.aparc.label']
>>> l2a.inputs.orig = 'lh.pial'
>>> l2a.inputs.out_annot = 'test'
>>> l2a.cmdline
'mris_label2annot --hemi lh --l lh.aparc.label --a test --s 10335'
hemisphere : ‘lh’ or ‘rh’
Input hemisphere. Maps to a command-line argument: --hemi %s.
in_labels : a list of items which are any value
List of input label files. Maps to a command-line argument: --l %s....
orig : a pathlike object or string representing an existing file
Implicit {hemisphere}.orig.
out_annot : a string
Name of the annotation to create. Maps to a command-line argument: --a %s.
subject_id : a string
Subject name/ID. Maps to a command-line argument: --s %s. (Nipype default value: subject_id)
args : a unicode string
Additional parameters to the command. Maps to a command-line argument: %s.
color_table : a pathlike object or string representing an existing file
File that defines the structure names, their indices, and their color. Maps to a command-line argument: --ctab %s.
copy_inputs : a boolean
Copy implicit inputs and create a temp subjects_dir.
environ : a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’
Environment variables. (Nipype default value: {})
keep_max : a boolean
Keep label with highest ‘stat’ value. Maps to a command-line argument: --maxstatwinner.
subjects_dir : a pathlike object or string representing an existing directory
Subjects directory.
verbose_off : a boolean
Turn off overlap and stat override messages. Maps to a command-line argument: --noverbose.
out_file : a pathlike object or string representing an existing file
Output annotation file.
Label2Annot.run(**inputs)

Execute this interface.

This interface will not raise an exception if runtime.returncode is non-zero.

Parameters:
  • cwd (specify a folder where the interface should be run) –
  • inputs (allows the interface settings to be updated) –
Returns:

results – A copy of the instance that was executed, provenance information and, if successful, results

Return type:

nipype.interfaces.base.support.InterfaceResult

Label2Label

Link to code

Bases: FSCommand

Wrapped executable: mri_label2label.

Converts a label in one subject’s space to a label in another subject’s space using either talairach or spherical as an intermediate registration space.

If a source mask is used, then the input label must have been created from a surface (ie, the vertex numbers are valid). The format can be anything supported by mri_convert or curv or paint. Vertices in the source label that do not meet threshold in the mask will be removed from the label.

Examples

>>> from nipype.interfaces.freesurfer import Label2Label
>>> l2l = Label2Label()
>>> l2l.inputs.hemisphere = 'lh'
>>> l2l.inputs.subject_id = '10335'
>>> l2l.inputs.sphere_reg = 'lh.pial'
>>> l2l.inputs.white = 'lh.pial'
>>> l2l.inputs.source_subject = 'fsaverage'
>>> l2l.inputs.source_label = 'lh-pial.stl'
>>> l2l.inputs.source_white = 'lh.pial'
>>> l2l.inputs.source_sphere_reg = 'lh.pial'
>>> l2l.cmdline
'mri_label2label --hemi lh --trglabel lh-pial_converted.stl --regmethod surface --srclabel lh-pial.stl --srcsubject fsaverage --trgsubject 10335'
hemisphere : ‘lh’ or ‘rh’
Input hemisphere. Maps to a command-line argument: --hemi %s.
source_label : a pathlike object or string representing an existing file
Source label. Maps to a command-line argument: --srclabel %s.
source_sphere_reg : a pathlike object or string representing an existing file
Implicit input <hemisphere>.sphere.reg.
source_subject : a string
Source subject name. Maps to a command-line argument: --srcsubject %s.
source_white : a pathlike object or string representing an existing file
Implicit input <hemisphere>.white.
sphere_reg : a pathlike object or string representing an existing file
Implicit input <hemisphere>.sphere.reg.
subject_id : a string
Target subject. Maps to a command-line argument: --trgsubject %s. (Nipype default value: subject_id)
white : a pathlike object or string representing an existing file
Implicit input <hemisphere>.white.
args : a unicode string
Additional parameters to the command. Maps to a command-line 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 bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’
Environment variables. (Nipype default value: {})
out_file : a pathlike object or string representing a file
Target label. Maps to a command-line argument: --trglabel %s.
registration_method : ‘surface’ or ‘volume’
Registration method. Maps to a command-line argument: --regmethod %s. (Nipype default value: surface)
subjects_dir : a pathlike object or string representing an existing directory
Subjects directory.
out_file : a pathlike object or string representing an existing file
Output label.
Label2Label.run(**inputs)

Execute this interface.

This interface will not raise an exception if runtime.returncode is non-zero.

Parameters:
  • cwd (specify a folder where the interface should be run) –
  • inputs (allows the interface settings to be updated) –
Returns:

results – A copy of the instance that was executed, provenance information and, if successful, results

Return type:

nipype.interfaces.base.support.InterfaceResult

Label2Vol

Link to code

Bases: FSCommand

Wrapped executable: mri_label2vol.

Make a binary volume from a Freesurfer label

Examples

>>> binvol = Label2Vol(label_file='cortex.label', template_file='structural.nii', reg_file='register.dat', fill_thresh=0.5, vol_label_file='foo_out.nii')
>>> binvol.cmdline
'mri_label2vol --fillthresh 0.5 --label cortex.label --reg register.dat --temp structural.nii --o foo_out.nii'
annot_file : a pathlike object or string representing an existing file
Surface annotation file. Maps to a command-line argument: --annot %s. Mutually exclusive with inputs: label_file, annot_file, seg_file, aparc_aseg. Requires inputs: subject_id, hemi.
aparc_aseg : a boolean
Use aparc+aseg.mgz in subjectdir as seg. Maps to a command-line argument: --aparc+aseg. Mutually exclusive with inputs: label_file, annot_file, seg_file, aparc_aseg.
label_file : a list of items which are a pathlike object or string representing an existing file
List of label files. Maps to a command-line argument: --label %s.... Mutually exclusive with inputs: label_file, annot_file, seg_file, aparc_aseg.
seg_file : a pathlike object or string representing an existing file
Segmentation file. Maps to a command-line argument: --seg %s. Mutually exclusive with inputs: label_file, annot_file, seg_file, aparc_aseg.
template_file : a pathlike object or string representing an existing file
Output template volume. Maps to a command-line argument: --temp %s.
args : a unicode string
Additional parameters to the command. Maps to a command-line argument: %s.
environ : a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’
Environment variables. (Nipype default value: {})
fill_thresh : 0.0 <= a floating point number <= 1.0
Thresh : between 0 and 1. Maps to a command-line argument: --fillthresh %g.
hemi : ‘lh’ or ‘rh’
Hemisphere to use lh or rh. Maps to a command-line argument: --hemi %s.
identity : a boolean
Set R=I. Maps to a command-line argument: --identity. Mutually exclusive with inputs: reg_file, reg_header, identity.
invert_mtx : a boolean
Invert the registration matrix. Maps to a command-line argument: --invertmtx.
label_hit_file : a pathlike object or string representing a file
File with each frame is nhits for a label. Maps to a command-line argument: --hits %s.
label_voxel_volume : a float
Volume of each label point (def 1mm3). Maps to a command-line argument: --labvoxvol %f.
map_label_stat : a pathlike object or string representing a file
Map the label stats field into the vol. Maps to a command-line argument: --label-stat %s.
native_vox2ras : a boolean
Use native vox2ras xform instead of tkregister-style. Maps to a command-line argument: --native-vox2ras.
proj : a tuple of the form: (‘abs’ or ‘frac’, a float, a float, a float)
Project along surface normal. Maps to a command-line argument: --proj %s %f %f %f. Requires inputs: subject_id, hemi.
reg_file : a pathlike object or string representing an existing file
Tkregister style matrix VolXYZ = R*LabelXYZ. Maps to a command-line argument: --reg %s. Mutually exclusive with inputs: reg_file, reg_header, identity.
reg_header : a pathlike object or string representing an existing file
Label template volume. Maps to a command-line argument: --regheader %s. Mutually exclusive with inputs: reg_file, reg_header, identity.
subject_id : a unicode string
Subject id. Maps to a command-line argument: --subject %s.
subjects_dir : a pathlike object or string representing an existing directory
Subjects directory.
surface : a unicode string
Use surface instead of white. Maps to a command-line argument: --surf %s.
vol_label_file : a pathlike object or string representing a file
Output volume. Maps to a command-line argument: --o %s.
vol_label_file : a pathlike object or string representing an existing file
Output volume.

MRISPreproc

Link to code

Bases: FSCommand

Wrapped executable: mris_preproc.

Use FreeSurfer mris_preproc to prepare a group of contrasts for a second level analysis

Examples

>>> preproc = MRISPreproc()
>>> preproc.inputs.target = 'fsaverage'
>>> preproc.inputs.hemi = 'lh'
>>> preproc.inputs.vol_measure_file = [('cont1.nii', 'register.dat'),                                            ('cont1a.nii', 'register.dat')]
>>> preproc.inputs.out_file = 'concatenated_file.mgz'
>>> preproc.cmdline
'mris_preproc --hemi lh --out concatenated_file.mgz --target fsaverage --iv cont1.nii register.dat --iv cont1a.nii register.dat'
hemi : ‘lh’ or ‘rh’
Hemisphere for source and target. Maps to a command-line argument: --hemi %s.
target : a unicode string
Target subject name. Maps to a command-line argument: --target %s.
args : a unicode string
Additional parameters to the command. Maps to a command-line argument: %s.
environ : a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’
Environment variables. (Nipype default value: {})
fsgd_file : a pathlike object or string representing an existing file
Specify subjects using fsgd file. Maps to a command-line argument: --fsgd %s. Mutually exclusive with inputs: subjects, fsgd_file, subject_file.
fwhm : a float
Smooth by fwhm mm on the target surface. Maps to a command-line argument: --fwhm %f. Mutually exclusive with inputs: num_iters.
fwhm_source : a float
Smooth by fwhm mm on the source surface. Maps to a command-line argument: --fwhm-src %f. Mutually exclusive with inputs: num_iters_source.
num_iters : an integer (int or long)
Niters : smooth by niters on the target surface. Maps to a command-line argument: --niters %d. Mutually exclusive with inputs: fwhm.
num_iters_source : an integer (int or long)
Niters : smooth by niters on the source surface. Maps to a command-line argument: --niterssrc %d. Mutually exclusive with inputs: fwhm_source.
out_file : a pathlike object or string representing a file
Output filename. Maps to a command-line argument: --out %s.
proj_frac : a float
Projection fraction for vol2surf. Maps to a command-line argument: --projfrac %s.
smooth_cortex_only : a boolean
Only smooth cortex (ie, exclude medial wall). Maps to a command-line argument: --smooth-cortex-only.
source_format : a unicode string
Source format. Maps to a command-line argument: --srcfmt %s.
subject_file : a pathlike object or string representing an existing file
File specifying subjects separated by white space. Maps to a command-line argument: --f %s. Mutually exclusive with inputs: subjects, fsgd_file, subject_file.
subjects : a list of items which are any value
Subjects from who measures are calculated. Maps to a command-line argument: --s %s.... Mutually exclusive with inputs: subjects, fsgd_file, subject_file.
subjects_dir : a pathlike object or string representing an existing directory
Subjects directory.
surf_area : a unicode string
Extract vertex area from subject/surf/hemi.surfname to use as input. Maps to a command-line argument: --area %s. Mutually exclusive with inputs: surf_measure, surf_measure_file, surf_area.
surf_dir : a unicode string
Alternative directory (instead of surf). Maps to a command-line argument: --surfdir %s.
surf_measure : a unicode string
Use subject/surf/hemi.surf_measure as input. Maps to a command-line argument: --meas %s. Mutually exclusive with inputs: surf_measure, surf_measure_file, surf_area.
surf_measure_file : a list of items which are a pathlike object or string representing an existing file
File alternative to surfmeas, still requires list of subjects. Maps to a command-line argument: --is %s.... Mutually exclusive with inputs: surf_measure, surf_measure_file, surf_area.
vol_measure_file : a list of items which are a tuple of the form: (a pathlike object or string representing an existing file, a pathlike object or string representing an existing file)
List of volume measure and reg file tuples. Maps to a command-line argument: --iv %s %s....
out_file : a pathlike object or string representing a file
Preprocessed output file.

MRISPreprocReconAll

Link to code

Bases: MRISPreproc

Wrapped executable: mris_preproc.

Extends MRISPreproc to allow it to be used in a recon-all workflow

Examples

>>> preproc = MRISPreprocReconAll()
>>> preproc.inputs.target = 'fsaverage'
>>> preproc.inputs.hemi = 'lh'
>>> preproc.inputs.vol_measure_file = [('cont1.nii', 'register.dat'),                                            ('cont1a.nii', 'register.dat')]
>>> preproc.inputs.out_file = 'concatenated_file.mgz'
>>> preproc.cmdline
'mris_preproc --hemi lh --out concatenated_file.mgz --s subject_id --target fsaverage --iv cont1.nii register.dat --iv cont1a.nii register.dat'
hemi : ‘lh’ or ‘rh’
Hemisphere for source and target. Maps to a command-line argument: --hemi %s.
target : a unicode string
Target subject name. Maps to a command-line argument: --target %s.
args : a unicode string
Additional parameters to the command. Maps to a command-line argument: %s.
copy_inputs : a boolean
If running as a node, set this to True this will copy some implicit inputs to the node directory.
environ : a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’
Environment variables. (Nipype default value: {})
fsgd_file : a pathlike object or string representing an existing file
Specify subjects using fsgd file. Maps to a command-line argument: --fsgd %s. Mutually exclusive with inputs: subjects, fsgd_file, subject_file.
fwhm : a float
Smooth by fwhm mm on the target surface. Maps to a command-line argument: --fwhm %f. Mutually exclusive with inputs: num_iters.
fwhm_source : a float
Smooth by fwhm mm on the source surface. Maps to a command-line argument: --fwhm-src %f. Mutually exclusive with inputs: num_iters_source.
lh_surfreg_target : a pathlike object or string representing a file
Implicit target surface registration file. Requires inputs: surfreg_files.
num_iters : an integer (int or long)
Niters : smooth by niters on the target surface. Maps to a command-line argument: --niters %d. Mutually exclusive with inputs: fwhm.
num_iters_source : an integer (int or long)
Niters : smooth by niters on the source surface. Maps to a command-line argument: --niterssrc %d. Mutually exclusive with inputs: fwhm_source.
out_file : a pathlike object or string representing a file
Output filename. Maps to a command-line argument: --out %s.
proj_frac : a float
Projection fraction for vol2surf. Maps to a command-line argument: --projfrac %s.
rh_surfreg_target : a pathlike object or string representing a file
Implicit target surface registration file. Requires inputs: surfreg_files.
smooth_cortex_only : a boolean
Only smooth cortex (ie, exclude medial wall). Maps to a command-line argument: --smooth-cortex-only.
source_format : a unicode string
Source format. Maps to a command-line argument: --srcfmt %s.
subject_file : a pathlike object or string representing an existing file
File specifying subjects separated by white space. Maps to a command-line argument: --f %s. Mutually exclusive with inputs: subjects, fsgd_file, subject_file.
subject_id : a string
Subject from whom measures are calculated. Maps to a command-line argument: --s %s. Mutually exclusive with inputs: subjects, fsgd_file, subject_file, subject_id. (Nipype default value: subject_id)
subjects : a list of items which are any value
Subjects from who measures are calculated. Maps to a command-line argument: --s %s.... Mutually exclusive with inputs: subjects, fsgd_file, subject_file.
subjects_dir : a pathlike object or string representing an existing directory
Subjects directory.
surf_area : a unicode string
Extract vertex area from subject/surf/hemi.surfname to use as input. Maps to a command-line argument: --area %s. Mutually exclusive with inputs: surf_measure, surf_measure_file, surf_area.
surf_dir : a unicode string
Alternative directory (instead of surf). Maps to a command-line argument: --surfdir %s.
surf_measure : a unicode string
Use subject/surf/hemi.surf_measure as input. Maps to a command-line argument: --meas %s. Mutually exclusive with inputs: surf_measure, surf_measure_file, surf_area.
surf_measure_file : a pathlike object or string representing an existing file
File necessary for surfmeas. Maps to a command-line argument: --meas %s. Mutually exclusive with inputs: surf_measure, surf_measure_file, surf_area.
surfreg_files : a list of items which are a pathlike object or string representing an existing file
Lh and rh input surface registration files. Maps to a command-line argument: --surfreg %s. Requires inputs: lh_surfreg_target, rh_surfreg_target.
vol_measure_file : a list of items which are a tuple of the form: (a pathlike object or string representing an existing file, a pathlike object or string representing an existing file)
List of volume measure and reg file tuples. Maps to a command-line argument: --iv %s %s....
out_file : a pathlike object or string representing a file
Preprocessed output file.
MRISPreprocReconAll.run(**inputs)

Execute this interface.

This interface will not raise an exception if runtime.returncode is non-zero.

Parameters:
  • cwd (specify a folder where the interface should be run) –
  • inputs (allows the interface settings to be updated) –
Returns:

results – A copy of the instance that was executed, provenance information and, if successful, results

Return type:

nipype.interfaces.base.support.InterfaceResult

MS_LDA

Link to code

Bases: FSCommand

Wrapped executable: mri_ms_LDA.

Perform LDA reduction on the intensity space of an arbitrary # of FLASH images

Examples

>>> grey_label = 2
>>> white_label = 3
>>> zero_value = 1
>>> optimalWeights = MS_LDA(lda_labels=[grey_label, white_label],                                 label_file='label.mgz', weight_file='weights.txt',                                 shift=zero_value, vol_synth_file='synth_out.mgz',                                 conform=True, use_weights=True,                                 images=['FLASH1.mgz', 'FLASH2.mgz', 'FLASH3.mgz'])
>>> optimalWeights.cmdline
'mri_ms_LDA -conform -label label.mgz -lda 2 3 -shift 1 -W -synth synth_out.mgz -weight weights.txt FLASH1.mgz FLASH2.mgz FLASH3.mgz'
images : a list of items which are a pathlike object or string representing an existing file
List of input FLASH images. Maps to a command-line argument: %s (position: -1).
lda_labels : a list of from 2 to 2 items which are an integer (int or long)
Pair of class labels to optimize. Maps to a command-line argument: -lda %s.
vol_synth_file : a pathlike object or string representing a file
Filename for the synthesized output volume. Maps to a command-line argument: -synth %s.
weight_file : a pathlike object or string representing a file
Filename for the LDA weights (input or output). Maps to a command-line argument: -weight %s.
args : a unicode string
Additional parameters to the command. Maps to a command-line argument: %s.
conform : a boolean
Conform the input volumes (brain mask typically already conformed). Maps to a command-line argument: -conform.
environ : a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’
Environment variables. (Nipype default value: {})
label_file : a pathlike object or string representing an existing file
Filename of the label volume. Maps to a command-line argument: -label %s.
mask_file : a pathlike object or string representing an existing file
Filename of the brain mask volume. Maps to a command-line argument: -mask %s.
shift : an integer (int or long)
Shift all values equal to the given value to zero. Maps to a command-line argument: -shift %d.
subjects_dir : a pathlike object or string representing an existing directory
Subjects directory.
use_weights : a boolean
Use the weights from a previously generated weight file. Maps to a command-line argument: -W.

vol_synth_file : a pathlike object or string representing an existing file weight_file : a pathlike object or string representing an existing file

OneSampleTTest

Link to code

Bases: GLMFit

Wrapped executable: mri_glmfit.

in_file : a pathlike object or string representing a file
Input 4D file. Maps to a command-line argument: --y %s.
allow_ill_cond : a boolean
Allow ill-conditioned design matrices. Maps to a command-line argument: --illcond.
allow_repeated_subjects : a boolean
Allow subject names to repeat in the fsgd file (must appear before –fsgd. Maps to a command-line argument: --allowsubjrep.
args : a unicode string
Additional parameters to the command. Maps to a command-line argument: %s.
calc_AR1 : a boolean
Compute and save temporal AR1 of residual. Maps to a command-line argument: --tar1.
check_opts : a boolean
Don’t run anything, just check options and exit. Maps to a command-line argument: --checkopts.
compute_log_y : a boolean
Compute natural log of y prior to analysis. Maps to a command-line argument: --logy.
contrast : a list of items which are a pathlike object or string representing an existing file
Contrast file. Maps to a command-line argument: --C %s....
cortex : a boolean
Use subjects ?h.cortex.label as label. Maps to a command-line argument: --cortex. Mutually exclusive with inputs: label_file.
debug : a boolean
Turn on debugging. Maps to a command-line argument: --debug.
design : a pathlike object or string representing an existing file
Design matrix file. Maps to a command-line argument: --X %s. Mutually exclusive with inputs: fsgd, design, one_sample.
diag : an integer (int or long)
Gdiag_no : set diagnositc level. Maps to a command-line argument: --diag %d.
diag_cluster : a boolean
Save sig volume and exit from first sim loop. Maps to a command-line argument: --diag-cluster.
environ : a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’
Environment variables. (Nipype default value: {})
fixed_fx_dof : an integer (int or long)
Dof for fixed effects analysis. Maps to a command-line argument: --ffxdof %d. Mutually exclusive with inputs: fixed_fx_dof_file.
fixed_fx_dof_file : a pathlike object or string representing a file
Text file with dof for fixed effects analysis. Maps to a command-line argument: --ffxdofdat %d. Mutually exclusive with inputs: fixed_fx_dof.
fixed_fx_var : a pathlike object or string representing an existing file
For fixed effects analysis. Maps to a command-line argument: --yffxvar %s.
force_perm : a boolean
Force perumtation test, even when design matrix is not orthog. Maps to a command-line argument: --perm-force.
fsgd : a tuple of the form: (a pathlike object or string representing an existing file, ‘doss’ or ‘dods’)
Freesurfer descriptor file. Maps to a command-line argument: --fsgd %s %s. Mutually exclusive with inputs: fsgd, design, one_sample.
fwhm : a floating point number >= 0.0
Smooth input by fwhm. Maps to a command-line argument: --fwhm %f.
glm_dir : a unicode string
Save outputs to dir. Maps to a command-line argument: --glmdir %s.
hemi : ‘lh’ or ‘rh’
Surface hemisphere.
invert_mask : a boolean
Invert mask. Maps to a command-line argument: --mask-inv.
label_file : a pathlike object or string representing an existing file
Use label as mask, surfaces only. Maps to a command-line argument: --label %s. Mutually exclusive with inputs: cortex.
mask_file : a pathlike object or string representing an existing file
Binary mask. Maps to a command-line argument: --mask %s.
no_contrast_ok : a boolean
Do not fail if no contrasts specified. Maps to a command-line argument: --no-contrasts-ok.
no_est_fwhm : a boolean
Turn off FWHM output estimation. Maps to a command-line argument: --no-est-fwhm.
no_mask_smooth : a boolean
Do not mask when smoothing. Maps to a command-line argument: --no-mask-smooth.
no_prune : a boolean
Do not prune. Maps to a command-line argument: --no-prune. Mutually exclusive with inputs: prunethresh.
one_sample : a boolean
Construct X and C as a one-sample group mean. Maps to a command-line argument: --osgm. Mutually exclusive with inputs: one_sample, fsgd, design, contrast.
pca : a boolean
Perform pca/svd analysis on residual. Maps to a command-line argument: --pca.
per_voxel_reg : a list of items which are a pathlike object or string representing an existing file
Per-voxel regressors. Maps to a command-line argument: --pvr %s....
profile : an integer (int or long)
Niters : test speed. Maps to a command-line argument: --profile %d.
prune : a boolean
Remove voxels that do not have a non-zero value at each frame (def). Maps to a command-line argument: --prune.
prune_thresh : a float
Prune threshold. Default is FLT_MIN. Maps to a command-line argument: --prune_thr %f. Mutually exclusive with inputs: noprune.
resynth_test : an integer (int or long)
Test GLM by resynthsis. Maps to a command-line argument: --resynthtest %d.
save_cond : a boolean
Flag to save design matrix condition at each voxel. Maps to a command-line argument: --save-cond.
save_estimate : a boolean
Save signal estimate (yhat). Maps to a command-line argument: --yhat-save.
save_res_corr_mtx : a boolean
Save residual error spatial correlation matrix (eres.scm). Big!. Maps to a command-line argument: --eres-scm.
save_residual : a boolean
Save residual error (eres). Maps to a command-line argument: --eres-save.
seed : an integer (int or long)
Used for synthesizing noise. Maps to a command-line argument: --seed %d.
self_reg : a tuple of the form: (an integer (int or long), an integer (int or long), an integer (int or long))
Self-regressor from index col row slice. Maps to a command-line argument: --selfreg %d %d %d.
sim_done_file : a pathlike object or string representing a file
Create file when simulation finished. Maps to a command-line argument: --sim-done %s.
sim_sign : ‘abs’ or ‘pos’ or ‘neg’
Abs, pos, or neg. Maps to a command-line argument: --sim-sign %s.
simulation : a tuple of the form: (‘perm’ or ‘mc-full’ or ‘mc-z’, an integer (int or long), a float, a unicode string)
Nulltype nsim thresh csdbasename. Maps to a command-line argument: --sim %s %d %f %s.
subject_id : a unicode string
Subject id for surface geometry.
subjects_dir : a pathlike object or string representing an existing directory
Subjects directory.
surf : a boolean
Analysis is on a surface mesh. Maps to a command-line argument: --surf %s %s %s. Requires inputs: subject_id, hemi.
surf_geo : a unicode string
Surface geometry name (e.g. white, pial). (Nipype default value: white)
synth : a boolean
Replace input with gaussian. Maps to a command-line argument: --synth.
uniform : a tuple of the form: (a float, a float)
Use uniform distribution instead of gaussian. Maps to a command-line argument: --uniform %f %f.
var_fwhm : a floating point number >= 0.0
Smooth variance by fwhm. Maps to a command-line argument: --var-fwhm %f.
vox_dump : a tuple of the form: (an integer (int or long), an integer (int or long), an integer (int or long))
Dump voxel GLM and exit. Maps to a command-line argument: --voxdump %d %d %d.
weight_file : a pathlike object or string representing an existing file
Weight for each input at each voxel. Mutually exclusive with inputs: weighted_ls.
weight_inv : a boolean
Invert weights. Maps to a command-line argument: --w-inv. Mutually exclusive with inputs: weighted_ls.
weight_sqrt : a boolean
Sqrt of weights. Maps to a command-line argument: --w-sqrt. Mutually exclusive with inputs: weighted_ls.
weighted_ls : a pathlike object or string representing an existing file
Weighted least squares. Maps to a command-line argument: --wls %s. Mutually exclusive with inputs: weight_file, weight_inv, weight_sqrt.
beta_file : a pathlike object or string representing an existing file
Map of regression coefficients.
dof_file : a pathlike object or string representing a file
Text file with effective degrees-of-freedom for the analysis.
error_file : a pathlike object or string representing a file
Map of residual error.
error_stddev_file : a pathlike object or string representing a file
Map of residual error standard deviation.
error_var_file : a pathlike object or string representing a file
Map of residual error variance.
estimate_file : a pathlike object or string representing a file
Map of the estimated Y values.
frame_eigenvectors : a pathlike object or string representing a file
Matrix of frame eigenvectors from residual PCA.
ftest_file : a list of items which are any value
Map of test statistic values.
fwhm_file : a pathlike object or string representing a file
Text file with estimated smoothness.
gamma_file : a list of items which are any value
Map of contrast of regression coefficients.
gamma_var_file : a list of items which are any value
Map of regression contrast variance.
glm_dir : a pathlike object or string representing an existing directory
Output directory.
mask_file : a pathlike object or string representing a file
Map of the mask used in the analysis.
sig_file : a list of items which are any value
Map of F-test significance (in -log10p).
singular_values : a pathlike object or string representing a file
Matrix singular values from residual PCA.
spatial_eigenvectors : a pathlike object or string representing a file
Map of spatial eigenvectors from residual PCA.
svd_stats_file : a pathlike object or string representing a file
Text file summarizing the residual PCA.

SegStats

Link to code

Bases: FSCommand

Wrapped executable: mri_segstats.

Use FreeSurfer mri_segstats for ROI analysis

Examples

>>> import nipype.interfaces.freesurfer as fs
>>> ss = fs.SegStats()
>>> ss.inputs.annot = ('PWS04', 'lh', 'aparc')
>>> ss.inputs.in_file = 'functional.nii'
>>> ss.inputs.subjects_dir = '.'
>>> ss.inputs.avgwf_txt_file = 'avgwf.txt'
>>> ss.inputs.summary_file = 'summary.stats'
>>> ss.cmdline
'mri_segstats --annot PWS04 lh aparc --avgwf ./avgwf.txt --i functional.nii --sum ./summary.stats'
annot : a tuple of the form: (a unicode string, ‘lh’ or ‘rh’, a unicode string)
Subject hemi parc : use surface parcellation. Maps to a command-line argument: --annot %s %s %s. Mutually exclusive with inputs: segmentation_file, annot, surf_label.
segmentation_file : a pathlike object or string representing an existing file
Segmentation volume path. Maps to a command-line argument: --seg %s. Mutually exclusive with inputs: segmentation_file, annot, surf_label.
surf_label : a tuple of the form: (a unicode string, ‘lh’ or ‘rh’, a unicode string)
Subject hemi label : use surface label. Maps to a command-line argument: --slabel %s %s %s. Mutually exclusive with inputs: segmentation_file, annot, surf_label.
args : a unicode string
Additional parameters to the command. Maps to a command-line argument: %s.
avgwf_file : a boolean or a pathlike object or string representing a file
Save as binary volume (bool or filename). Maps to a command-line argument: --avgwfvol %s.
avgwf_txt_file : a boolean or a pathlike object or string representing a file
Save average waveform into file (bool or filename). Maps to a command-line argument: --avgwf %s.
brain_vol : ‘brain-vol-from-seg’ or ‘brainmask’
Compute brain volume either with brainmask or brain-vol-from-seg. Maps to a command-line argument: --%s.
brainmask_file : a pathlike object or string representing an existing file
Load brain mask and compute the volume of the brain as the non-zero voxels in this volume. Maps to a command-line argument: --brainmask %s.
calc_power : ‘sqr’ or ‘sqrt’
Compute either the sqr or the sqrt of the input. Maps to a command-line argument: --%s.
calc_snr : a boolean
Save mean/std as extra column in output table. Maps to a command-line argument: --snr.
color_table_file : a pathlike object or string representing an existing file
Color table file with seg id names. Maps to a command-line argument: --ctab %s. Mutually exclusive with inputs: color_table_file, default_color_table, gca_color_table.
cortex_vol_from_surf : a boolean
Compute cortex volume from surf. Maps to a command-line argument: --surf-ctx-vol.
default_color_table : a boolean
Use $FREESURFER_HOME/FreeSurferColorLUT.txt. Maps to a command-line argument: --ctab-default. Mutually exclusive with inputs: color_table_file, default_color_table, gca_color_table.
empty : a boolean
Report on segmentations listed in the color table. Maps to a command-line argument: --empty.
environ : a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’
Environment variables. (Nipype default value: {})
etiv : a boolean
Compute ICV from talairach transform. Maps to a command-line argument: --etiv.
etiv_only : ‘etiv’ or ‘old-etiv’ or ‘–%s-only’
Compute etiv and exit. Use etiv or old-etiv.
euler : a boolean
Write out number of defect holes in orig.nofix based on the euler number. Maps to a command-line argument: --euler.
exclude_ctx_gm_wm : a boolean
Exclude cortical gray and white matter. Maps to a command-line argument: --excl-ctxgmwm.
exclude_id : an integer (int or long)
Exclude seg id from report. Maps to a command-line argument: --excludeid %d.
frame : an integer (int or long)
Report stats on nth frame of input volume. Maps to a command-line argument: --frame %d.
gca_color_table : a pathlike object or string representing an existing file
Get color table from GCA (CMA). Maps to a command-line argument: --ctab-gca %s. Mutually exclusive with inputs: color_table_file, default_color_table, gca_color_table.
in_file : a pathlike object or string representing an existing file
Use the segmentation to report stats on this volume. Maps to a command-line argument: --i %s.
in_intensity : a pathlike object or string representing a file
Undocumented input norm.mgz file. Maps to a command-line argument: --in %s --in-intensity-name %s.
intensity_units : ‘MR’
Intensity units. Maps to a command-line argument: --in-intensity-units %s. Requires inputs: in_intensity.
mask_erode : an integer (int or long)
Erode mask by some amount. Maps to a command-line argument: --maskerode %d.
mask_file : a pathlike object or string representing an existing file
Mask volume (same size as seg. Maps to a command-line argument: --mask %s.
mask_frame : an integer (int or long)
Mask with this (0 based) frame of the mask volume. Requires inputs: mask_file.
mask_invert : a boolean
Invert binarized mask volume. Maps to a command-line argument: --maskinvert.
mask_sign : ‘abs’ or ‘pos’ or ‘neg’ or ‘–masksign %s’
Sign for mask threshold: pos, neg, or abs.
mask_thresh : a float
Binarize mask with this threshold <0.5>. Maps to a command-line argument: --maskthresh %f.
multiply : a float
Multiply input by val. Maps to a command-line argument: --mul %f.
non_empty_only : a boolean
Only report nonempty segmentations. Maps to a command-line argument: --nonempty.
partial_volume_file : a pathlike object or string representing an existing file
Compensate for partial voluming. Maps to a command-line argument: --pv %s.
segment_id : a list of items which are any value
Manually specify segmentation ids. Maps to a command-line argument: --id %s....
sf_avg_file : a boolean or a pathlike object or string representing a file
Save mean across space and time. Maps to a command-line argument: --sfavg %s.
subcort_gm : a boolean
Compute volume of subcortical gray matter. Maps to a command-line argument: --subcortgray.
subjects_dir : a pathlike object or string representing an existing directory
Subjects directory.
summary_file : a pathlike object or string representing a file
Segmentation stats summary table file. Maps to a command-line argument: --sum %s (position: -1).
supratent : a boolean
Undocumented input flag. Maps to a command-line argument: --supratent.
total_gray : a boolean
Compute volume of total gray matter. Maps to a command-line argument: --totalgray.
vox : a list of items which are an integer (int or long)
Replace seg with all 0s except at C R S (three int inputs). Maps to a command-line argument: --vox %s.
wm_vol_from_surf : a boolean
Compute wm volume from surf. Maps to a command-line argument: --surf-wm-vol.
avgwf_file : a pathlike object or string representing a file
Volume with functional statistics averaged over segs.
avgwf_txt_file : a pathlike object or string representing a file
Text file with functional statistics averaged over segs.
sf_avg_file : a pathlike object or string representing a file
Text file with func statistics averaged over segs and framss.
summary_file : a pathlike object or string representing an existing file
Segmentation summary statistics table.

SegStatsReconAll

Link to code

Bases: SegStats

Wrapped executable: mri_segstats.

This class inherits SegStats and modifies it for use in a recon-all workflow. This implementation mandates implicit inputs that SegStats. To ensure backwards compatability of SegStats, this class was created.

Examples

>>> from nipype.interfaces.freesurfer import SegStatsReconAll
>>> segstatsreconall = SegStatsReconAll()
>>> segstatsreconall.inputs.annot = ('PWS04', 'lh', 'aparc')
>>> segstatsreconall.inputs.avgwf_txt_file = 'avgwf.txt'
>>> segstatsreconall.inputs.summary_file = 'summary.stats'
>>> segstatsreconall.inputs.subject_id = '10335'
>>> segstatsreconall.inputs.ribbon = 'wm.mgz'
>>> segstatsreconall.inputs.transform = 'trans.mat'
>>> segstatsreconall.inputs.presurf_seg = 'wm.mgz'
>>> segstatsreconall.inputs.lh_orig_nofix = 'lh.pial'
>>> segstatsreconall.inputs.rh_orig_nofix = 'lh.pial'
>>> segstatsreconall.inputs.lh_pial = 'lh.pial'
>>> segstatsreconall.inputs.rh_pial = 'lh.pial'
>>> segstatsreconall.inputs.lh_white = 'lh.pial'
>>> segstatsreconall.inputs.rh_white = 'lh.pial'
>>> segstatsreconall.inputs.empty = True
>>> segstatsreconall.inputs.brain_vol = 'brain-vol-from-seg'
>>> segstatsreconall.inputs.exclude_ctx_gm_wm = True
>>> segstatsreconall.inputs.supratent = True
>>> segstatsreconall.inputs.subcort_gm = True
>>> segstatsreconall.inputs.etiv = True
>>> segstatsreconall.inputs.wm_vol_from_surf = True
>>> segstatsreconall.inputs.cortex_vol_from_surf = True
>>> segstatsreconall.inputs.total_gray = True
>>> segstatsreconall.inputs.euler = True
>>> segstatsreconall.inputs.exclude_id = 0
>>> segstatsreconall.cmdline
'mri_segstats --annot PWS04 lh aparc --avgwf ./avgwf.txt --brain-vol-from-seg --surf-ctx-vol --empty --etiv --euler --excl-ctxgmwm --excludeid 0 --subcortgray --subject 10335 --supratent --totalgray --surf-wm-vol --sum ./summary.stats'
annot : a tuple of the form: (a unicode string, ‘lh’ or ‘rh’, a unicode string)
Subject hemi parc : use surface parcellation. Maps to a command-line argument: --annot %s %s %s. Mutually exclusive with inputs: segmentation_file, annot, surf_label.
lh_orig_nofix : a pathlike object or string representing an existing file
Input lh.orig.nofix.
lh_pial : a pathlike object or string representing an existing file
Input file must be <subject_id>/surf/lh.pial.
lh_white : a pathlike object or string representing an existing file
Input file must be <subject_id>/surf/lh.white.
rh_orig_nofix : a pathlike object or string representing an existing file
Input rh.orig.nofix.
rh_pial : a pathlike object or string representing an existing file
Input file must be <subject_id>/surf/rh.pial.
rh_white : a pathlike object or string representing an existing file
Input file must be <subject_id>/surf/rh.white.
ribbon : a pathlike object or string representing an existing file
Input file mri/ribbon.mgz.
segmentation_file : a pathlike object or string representing an existing file
Segmentation volume path. Maps to a command-line argument: --seg %s. Mutually exclusive with inputs: segmentation_file, annot, surf_label.
subject_id : a string
Subject id being processed. Maps to a command-line argument: --subject %s. (Nipype default value: subject_id)
surf_label : a tuple of the form: (a unicode string, ‘lh’ or ‘rh’, a unicode string)
Subject hemi label : use surface label. Maps to a command-line argument: --slabel %s %s %s. Mutually exclusive with inputs: segmentation_file, annot, surf_label.
transform : a pathlike object or string representing an existing file
Input transform file.
args : a unicode string
Additional parameters to the command. Maps to a command-line argument: %s.
aseg : a pathlike object or string representing an existing file
Mandatory implicit input in 5.3.
avgwf_file : a boolean or a pathlike object or string representing a file
Save as binary volume (bool or filename). Maps to a command-line argument: --avgwfvol %s.
avgwf_txt_file : a boolean or a pathlike object or string representing a file
Save average waveform into file (bool or filename). Maps to a command-line argument: --avgwf %s.
brain_vol : ‘brain-vol-from-seg’ or ‘brainmask’
Compute brain volume either with brainmask or brain-vol-from-seg. Maps to a command-line argument: --%s.
brainmask_file : a pathlike object or string representing an existing file
Load brain mask and compute the volume of the brain as the non-zero voxels in this volume. Maps to a command-line argument: --brainmask %s.
calc_power : ‘sqr’ or ‘sqrt’
Compute either the sqr or the sqrt of the input. Maps to a command-line argument: --%s.
calc_snr : a boolean
Save mean/std as extra column in output table. Maps to a command-line argument: --snr.
color_table_file : a pathlike object or string representing an existing file
Color table file with seg id names. Maps to a command-line argument: --ctab %s. Mutually exclusive with inputs: color_table_file, default_color_table, gca_color_table.
copy_inputs : a boolean
If running as a node, set this to True otherwise, this will copy the implicit inputs to the node directory.
cortex_vol_from_surf : a boolean
Compute cortex volume from surf. Maps to a command-line argument: --surf-ctx-vol.
default_color_table : a boolean
Use $FREESURFER_HOME/FreeSurferColorLUT.txt. Maps to a command-line argument: --ctab-default. Mutually exclusive with inputs: color_table_file, default_color_table, gca_color_table.
empty : a boolean
Report on segmentations listed in the color table. Maps to a command-line argument: --empty.
environ : a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’
Environment variables. (Nipype default value: {})
etiv : a boolean
Compute ICV from talairach transform. Maps to a command-line argument: --etiv.
etiv_only : ‘etiv’ or ‘old-etiv’ or ‘–%s-only’
Compute etiv and exit. Use etiv or old-etiv.
euler : a boolean
Write out number of defect holes in orig.nofix based on the euler number. Maps to a command-line argument: --euler.
exclude_ctx_gm_wm : a boolean
Exclude cortical gray and white matter. Maps to a command-line argument: --excl-ctxgmwm.
exclude_id : an integer (int or long)
Exclude seg id from report. Maps to a command-line argument: --excludeid %d.
frame : an integer (int or long)
Report stats on nth frame of input volume. Maps to a command-line argument: --frame %d.
gca_color_table : a pathlike object or string representing an existing file
Get color table from GCA (CMA). Maps to a command-line argument: --ctab-gca %s. Mutually exclusive with inputs: color_table_file, default_color_table, gca_color_table.
in_file : a pathlike object or string representing an existing file
Use the segmentation to report stats on this volume. Maps to a command-line argument: --i %s.
in_intensity : a pathlike object or string representing a file
Undocumented input norm.mgz file. Maps to a command-line argument: --in %s --in-intensity-name %s.
intensity_units : ‘MR’
Intensity units. Maps to a command-line argument: --in-intensity-units %s. Requires inputs: in_intensity.
mask_erode : an integer (int or long)
Erode mask by some amount. Maps to a command-line argument: --maskerode %d.
mask_file : a pathlike object or string representing an existing file
Mask volume (same size as seg. Maps to a command-line argument: --mask %s.
mask_frame : an integer (int or long)
Mask with this (0 based) frame of the mask volume. Requires inputs: mask_file.
mask_invert : a boolean
Invert binarized mask volume. Maps to a command-line argument: --maskinvert.
mask_sign : ‘abs’ or ‘pos’ or ‘neg’ or ‘–masksign %s’
Sign for mask threshold: pos, neg, or abs.
mask_thresh : a float
Binarize mask with this threshold <0.5>. Maps to a command-line argument: --maskthresh %f.
multiply : a float
Multiply input by val. Maps to a command-line argument: --mul %f.
non_empty_only : a boolean
Only report nonempty segmentations. Maps to a command-line argument: --nonempty.
partial_volume_file : a pathlike object or string representing an existing file
Compensate for partial voluming. Maps to a command-line argument: --pv %s.
presurf_seg : a pathlike object or string representing an existing file
Input segmentation volume.
segment_id : a list of items which are any value
Manually specify segmentation ids. Maps to a command-line argument: --id %s....
sf_avg_file : a boolean or a pathlike object or string representing a file
Save mean across space and time. Maps to a command-line argument: --sfavg %s.
subcort_gm : a boolean
Compute volume of subcortical gray matter. Maps to a command-line argument: --subcortgray.
subjects_dir : a pathlike object or string representing an existing directory
Subjects directory.
summary_file : a pathlike object or string representing a file
Segmentation stats summary table file. Maps to a command-line argument: --sum %s (position: -1).
supratent : a boolean
Undocumented input flag. Maps to a command-line argument: --supratent.
total_gray : a boolean
Compute volume of total gray matter. Maps to a command-line argument: --totalgray.
vox : a list of items which are an integer (int or long)
Replace seg with all 0s except at C R S (three int inputs). Maps to a command-line argument: --vox %s.
wm_vol_from_surf : a boolean
Compute wm volume from surf. Maps to a command-line argument: --surf-wm-vol.
avgwf_file : a pathlike object or string representing a file
Volume with functional statistics averaged over segs.
avgwf_txt_file : a pathlike object or string representing a file
Text file with functional statistics averaged over segs.
sf_avg_file : a pathlike object or string representing a file
Text file with func statistics averaged over segs and framss.
summary_file : a pathlike object or string representing an existing file
Segmentation summary statistics table.
SegStatsReconAll.run(**inputs)

Execute this interface.

This interface will not raise an exception if runtime.returncode is non-zero.

Parameters:
  • cwd (specify a folder where the interface should be run) –
  • inputs (allows the interface settings to be updated) –
Returns:

results – A copy of the instance that was executed, provenance information and, if successful, results

Return type:

nipype.interfaces.base.support.InterfaceResult

SphericalAverage

Link to code

Bases: FSCommand

Wrapped executable: mris_spherical_average.

This program will add a template into an average surface.

Examples

>>> from nipype.interfaces.freesurfer import SphericalAverage
>>> sphericalavg = SphericalAverage()
>>> sphericalavg.inputs.out_file = 'test.out'
>>> sphericalavg.inputs.in_average = '.'
>>> sphericalavg.inputs.in_surf = 'lh.pial'
>>> sphericalavg.inputs.hemisphere = 'lh'
>>> sphericalavg.inputs.fname = 'lh.entorhinal'
>>> sphericalavg.inputs.which = 'label'
>>> sphericalavg.inputs.subject_id = '10335'
>>> sphericalavg.inputs.erode = 2
>>> sphericalavg.inputs.threshold = 5
>>> sphericalavg.cmdline
'mris_spherical_average -erode 2 -o 10335 -t 5.0 label lh.entorhinal lh pial . test.out'
fname : a string
Filename from the average subject directory. Example: to use rh.entorhinal.label as the input label filename, set fname to ‘rh.entorhinal’ and which to ‘label’. The program will then search for <in_average>/label/rh.entorhinal.label. Maps to a command-line argument: %s (position: -5).
hemisphere : ‘lh’ or ‘rh’
Input hemisphere. Maps to a command-line argument: %s (position: -4).
in_surf : a pathlike object or string representing an existing file
Input surface file. Maps to a command-line argument: %s (position: -3).
subject_id : a string
Output subject id. Maps to a command-line argument: -o %s.
which : ‘coords’ or ‘label’ or ‘vals’ or ‘curv’ or ‘area’
No documentation. Maps to a command-line argument: %s (position: -6).
args : a unicode string
Additional parameters to the command. Maps to a command-line argument: %s.
environ : a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’
Environment variables. (Nipype default value: {})
erode : an integer (int or long)
Undocumented. Maps to a command-line argument: -erode %d.
in_average : a pathlike object or string representing an existing directory
Average subject. Maps to a command-line argument: %s (position: -2).
in_orig : a pathlike object or string representing an existing file
Original surface filename. Maps to a command-line argument: -orig %s.
out_file : a pathlike object or string representing a file
Output filename. Maps to a command-line argument: %s (position: -1).
subjects_dir : a pathlike object or string representing an existing directory
Subjects directory.
threshold : a float
Undocumented. Maps to a command-line argument: -t %.1f.
out_file : a pathlike object or string representing a file
Output label.