nipype.interfaces.freesurfer.utils module

Interfaces to assorted Freesurfer utility programs.

AddXFormToHeader

Link to code

Bases: FSCommand

Wrapped executable: mri_add_xform_to_header.

Just adds specified xform to the volume header.

Danger

Input transform MUST be an absolute path to a DataSink’ed transform or the output will reference a transform in the workflow cache directory!

Examples

>>> from nipype.interfaces.freesurfer import AddXFormToHeader
>>> adder = AddXFormToHeader()
>>> adder.inputs.in_file = 'norm.mgz'
>>> adder.inputs.transform = 'trans.mat'
>>> adder.cmdline
'mri_add_xform_to_header trans.mat norm.mgz output.mgz'
>>> adder.inputs.copy_name = True
>>> adder.cmdline
'mri_add_xform_to_header -c trans.mat norm.mgz output.mgz'
>>> adder.run()   

References

[https://surfer.nmr.mgh.harvard.edu/fswiki/mri_add_xform_to_header]

in_filea pathlike object or string representing an existing file

Input volume. Maps to a command-line argument: %s (position: -2).

transforma pathlike object or string representing a file

Xfm file. Maps to a command-line argument: %s (position: -3).

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

copy_namea boolean

Do not try to load the xfmfile, just copy name. Maps to a command-line argument: -c.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

out_filea pathlike object or string representing a file

Output volume. Maps to a command-line argument: %s (position: -1). (Nipype default value: output.mgz)

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

verbosea boolean

Be verbose. Maps to a command-line argument: -v.

out_filea pathlike object or string representing an existing file

Output volume.

Aparc2Aseg

Link to code

Bases: FSCommand

Wrapped executable: mri_aparc2aseg.

Maps the cortical labels from the automatic cortical parcellation (aparc) to the automatic segmentation volume (aseg). The result can be used as the aseg would. The algorithm is to find each aseg voxel labeled as cortex (3 and 42) and assign it the label of the closest cortical vertex. If the voxel is not in the ribbon (as defined by mri/ lh.ribbon and rh.ribbon), then the voxel is marked as unknown (0). This can be turned off with --noribbon. The cortical parcellation is obtained from subject/label/hemi.aparc.annot which should be based on the curvature.buckner40.filled.desikan_killiany.gcs atlas. The aseg is obtained from subject/mri/aseg.mgz and should be based on the RB40_talairach_2005-07-20.gca atlas. If these atlases are used, then the segmentations can be viewed with tkmedit and the FreeSurferColorLUT.txt color table found in $FREESURFER_HOME. These are the default atlases used by recon-all.

Examples

>>> from nipype.interfaces.freesurfer import Aparc2Aseg
>>> aparc2aseg = Aparc2Aseg()
>>> aparc2aseg.inputs.lh_white = 'lh.pial'
>>> aparc2aseg.inputs.rh_white = 'lh.pial'
>>> aparc2aseg.inputs.lh_pial = 'lh.pial'
>>> aparc2aseg.inputs.rh_pial = 'lh.pial'
>>> aparc2aseg.inputs.lh_ribbon = 'label.mgz'
>>> aparc2aseg.inputs.rh_ribbon = 'label.mgz'
>>> aparc2aseg.inputs.ribbon = 'label.mgz'
>>> aparc2aseg.inputs.lh_annotation = 'lh.pial'
>>> aparc2aseg.inputs.rh_annotation = 'lh.pial'
>>> aparc2aseg.inputs.out_file = 'aparc+aseg.mgz'
>>> aparc2aseg.inputs.label_wm = True
>>> aparc2aseg.inputs.rip_unknown = True
>>> aparc2aseg.cmdline 
'mri_aparc2aseg --labelwm  --o aparc+aseg.mgz --rip-unknown --s subject_id'
lh_annotationa pathlike object or string representing an existing file

Input file must be <subject_id>/label/lh.aparc.annot.

lh_piala pathlike object or string representing an existing file

Input file must be <subject_id>/surf/lh.pial.

lh_ribbona pathlike object or string representing an existing file

Input file must be <subject_id>/mri/lh.ribbon.mgz.

lh_whitea pathlike object or string representing an existing file

Input file must be <subject_id>/surf/lh.white.

out_filea pathlike object or string representing a file

Full path of file to save the output segmentation in. Maps to a command-line argument: --o %s.

rh_annotationa pathlike object or string representing an existing file

Input file must be <subject_id>/label/rh.aparc.annot.

rh_piala pathlike object or string representing an existing file

Input file must be <subject_id>/surf/rh.pial.

rh_ribbona pathlike object or string representing an existing file

Input file must be <subject_id>/mri/rh.ribbon.mgz.

rh_whitea pathlike object or string representing an existing file

Input file must be <subject_id>/surf/rh.white.

ribbona pathlike object or string representing an existing file

Input file must be <subject_id>/mri/ribbon.mgz.

subject_ida string

Subject being processed. Maps to a command-line argument: --s %s. (Nipype default value: subject_id)

a2009sa boolean

Using the a2009s atlas. Maps to a command-line argument: --a2009s.

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

asega pathlike object or string representing an existing file

Input aseg file. Maps to a command-line argument: --aseg %s.

copy_inputsa boolean

If running as a node, set this to True.This will copy the input files to the node directory.

ctxsega pathlike object or string representing an existing file

Maps to a command-line argument: --ctxseg %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

filleda pathlike object or string representing an existing file

Implicit input filled file. Only required with FS v5.3.

hypo_wma boolean

Label hypointensities as WM. Maps to a command-line argument: --hypo-as-wm.

label_wma boolean

For each voxel labeled as white matter in the aseg, re-assign its label to be that of the closest cortical point if its distance is less than dmaxctx. Maps to a command-line argument: --labelwm.

rip_unknowna boolean

Do not label WM based on ‘unknown’ corical label. Maps to a command-line argument: --rip-unknown.

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

volmaska boolean

Volume mask flag. Maps to a command-line argument: --volmask.

out_filea pathlike object or string representing a file

Output aseg file. Maps to a command-line argument: %s.

Aparc2Aseg.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

Apas2Aseg

Link to code

Bases: FSCommand

Wrapped executable: apas2aseg.

Converts aparc+aseg.mgz into something like aseg.mgz by replacing the cortical segmentations 1000-1035 with 3 and 2000-2035 with 42. The advantage of this output is that the cortical label conforms to the actual surface (this is not the case with aseg.mgz).

Examples

>>> from nipype.interfaces.freesurfer import Apas2Aseg
>>> apas2aseg = Apas2Aseg()
>>> apas2aseg.inputs.in_file = 'aseg.mgz'
>>> apas2aseg.inputs.out_file = 'output.mgz'
>>> apas2aseg.cmdline
'apas2aseg --i aseg.mgz --o output.mgz'
in_filea pathlike object or string representing an existing file

Input aparc+aseg.mgz. Maps to a command-line argument: --i %s.

out_filea pathlike object or string representing a file

Output aseg file. Maps to a command-line argument: --o %s.

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

out_filea pathlike object or string representing a file

Output aseg file. Maps to a command-line argument: %s.

ApplyMask

Link to code

Bases: FSCommand

Wrapped executable: mri_mask.

Use Freesurfer’s mri_mask to apply a mask to an image.

The mask file need not be binarized; it can be thresholded above a given value before application. It can also optionally be transformed into input space with an LTA matrix.

in_filea pathlike object or string representing an existing file

Input image (will be masked). Maps to a command-line argument: %s (position: -3).

mask_filea pathlike object or string representing an existing file

Image defining mask space. Maps to a command-line argument: %s (position: -2).

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

invert_xfma boolean

Invert transformation. Maps to a command-line argument: -invert.

keep_mask_deletion_editsa boolean

Transfer voxel-deletion edits (voxels=1) from mask to out vol. Maps to a command-line argument: -keep_mask_deletion_edits.

mask_thresha float

Threshold mask before applying. Maps to a command-line argument: -T %.4f.

out_filea pathlike object or string representing a file

Final image to write. Maps to a command-line argument: %s (position: -1).

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

transferan integer

Transfer only voxel value # from mask to out. Maps to a command-line argument: -transfer %d.

use_absa boolean

Take absolute value of mask before applying. Maps to a command-line argument: -abs.

xfm_filea pathlike object or string representing an existing file

LTA-format transformation matrix to align mask with input. Maps to a command-line argument: -xform %s.

xfm_sourcea pathlike object or string representing an existing file

Image defining transform source space. Maps to a command-line argument: -lta_src %s.

xfm_targeta pathlike object or string representing an existing file

Image defining transform target space. Maps to a command-line argument: -lta_dst %s.

out_filea pathlike object or string representing an existing file

Masked image.

CheckTalairachAlignment

Link to code

Bases: FSCommand

Wrapped executable: talairach_afd.

This program detects Talairach alignment failures

Examples

>>> from nipype.interfaces.freesurfer import CheckTalairachAlignment
>>> checker = CheckTalairachAlignment()
>>> checker.inputs.in_file = 'trans.mat'
>>> checker.inputs.threshold = 0.005
>>> checker.cmdline
'talairach_afd -T 0.005 -xfm trans.mat'
>>> checker.run() 
in_filea pathlike object or string representing an existing file

Specify the talairach.xfm file to check. Maps to a command-line argument: -xfm %s (position: -1). Mutually exclusive with inputs: subject.

subjecta string

Specify subject’s name. Maps to a command-line argument: -subj %s (position: -1). Mutually exclusive with inputs: in_file.

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

thresholda float

Talairach transforms for subjects with p-values <= T are considered as very unlikely default=0.010. Maps to a command-line argument: -T %.3f. (Nipype default value: 0.01)

out_filea pathlike object or string representing an existing file

The input file for CheckTalairachAlignment.

Contrast

Link to code

Bases: FSCommand

Wrapped executable: pctsurfcon.

Compute surface-wise gray/white contrast

Examples

>>> from nipype.interfaces.freesurfer import Contrast
>>> contrast = Contrast()
>>> contrast.inputs.subject_id = '10335'
>>> contrast.inputs.hemisphere = 'lh'
>>> contrast.inputs.white = 'lh.white' 
>>> contrast.inputs.thickness = 'lh.thickness' 
>>> contrast.inputs.annotation = '../label/lh.aparc.annot' 
>>> contrast.inputs.cortex = '../label/lh.cortex.label' 
>>> contrast.inputs.rawavg = '../mri/rawavg.mgz' 
>>> contrast.inputs.orig = '../mri/orig.mgz' 
>>> contrast.cmdline 
'pctsurfcon --lh-only --s 10335'
annotationa pathlike object or string representing an existing file

Input annotation file must be <subject_id>/label/<hemisphere>.aparc.annot.

cortexa pathlike object or string representing an existing file

Input cortex label must be <subject_id>/label/<hemisphere>.cortex.label.

hemisphere‘lh’ or ‘rh’

Hemisphere being processed. Maps to a command-line argument: --%s-only.

origa pathlike object or string representing an existing file

Implicit input file mri/orig.mgz.

rawavga pathlike object or string representing an existing file

Implicit input file mri/rawavg.mgz.

subject_ida string

Subject being processed. Maps to a command-line argument: --s %s. (Nipype default value: subject_id)

thicknessa pathlike object or string representing an existing file

Input file must be <subject_id>/surf/?h.thickness.

whitea pathlike object or string representing an existing file

Input file must be <subject_id>/surf/<hemisphere>.white.

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

copy_inputsa boolean

If running as a node, set this to True. This will copy the input files to the node directory.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

out_contrasta pathlike object or string representing a file

Output contrast file from Contrast.

out_loga pathlike object or string representing an existing file

Output log from Contrast.

out_statsa pathlike object or string representing a file

Output stats file from Contrast.

Contrast.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

Curvature

Link to code

Bases: FSCommand

Wrapped executable: mris_curvature.

This program will compute the second fundamental form of a cortical surface. It will create two new files <hemi>.<surface>.H and <hemi>.<surface>.K with the mean and Gaussian curvature respectively.

Examples

>>> from nipype.interfaces.freesurfer import Curvature
>>> curv = Curvature()
>>> curv.inputs.in_file = 'lh.pial'
>>> curv.inputs.save = True
>>> curv.cmdline
'mris_curvature -w lh.pial'
in_filea pathlike object or string representing an existing file

Input file for Curvature. Maps to a command-line argument: %s (position: -2).

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

averagesan integer

Perform this number iterative averages of curvature measure before saving. Maps to a command-line argument: -a %d.

copy_inputa boolean

Copy input file to current directory.

distancesa tuple of the form: (an integer, an integer)

Undocumented input integer distances. Maps to a command-line argument: -distances %d %d.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

na boolean

Undocumented boolean flag. Maps to a command-line argument: -n.

savea boolean

Save curvature files (will only generate screen output without this option). Maps to a command-line argument: -w.

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

thresholda float

Undocumented input threshold. Maps to a command-line argument: -thresh %.3f.

out_gaussa pathlike object or string representing a file

Gaussian curvature output file.

out_meana pathlike object or string representing a file

Mean curvature output file.

CurvatureStats

Link to code

Bases: FSCommand

Wrapped executable: mris_curvature_stats.

In its simplest usage, ‘mris_curvature_stats’ will compute a set of statistics on its input <curvFile>. These statistics are the mean and standard deviation of the particular curvature on the surface, as well as the results from several surface-based integrals.

Additionally, ‘mris_curvature_stats’ can report the max/min curvature values, and compute a simple histogram based on all curvature values.

Curvatures can also be normalised and constrained to a given range before computation.

Principal curvature (K, H, k1 and k2) calculations on a surface structure can also be performed, as well as several functions derived from k1 and k2.

Finally, all output to the console, as well as any new curvatures that result from the above calculations can be saved to a series of text and binary-curvature files.

Examples

>>> from nipype.interfaces.freesurfer import CurvatureStats
>>> curvstats = CurvatureStats()
>>> curvstats.inputs.hemisphere = 'lh'
>>> curvstats.inputs.curvfile1 = 'lh.pial'
>>> curvstats.inputs.curvfile2 = 'lh.pial'
>>> curvstats.inputs.surface = 'lh.pial'
>>> curvstats.inputs.out_file = 'lh.curv.stats'
>>> curvstats.inputs.values = True
>>> curvstats.inputs.min_max = True
>>> curvstats.inputs.write = True
>>> curvstats.cmdline
'mris_curvature_stats -m -o lh.curv.stats -F pial -G --writeCurvatureFiles subject_id lh pial pial'
curvfile1a pathlike object or string representing an existing file

Input file for CurvatureStats. Maps to a command-line argument: %s (position: -2).

curvfile2a pathlike object or string representing an existing file

Input file for CurvatureStats. Maps to a command-line argument: %s (position: -1).

hemisphere‘lh’ or ‘rh’

Hemisphere being processed. Maps to a command-line argument: %s (position: -3).

subject_ida string

Subject being processed. Maps to a command-line argument: %s (position: -4). (Nipype default value: subject_id)

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

copy_inputsa boolean

If running as a node, set this to True. This will copy the input files to the node directory.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

min_maxa boolean

Output min / max information for the processed curvature. Maps to a command-line argument: -m.

out_filea pathlike object or string representing a file

Output curvature stats file. Maps to a command-line argument: -o %s.

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

surfacea pathlike object or string representing an existing file

Specify surface file for CurvatureStats. Maps to a command-line argument: -F %s.

valuesa boolean

Triggers a series of derived curvature values. Maps to a command-line argument: -G.

writea boolean

Write curvature files. Maps to a command-line argument: --writeCurvatureFiles.

out_filea pathlike object or string representing a file

Output curvature stats file.

CurvatureStats.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

EulerNumber

Link to code

Bases: FSCommand

Wrapped executable: mris_euler_number.

This program computes EulerNumber for a cortical surface

Examples

>>> from nipype.interfaces.freesurfer import EulerNumber
>>> ft = EulerNumber()
>>> ft.inputs.in_file = 'lh.pial'
>>> ft.cmdline
'mris_euler_number lh.pial'
in_filea pathlike object or string representing an existing file

Input file for EulerNumber. Maps to a command-line argument: %s (position: -1).

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

defectsan integer

Number of defects.

euleran integer

Euler number of cortical surface. A value of 2 signals a topologically correct surface model with no holes.

ExtractMainComponent

Link to code

Bases: CommandLine

Wrapped executable: mris_extract_main_component.

Extract the main component of a tessellated surface

Examples

>>> from nipype.interfaces.freesurfer import ExtractMainComponent
>>> mcmp = ExtractMainComponent(in_file='lh.pial')
>>> mcmp.cmdline
'mris_extract_main_component lh.pial lh.maincmp'
in_filea pathlike object or string representing an existing file

Input surface file. Maps to a command-line argument: %s (position: 1).

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

out_filea pathlike object or string representing a file

Surface containing main component. Maps to a command-line argument: %s (position: 2).

out_filea pathlike object or string representing an existing file

Surface containing main component.

FixTopology

Link to code

Bases: FSCommand

Wrapped executable: mris_fix_topology.

This program computes a mapping from the unit sphere onto the surface of the cortex from a previously generated approximation of the cortical surface, thus guaranteeing a topologically correct surface.

Examples

>>> from nipype.interfaces.freesurfer import FixTopology
>>> ft = FixTopology()
>>> ft.inputs.in_orig = 'lh.orig' 
>>> ft.inputs.in_inflated = 'lh.inflated' 
>>> ft.inputs.sphere = 'lh.qsphere.nofix' 
>>> ft.inputs.hemisphere = 'lh'
>>> ft.inputs.subject_id = '10335'
>>> ft.inputs.mgz = True
>>> ft.inputs.ga = True
>>> ft.cmdline 
'mris_fix_topology -ga -mgz -sphere qsphere.nofix 10335 lh'
copy_inputsa boolean

If running as a node, set this to True otherwise, the topology fixing will be done in place.

hemispherea string

Hemisphere being processed. Maps to a command-line argument: %s (position: -1).

in_braina pathlike object or string representing an existing file

Implicit input brain.mgz.

in_inflateda pathlike object or string representing an existing file

Undocumented input file <hemisphere>.inflated.

in_origa pathlike object or string representing an existing file

Undocumented input file <hemisphere>.orig.

in_wma pathlike object or string representing an existing file

Implicit input wm.mgz.

subject_ida string

Subject being processed. Maps to a command-line argument: %s (position: -2). (Nipype default value: subject_id)

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

gaa boolean

No documentation. Direct questions to analysis-bugs@nmr.mgh.harvard.edu. Maps to a command-line argument: -ga.

mgza boolean

No documentation. Direct questions to analysis-bugs@nmr.mgh.harvard.edu. Maps to a command-line argument: -mgz.

seedan integer

Seed for setting random number generator. Maps to a command-line argument: -seed %d.

spherea pathlike object or string representing a file

Sphere input file. Maps to a command-line argument: -sphere %s.

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

out_filea pathlike object or string representing a file

Output file for FixTopology.

FixTopology.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

ImageInfo

Link to code

Bases: FSCommand

Wrapped executable: mri_info.

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

in_filea pathlike object or string representing an existing file

Image to query. Maps to a command-line argument: %s (position: 1).

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

TEa string

Echo time (msec).

TIa string

Inversion time (msec).

TRa string

Repetition time(msec).

data_typea string

Image data type.

dimensionsa tuple

Image dimensions (voxels).

file_formata string

File format.

infoany value

Output of mri_info.

orientationa string

Image orientation.

out_filea pathlike object or string representing an existing file

Text file with image information.

ph_enc_dira string

Phase encode direction.

vox_sizesa tuple

Voxel sizes (mm).

ImageInfo.aggregate_outputs(runtime=None, needed_outputs=None)

Collate expected outputs and apply output traits validation.

ImageInfo.info_regexp(info, field, delim='\n')

Jacobian

Link to code

Bases: FSCommand

Wrapped executable: mris_jacobian.

This program computes the Jacobian of a surface mapping.

Examples

>>> from nipype.interfaces.freesurfer import Jacobian
>>> jacobian = Jacobian()
>>> jacobian.inputs.in_origsurf = 'lh.pial'
>>> jacobian.inputs.in_mappedsurf = 'lh.pial'
>>> jacobian.cmdline
'mris_jacobian lh.pial lh.pial lh.jacobian'
in_mappedsurfa pathlike object or string representing an existing file

Mapped surface. Maps to a command-line argument: %s (position: -2).

in_origsurfa pathlike object or string representing an existing file

Original surface. Maps to a command-line argument: %s (position: -3).

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

out_filea pathlike object or string representing a file

Output Jacobian of the surface mapping. Maps to a command-line argument: %s (position: -1).

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

out_filea pathlike object or string representing a file

Output Jacobian of the surface mapping.

LTAConvert

Link to code

Bases: CommandLine

Wrapped executable: lta_convert.

Convert different transformation formats. Some formats may require you to pass an image if the geometry information is missing form the transform file format.

For complete details, see the lta_convert documentation.

in_fsla pathlike object or string representing an existing file

Input transform of FSL type. Maps to a command-line argument: --infsl %s. Mutually exclusive with inputs: in_lta, in_fsl, in_mni, in_reg, in_niftyreg, in_itk.

in_itka pathlike object or string representing an existing file

Input transform of ITK type. Maps to a command-line argument: --initk %s. Mutually exclusive with inputs: in_lta, in_fsl, in_mni, in_reg, in_niftyreg, in_itk.

in_ltaa pathlike object or string representing an existing file or ‘identity.nofile’

Input transform of LTA type. Maps to a command-line argument: --inlta %s. Mutually exclusive with inputs: in_lta, in_fsl, in_mni, in_reg, in_niftyreg, in_itk.

in_mnia pathlike object or string representing an existing file

Input transform of MNI/XFM type. Maps to a command-line argument: --inmni %s. Mutually exclusive with inputs: in_lta, in_fsl, in_mni, in_reg, in_niftyreg, in_itk.

in_niftyrega pathlike object or string representing an existing file

Input transform of Nifty Reg type (inverse RAS2RAS). Maps to a command-line argument: --inniftyreg %s. Mutually exclusive with inputs: in_lta, in_fsl, in_mni, in_reg, in_niftyreg, in_itk.

in_rega pathlike object or string representing an existing file

Input transform of TK REG type (deprecated format). Maps to a command-line argument: --inreg %s. Mutually exclusive with inputs: in_lta, in_fsl, in_mni, in_reg, in_niftyreg, in_itk.

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

inverta boolean

Maps to a command-line argument: --invert.

ltavox2voxa boolean

Maps to a command-line argument: --ltavox2vox. Requires inputs: out_lta.

out_fsla boolean or a pathlike object or string representing a file

Output transform in FSL format. Maps to a command-line argument: --outfsl %s.

out_itka boolean or a pathlike object or string representing a file

Output transform in ITK format. Maps to a command-line argument: --outitk %s.

out_ltaa boolean or a pathlike object or string representing a file

Output linear transform (LTA Freesurfer format). Maps to a command-line argument: --outlta %s.

out_mnia boolean or a pathlike object or string representing a file

Output transform in MNI/XFM format. Maps to a command-line argument: --outmni %s.

out_rega boolean or a pathlike object or string representing a file

Output transform in reg dat format. Maps to a command-line argument: --outreg %s.

source_filea pathlike object or string representing an existing file

Maps to a command-line argument: --src %s.

target_conforma boolean

Maps to a command-line argument: --trgconform.

target_filea pathlike object or string representing an existing file

Maps to a command-line argument: --trg %s.

out_fsla pathlike object or string representing an existing file

Output transform in FSL format.

out_itka pathlike object or string representing an existing file

Output transform in ITK format.

out_ltaa pathlike object or string representing an existing file

Output linear transform (LTA Freesurfer format).

out_mnia pathlike object or string representing an existing file

Output transform in MNI/XFM format.

out_rega pathlike object or string representing an existing file

Output transform in reg dat format.

MRIFill

Link to code

Bases: FSCommand

Wrapped executable: mri_fill.

This program creates hemispheric cutting planes and fills white matter with specific values for subsequent surface tessellation.

Examples

>>> from nipype.interfaces.freesurfer import MRIFill
>>> fill = MRIFill()
>>> fill.inputs.in_file = 'wm.mgz' 
>>> fill.inputs.out_file = 'filled.mgz' 
>>> fill.cmdline 
'mri_fill wm.mgz filled.mgz'
in_filea pathlike object or string representing an existing file

Input white matter file. Maps to a command-line argument: %s (position: -2).

out_filea pathlike object or string representing a file

Output filled volume file name for MRIFill. Maps to a command-line argument: %s (position: -1).

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

log_filea pathlike object or string representing a file

Output log file for MRIFill. Maps to a command-line argument: -a %s.

segmentationa pathlike object or string representing an existing file

Input segmentation file for MRIFill. Maps to a command-line argument: -segmentation %s.

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

transforma pathlike object or string representing an existing file

Input transform file for MRIFill. Maps to a command-line argument: -xform %s.

log_filea pathlike object or string representing a file

Output log file from MRIFill.

out_filea pathlike object or string representing a file

Output file from MRIFill.

MRIMarchingCubes

Link to code

Bases: FSCommand

Wrapped executable: mri_mc.

Uses Freesurfer’s mri_mc to create surfaces by tessellating a given input volume

Example

>>> import nipype.interfaces.freesurfer as fs
>>> mc = fs.MRIMarchingCubes()
>>> mc.inputs.in_file = 'aseg.mgz'
>>> mc.inputs.label_value = 17
>>> mc.inputs.out_file = 'lh.hippocampus'
>>> mc.run() 
in_filea pathlike object or string representing an existing file

Input volume to tessellate voxels from. Maps to a command-line argument: %s (position: 1).

label_valuean integer

Label value which to tessellate from the input volume. (integer, if input is “filled.mgz” volume, 127 is rh, 255 is lh). Maps to a command-line argument: %d (position: 2).

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

connectivity_valuean integer

Alter the marching cubes connectivity: 1=6+,2=18,3=6,4=26 (default=1). Maps to a command-line argument: %d (position: -1). (Nipype default value: 1)

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

out_filea pathlike object or string representing a file

Output filename or True to generate one. Maps to a command-line argument: ./%s (position: -2).

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

surfacea pathlike object or string representing an existing file

Binary surface of the tessellation .

MRIPretess

Link to code

Bases: FSCommand

Wrapped executable: mri_pretess.

Uses Freesurfer’s mri_pretess to prepare volumes to be tessellated.

Changes white matter (WM) segmentation so that the neighbors of all voxels labeled as WM have a face in common - no edges or corners allowed.

Example

>>> import nipype.interfaces.freesurfer as fs
>>> pretess = fs.MRIPretess()
>>> pretess.inputs.in_filled = 'wm.mgz'
>>> pretess.inputs.in_norm = 'norm.mgz'
>>> pretess.inputs.nocorners = True
>>> pretess.cmdline
'mri_pretess -nocorners wm.mgz wm norm.mgz wm_pretesswm.mgz'
>>> pretess.run() 
in_filleda pathlike object or string representing an existing file

Filled volume, usually wm.mgz. Maps to a command-line argument: %s (position: -4).

in_norma pathlike object or string representing an existing file

The normalized, brain-extracted T1w image. Usually norm.mgz. Maps to a command-line argument: %s (position: -2).

labela string or an integer

Label to be picked up, can be a Freesurfer’s string like ‘wm’ or a label value (e.g. 127 for rh or 255 for lh). Maps to a command-line argument: %s (position: -3). (Nipype default value: wm)

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

keepa boolean

Keep WM edits. Maps to a command-line argument: -keep.

nocornersa boolean

Do not remove corner configurations in addition to edge ones. Maps to a command-line argument: -nocorners.

out_filea pathlike object or string representing a file

The output file after mri_pretess. Maps to a command-line argument: %s (position: -1).

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

testa boolean

Adds a voxel that should be removed by mri_pretess. The value of the voxel is set to that of an ON-edited WM, so it should be kept with -keep. The output will NOT be saved. Maps to a command-line argument: -test.

out_filea pathlike object or string representing an existing file

Output file after mri_pretess.

MRITessellate

Link to code

Bases: FSCommand

Wrapped executable: mri_tessellate.

Uses Freesurfer’s mri_tessellate to create surfaces by tessellating a given input volume

Example

>>> import nipype.interfaces.freesurfer as fs
>>> tess = fs.MRITessellate()
>>> tess.inputs.in_file = 'aseg.mgz'
>>> tess.inputs.label_value = 17
>>> tess.inputs.out_file = 'lh.hippocampus'
>>> tess.run() 
in_filea pathlike object or string representing an existing file

Input volume to tessellate voxels from. Maps to a command-line argument: %s (position: -3).

label_valuean integer

Label value which to tessellate from the input volume. (integer, if input is “filled.mgz” volume, 127 is rh, 255 is lh). Maps to a command-line argument: %d (position: -2).

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

out_filea pathlike object or string representing a file

Output filename or True to generate one. Maps to a command-line argument: %s (position: -1).

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

tesselate_all_voxelsa boolean

Tessellate the surface of all voxels with different labels. Maps to a command-line argument: -a.

use_real_RAS_coordinatesa boolean

Saves surface with real RAS coordinates where c_(r,a,s) != 0. Maps to a command-line argument: -n.

surfacea pathlike object or string representing an existing file

Binary surface of the tessellation .

MRIsCalc

Link to code

Bases: FSCommand

Wrapped executable: mris_calc.

‘mris_calc’ is a simple calculator that operates on FreeSurfer curvatures and volumes. In most cases, the calculator functions with three arguments: two inputs and an <ACTION> linking them. Some actions, however, operate with only one input <file1>. In all cases, the first input <file1> is the name of a FreeSurfer curvature overlay (e.g. rh.curv) or volume file (e.g. orig.mgz). For two inputs, the calculator first assumes that the second input is a file. If, however, this second input file doesn’t exist, the calculator assumes it refers to a float number, which is then processed according to <ACTION>.Note: <file1> and <file2> should typically be generated on the same subject.

Examples

>>> from nipype.interfaces.freesurfer import MRIsCalc
>>> example = MRIsCalc()
>>> example.inputs.in_file1 = 'lh.area' 
>>> example.inputs.in_file2 = 'lh.area.pial' 
>>> example.inputs.action = 'add'
>>> example.inputs.out_file = 'area.mid'
>>> example.cmdline 
'mris_calc -o lh.area.mid lh.area add lh.area.pial'
actiona string

Action to perform on input file(s). Maps to a command-line argument: %s (position: -2).

in_file1a pathlike object or string representing an existing file

Input file 1. Maps to a command-line argument: %s (position: -3).

out_filea pathlike object or string representing a file

Output file after calculation. Maps to a command-line argument: -o %s.

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

in_file2a pathlike object or string representing an existing file

Input file 2. Maps to a command-line argument: %s (position: -1). Mutually exclusive with inputs: in_float, in_int.

in_floata float

Input float. Maps to a command-line argument: %f (position: -1). Mutually exclusive with inputs: in_file2, in_int.

in_intan integer

Input integer. Maps to a command-line argument: %d (position: -1). Mutually exclusive with inputs: in_file2, in_float.

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

out_filea pathlike object or string representing a file

Output file after calculation.

MRIsCombine

Link to code

Bases: FSSurfaceCommand

Wrapped executable: mris_convert.

Uses Freesurfer’s mris_convert to combine two surface files into one.

For complete details, see the mris_convert Documentation.

If given an out_file that does not begin with 'lh.' or 'rh.', mris_convert will prepend 'lh.' to the file name. To avoid this behavior, consider setting out_file = './<filename>', or leaving out_file blank.

In a Node/Workflow, out_file is interpreted literally.

Example

>>> import nipype.interfaces.freesurfer as fs
>>> mris = fs.MRIsCombine()
>>> mris.inputs.in_files = ['lh.pial', 'rh.pial']
>>> mris.inputs.out_file = 'bh.pial'
>>> mris.cmdline
'mris_convert --combinesurfs lh.pial rh.pial bh.pial'
>>> mris.run()  
in_filesa list of from 2 to 2 items which are a pathlike object or string representing a file

Two surfaces to be combined. Maps to a command-line argument: --combinesurfs %s (position: 1).

out_filea pathlike object or string representing a file

Output filename. Combined surfaces from in_files. Maps to a command-line argument: %s (position: -1).

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

out_filea pathlike object or string representing an existing file

Output filename. Combined surfaces from in_files.

MRIsCombine.normalize_filenames()

Filename normalization routine to perform only when run in Node context. Interpret out_file as a literal path to reduce surprise.

MRIsConvert

Link to code

Bases: FSCommand

Wrapped executable: mris_convert.

Uses Freesurfer’s mris_convert to convert surface files to various formats

Example

>>> import nipype.interfaces.freesurfer as fs
>>> mris = fs.MRIsConvert()
>>> mris.inputs.in_file = 'lh.pial'
>>> mris.inputs.out_datatype = 'gii'
>>> mris.run() 
in_filea pathlike object or string representing an existing file

File to read/convert. Maps to a command-line argument: %s (position: -2).

out_datatype‘asc’ or ‘ico’ or ‘tri’ or ‘stl’ or ‘vtk’ or ‘gii’ or ‘mgh’ or ‘mgz’

These file formats are supported: ASCII: .ascICO: .ico, .tri GEO: .geo STL: .stl VTK: .vtk GIFTI: .gii MGH surface-encoded ‘volume’: .mgh, .mgz. Mutually exclusive with inputs: out_file.

out_filea pathlike object or string representing a file

Output filename or True to generate one. Maps to a command-line argument: %s (position: -1). Mutually exclusive with inputs: out_datatype.

annot_filea pathlike object or string representing an existing file

Input is annotation or gifti label data. Maps to a command-line argument: --annot %s.

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

dataarray_numan integer

If input is gifti, ‘num’ specifies which data array to use. Maps to a command-line argument: --da_num %d.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

functional_filea pathlike object or string representing an existing file

Input is functional time-series or other multi-frame data (must specify surface). Maps to a command-line argument: -f %s.

label_filea pathlike object or string representing an existing file

Infile is .label file, label is name of this label. Maps to a command-line argument: --label %s.

labelstats_outfilea pathlike object or string representing a file

Outfile is name of gifti file to which label stats will be written. Maps to a command-line argument: --labelstats %s.

normala boolean

Output is an ascii file where vertex data. Maps to a command-line argument: -n.

orignamea string

Read orig positions. Maps to a command-line argument: -o %s.

parcstats_filea pathlike object or string representing an existing file

Infile is name of text file containing label/val pairs. Maps to a command-line argument: --parcstats %s.

patcha boolean

Input is a patch, not a full surface. Maps to a command-line argument: -p.

rescalea boolean

Rescale vertex xyz so total area is same as group average. Maps to a command-line argument: -r.

scalarcurv_filea pathlike object or string representing an existing file

Input is scalar curv overlay file (must still specify surface). Maps to a command-line argument: -c %s.

scalea float

Scale vertex xyz by scale. Maps to a command-line argument: -s %.3f.

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

talairachxfm_subjida string

Apply talairach xfm of subject to vertex xyz. Maps to a command-line argument: -t %s.

to_scannera boolean

Convert coordinates from native FS (tkr) coords to scanner coords. Maps to a command-line argument: --to-scanner.

to_tkra boolean

Convert coordinates from scanner coords to native FS (tkr) coords. Maps to a command-line argument: --to-tkr.

vertexa boolean

Writes out neighbors of a vertex in each row. Maps to a command-line argument: -v.

xyz_asciia boolean

Print only surface xyz to ascii file. Maps to a command-line argument: -a.

converteda pathlike object or string representing an existing file

Converted output surface.

MRIsExpand

Link to code

Bases: FSSurfaceCommand

Wrapped executable: mris_expand.

Expands a surface (typically ?h.white) outwards while maintaining smoothness and self-intersection constraints.

Examples

>>> from nipype.interfaces.freesurfer import MRIsExpand
>>> mris_expand = MRIsExpand(thickness=True, distance=0.5)
>>> mris_expand.inputs.in_file = 'lh.white'
>>> mris_expand.cmdline
'mris_expand -thickness lh.white 0.5 expanded'
>>> mris_expand.inputs.out_name = 'graymid'
>>> mris_expand.cmdline
'mris_expand -thickness lh.white 0.5 graymid'
distancea float

Distance in mm or fraction of cortical thickness. Maps to a command-line argument: %g (position: -2).

in_filea pathlike object or string representing an existing file

Surface to expand. Maps to a command-line argument: %s (position: -3).

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

dta float

Dt (implicit: 0.25). Maps to a command-line argument: -T %g.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

nsurfacesan integer

Number of surfacces to write during expansion. Maps to a command-line argument: -N %d.

out_namea string

Output surface file. If no path, uses directory of in_file. If no path AND missing “lh.” or “rh.”, derive from in_file. Maps to a command-line argument: %s (position: -1). (Nipype default value: expanded)

piala string

Name of pial file (implicit: “pial”) If no path, uses directory of in_file If no path AND missing “lh.” or “rh.”, derive from in_file. Maps to a command-line argument: -pial %s.

smooth_averagesan integer

Smooth surface with N iterations after expansion. Maps to a command-line argument: -A %d.

spherea string

WARNING: Do not change this trait. (Nipype default value: sphere)

springa float

Spring term (implicit: 0.05). Maps to a command-line argument: -S %g.

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

thicknessa boolean

Expand by fraction of cortical thickness, not mm. Maps to a command-line argument: -thickness.

thickness_namea string

Name of thickness file (implicit: “thickness”) If no path, uses directory of in_file If no path AND missing “lh.” or “rh.”, derive from in_file. Maps to a command-line argument: -thickness_name %s.

write_iterationsan integer

Write snapshots of expansion every N iterations. Maps to a command-line argument: -W %d.

out_filea pathlike object or string representing a file

Output surface file.

MRIsExpand.normalize_filenames()

Filename normalization routine to perform only when run in Node context. Find full paths for pial, thickness and sphere files for copying.

MRIsInflate

Link to code

Bases: FSCommand

Wrapped executable: mris_inflate.

This program will inflate a cortical surface.

Examples

>>> from nipype.interfaces.freesurfer import MRIsInflate
>>> inflate = MRIsInflate()
>>> inflate.inputs.in_file = 'lh.pial'
>>> inflate.inputs.no_save_sulc = True
>>> inflate.cmdline 
'mris_inflate -no-save-sulc lh.pial lh.inflated'
in_filea pathlike object or string representing an existing file

Input file for MRIsInflate. Maps to a command-line argument: %s (position: -2).

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

no_save_sulca boolean

Do not save sulc file as output. Maps to a command-line argument: -no-save-sulc. Mutually exclusive with inputs: out_sulc.

out_filea pathlike object or string representing a file

Output file for MRIsInflate. Maps to a command-line argument: %s (position: -1).

out_sulca pathlike object or string representing a file

Output sulc file. Mutually exclusive with inputs: no_save_sulc.

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

out_filea pathlike object or string representing a file

Output file for MRIsInflate.

out_sulca pathlike object or string representing a file

Output sulc file.

MakeAverageSubject

Link to code

Bases: FSCommand

Wrapped executable: make_average_subject.

Make an average freesurfer subject

Examples

>>> from nipype.interfaces.freesurfer import MakeAverageSubject
>>> avg = MakeAverageSubject(subjects_ids=['s1', 's2'])
>>> avg.cmdline
'make_average_subject --out average --subjects s1 s2'
subjects_idsa list of items which are a string

Freesurfer subjects ids to average. Maps to a command-line argument: --subjects %s.

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

out_namea pathlike object or string representing a file

Name for the average subject. Maps to a command-line argument: --out %s. (Nipype default value: average)

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

average_subject_namea string

Output registration file.

MakeSurfaces

Link to code

Bases: FSCommand

Wrapped executable: mris_make_surfaces.

This program positions the tessellation of the cortical surface at the white matter surface, then the gray matter surface and generate surface files for these surfaces as well as a ‘curvature’ file for the cortical thickness, and a surface file which approximates layer IV of the cortical sheet.

Examples

>>> from nipype.interfaces.freesurfer import MakeSurfaces
>>> makesurfaces = MakeSurfaces()
>>> makesurfaces.inputs.hemisphere = 'lh'
>>> makesurfaces.inputs.subject_id = '10335'
>>> makesurfaces.inputs.in_orig = 'lh.pial'
>>> makesurfaces.inputs.in_wm = 'wm.mgz'
>>> makesurfaces.inputs.in_filled = 'norm.mgz'
>>> makesurfaces.inputs.in_label = 'aparc+aseg.nii'
>>> makesurfaces.inputs.in_T1 = 'T1.mgz'
>>> makesurfaces.inputs.orig_pial = 'lh.pial'
>>> makesurfaces.cmdline
'mris_make_surfaces -T1 T1.mgz -orig pial -orig_pial pial 10335 lh'
hemisphere‘lh’ or ‘rh’

Hemisphere being processed. Maps to a command-line argument: %s (position: -1).

in_filleda pathlike object or string representing an existing file

Implicit input file filled.mgz.

in_origa pathlike object or string representing an existing file

Implicit input file <hemisphere>.orig. Maps to a command-line argument: -orig %s.

in_wma pathlike object or string representing an existing file

Implicit input file wm.mgz.

subject_ida string

Subject being processed. Maps to a command-line argument: %s (position: -2). (Nipype default value: subject_id)

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

copy_inputsa boolean

If running as a node, set this to True. This will copy the input files to the node directory.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

fix_mtla boolean

Undocumented flag. Maps to a command-line argument: -fix_mtl.

in_T1a pathlike object or string representing an existing file

Input brain or T1 file. Maps to a command-line argument: -T1 %s.

in_asega pathlike object or string representing an existing file

Input segmentation file. Maps to a command-line argument: -aseg %s.

in_labela pathlike object or string representing an existing file

Implicit input label/<hemisphere>.aparc.annot. Mutually exclusive with inputs: noaparc.

in_whitea pathlike object or string representing an existing file

Implicit input that is sometimes used.

longitudinala boolean

No documentation (used for longitudinal processing). Maps to a command-line argument: -long.

maximuma float

No documentation (used for longitudinal processing). Maps to a command-line argument: -max %.1f.

mgza boolean

No documentation. Direct questions to analysis-bugs@nmr.mgh.harvard.edu. Maps to a command-line argument: -mgz.

no_whitea boolean

Undocumented flag. Maps to a command-line argument: -nowhite.

noaparca boolean

No documentation. Direct questions to analysis-bugs@nmr.mgh.harvard.edu. Maps to a command-line argument: -noaparc. Mutually exclusive with inputs: in_label.

orig_piala pathlike object or string representing an existing file

Specify a pial surface to start with. Maps to a command-line argument: -orig_pial %s. Requires inputs: in_label.

orig_whitea pathlike object or string representing an existing file

Specify a white surface to start with. Maps to a command-line argument: -orig_white %s.

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

whitea string

White surface name. Maps to a command-line argument: -white %s.

white_onlya boolean

Undocumented flag. Maps to a command-line argument: -whiteonly.

out_areaa pathlike object or string representing a file

Output area file for MakeSurfaces.

out_cortexa pathlike object or string representing a file

Output cortex file for MakeSurfaces.

out_curva pathlike object or string representing a file

Output curv file for MakeSurfaces.

out_piala pathlike object or string representing a file

Output pial surface for MakeSurfaces.

out_thicknessa pathlike object or string representing a file

Output thickness file for MakeSurfaces.

out_whitea pathlike object or string representing a file

Output white matter hemisphere surface.

MakeSurfaces.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

ParcellationStats

Link to code

Bases: FSCommand

Wrapped executable: mris_anatomical_stats.

This program computes a number of anatomical properties.

Examples

>>> from nipype.interfaces.freesurfer import ParcellationStats
>>> import os
>>> parcstats = ParcellationStats()
>>> parcstats.inputs.subject_id = '10335'
>>> parcstats.inputs.hemisphere = 'lh'
>>> parcstats.inputs.wm = './../mri/wm.mgz' 
>>> parcstats.inputs.transform = './../mri/transforms/talairach.xfm' 
>>> parcstats.inputs.brainmask = './../mri/brainmask.mgz' 
>>> parcstats.inputs.aseg = './../mri/aseg.presurf.mgz' 
>>> parcstats.inputs.ribbon = './../mri/ribbon.mgz' 
>>> parcstats.inputs.lh_pial = 'lh.pial' 
>>> parcstats.inputs.rh_pial = 'lh.pial' 
>>> parcstats.inputs.lh_white = 'lh.white' 
>>> parcstats.inputs.rh_white = 'rh.white' 
>>> parcstats.inputs.thickness = 'lh.thickness' 
>>> parcstats.inputs.surface = 'white'
>>> parcstats.inputs.out_table = 'lh.test.stats'
>>> parcstats.inputs.out_color = 'test.ctab'
>>> parcstats.cmdline 
'mris_anatomical_stats -c test.ctab -f lh.test.stats 10335 lh white'
asega pathlike object or string representing an existing file

Input file must be <subject_id>/mri/aseg.presurf.mgz.

brainmaska pathlike object or string representing an existing file

Input file must be <subject_id>/mri/brainmask.mgz.

hemisphere‘lh’ or ‘rh’

Hemisphere being processed. Maps to a command-line argument: %s (position: -2).

lh_piala pathlike object or string representing an existing file

Input file must be <subject_id>/surf/lh.pial.

lh_whitea pathlike object or string representing an existing file

Input file must be <subject_id>/surf/lh.white.

rh_piala pathlike object or string representing an existing file

Input file must be <subject_id>/surf/rh.pial.

rh_whitea pathlike object or string representing an existing file

Input file must be <subject_id>/surf/rh.white.

ribbona pathlike object or string representing an existing file

Input file must be <subject_id>/mri/ribbon.mgz.

subject_ida string

Subject being processed. Maps to a command-line argument: %s (position: -3). (Nipype default value: subject_id)

thicknessa pathlike object or string representing an existing file

Input file must be <subject_id>/surf/?h.thickness.

transforma pathlike object or string representing an existing file

Input file must be <subject_id>/mri/transforms/talairach.xfm.

wma pathlike object or string representing an existing file

Input file must be <subject_id>/mri/wm.mgz.

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

copy_inputsa boolean

If running as a node, set this to True. This will copy the input files to the node directory.

cortex_labela pathlike object or string representing an existing file

Implicit input file {hemi}.cortex.label.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

in_annotationa pathlike object or string representing an existing file

Compute properties for each label in the annotation file separately. Maps to a command-line argument: -a %s. Mutually exclusive with inputs: in_label.

in_cortexa pathlike object or string representing an existing file

Input cortex label. Maps to a command-line argument: -cortex %s.

in_labela pathlike object or string representing an existing file

Limit calculations to specified label. Maps to a command-line argument: -l %s. Mutually exclusive with inputs: in_annotatoin, out_color.

mgza boolean

Look for mgz files. Maps to a command-line argument: -mgz.

out_colora pathlike object or string representing a file

Output annotation files’s colortable to text file. Maps to a command-line argument: -c %s. Mutually exclusive with inputs: in_label.

out_tablea pathlike object or string representing a file

Table output to tablefile. Maps to a command-line argument: -f %s. Requires inputs: tabular_output.

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

surfacea string

Input surface (e.g. ‘white’). Maps to a command-line argument: %s (position: -1).

tabular_outputa boolean

Tabular output. Maps to a command-line argument: -b.

th3a boolean

Turns on new vertex-wise volume calc for mris_anat_stats. Maps to a command-line argument: -th3. Requires inputs: cortex_label.

out_colora pathlike object or string representing a file

Output annotation files’s colortable to text file.

out_tablea pathlike object or string representing a file

Table output to tablefile.

ParcellationStats.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

RelabelHypointensities

Link to code

Bases: FSCommand

Wrapped executable: mri_relabel_hypointensities.

Relabel Hypointensities

Examples

>>> from nipype.interfaces.freesurfer import RelabelHypointensities
>>> relabelhypos = RelabelHypointensities()
>>> relabelhypos.inputs.lh_white = 'lh.pial'
>>> relabelhypos.inputs.rh_white = 'lh.pial'
>>> relabelhypos.inputs.surf_directory = '.'
>>> relabelhypos.inputs.aseg = 'aseg.mgz'
>>> relabelhypos.cmdline
'mri_relabel_hypointensities aseg.mgz . aseg.hypos.mgz'
asega pathlike object or string representing an existing file

Input aseg file. Maps to a command-line argument: %s (position: -3).

lh_whitea pathlike object or string representing an existing file

Implicit input file must be lh.white.

rh_whitea pathlike object or string representing an existing file

Implicit input file must be rh.white.

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

out_filea pathlike object or string representing a file

Output aseg file. Maps to a command-line argument: %s (position: -1).

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

surf_directorya pathlike object or string representing an existing directory

Directory containing lh.white and rh.white. Maps to a command-line argument: %s (position: -2). (Nipype default value: .)

out_filea pathlike object or string representing a file

Output aseg file. Maps to a command-line argument: %s.

RemoveIntersection

Link to code

Bases: FSCommand

Wrapped executable: mris_remove_intersection.

This program removes the intersection of the given MRI

Examples

>>> from nipype.interfaces.freesurfer import RemoveIntersection
>>> ri = RemoveIntersection()
>>> ri.inputs.in_file = 'lh.pial'
>>> ri.cmdline
'mris_remove_intersection lh.pial lh.pial'
in_filea pathlike object or string representing an existing file

Input file for RemoveIntersection. Maps to a command-line argument: %s (position: -2).

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

out_filea pathlike object or string representing a file

Output file for RemoveIntersection. Maps to a command-line argument: %s (position: -1).

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

out_filea pathlike object or string representing a file

Output file for RemoveIntersection.

RemoveNeck

Link to code

Bases: FSCommand

Wrapped executable: mri_remove_neck.

Crops the neck out of the mri image

Examples

>>> from nipype.interfaces.freesurfer import TalairachQC
>>> remove_neck = RemoveNeck()
>>> remove_neck.inputs.in_file = 'norm.mgz'
>>> remove_neck.inputs.transform = 'trans.mat'
>>> remove_neck.inputs.template = 'trans.mat'
>>> remove_neck.cmdline
'mri_remove_neck norm.mgz trans.mat trans.mat norm_noneck.mgz'
in_filea pathlike object or string representing an existing file

Input file for RemoveNeck. Maps to a command-line argument: %s (position: -4).

templatea pathlike object or string representing an existing file

Input template file for RemoveNeck. Maps to a command-line argument: %s (position: -2).

transforma pathlike object or string representing an existing file

Input transform file for RemoveNeck. Maps to a command-line argument: %s (position: -3).

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

out_filea pathlike object or string representing a file

Output file for RemoveNeck. Maps to a command-line argument: %s (position: -1).

radiusan integer

Radius. Maps to a command-line argument: -radius %d.

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

out_filea pathlike object or string representing a file

Output file with neck removed.

SampleToSurface

Link to code

Bases: FSCommand

Wrapped executable: mri_vol2surf.

Sample a volume to the cortical surface using Freesurfer’s mri_vol2surf.

You must supply a sampling method, range, and units. You can project either a given distance (in mm) or a given fraction of the cortical thickness at that vertex along the surface normal from the target surface, and then set the value of that vertex to be either the value at that point or the average or maximum value found along the projection vector.

By default, the surface will be saved as a vector with a length equal to the number of vertices on the target surface. This is not a problem for Freesurfer programs, but if you intend to use the file with interfaces to another package, you must set the reshape input to True, which will factor the surface vector into a matrix with dimensions compatible with proper Nifti files.

Examples

>>> import nipype.interfaces.freesurfer as fs
>>> sampler = fs.SampleToSurface(hemi="lh")
>>> sampler.inputs.source_file = "cope1.nii.gz"
>>> sampler.inputs.reg_file = "register.dat"
>>> sampler.inputs.sampling_method = "average"
>>> sampler.inputs.sampling_range = 1
>>> sampler.inputs.sampling_units = "frac"
>>> sampler.cmdline  
'mri_vol2surf --hemi lh --o ...lh.cope1.mgz --reg register.dat --projfrac-avg 1.000 --mov cope1.nii.gz'
>>> res = sampler.run() 
hemi‘lh’ or ‘rh’

Target hemisphere. Maps to a command-line argument: --hemi %s.

mni152rega boolean

Source volume is in MNI152 space. Maps to a command-line argument: --mni152reg. Mutually exclusive with inputs: reg_file, reg_header, mni152reg.

projection_stema string

Stem for precomputed linear estimates and volume fractions. Mutually exclusive with inputs: sampling_method.

reg_filea pathlike object or string representing an existing file

Source-to-reference registration file. Maps to a command-line argument: --reg %s. Mutually exclusive with inputs: reg_file, reg_header, mni152reg.

reg_headera boolean

Register based on header geometry. Maps to a command-line argument: --regheader %s. Mutually exclusive with inputs: reg_file, reg_header, mni152reg. Requires inputs: subject_id.

sampling_method‘point’ or ‘max’ or ‘average’

How to sample – at a point or at the max or average over a range. Maps to a command-line argument: %s. Mutually exclusive with inputs: projection_stem. Requires inputs: sampling_range, sampling_units.

source_filea pathlike object or string representing an existing file

Volume to sample values from. Maps to a command-line argument: --mov %s.

apply_rota tuple of the form: (a float, a float, a float)

Rotation angles (in degrees) to apply to reg matrix. Maps to a command-line argument: --rot %.3f %.3f %.3f.

apply_transa tuple of the form: (a float, a float, a float)

Translation (in mm) to apply to reg matrix. Maps to a command-line argument: --trans %.3f %.3f %.3f.

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

cortex_maska boolean

Mask the target surface with hemi.cortex.label. Maps to a command-line argument: --cortex. Mutually exclusive with inputs: mask_label.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

fix_tk_rega boolean

Make reg matrix round-compatible. Maps to a command-line argument: --fixtkreg.

float2int_method‘round’ or ‘tkregister’

Method to convert reg matrix values (default is round). Maps to a command-line argument: --float2int %s.

framean integer

Save only one frame (0-based). Maps to a command-line argument: --frame %d.

hits_filea boolean or a pathlike object or string representing an existing file

Save image with number of hits at each voxel. Maps to a command-line argument: --srchit %s.

hits_type‘cor’ or ‘mgh’ or ‘mgz’ or ‘minc’ or ‘analyze’ or ‘analyze4d’ or ‘spm’ or ‘afni’ or ‘brik’ or ‘bshort’ or ‘bfloat’ or ‘sdt’ or ‘outline’ or ‘otl’ or ‘gdf’ or ‘nifti1’ or ‘nii’ or ‘niigz’

Hits file type. Maps to a command-line argument: --srchit_type.

ico_orderan integer

Icosahedron order when target_subject is ‘ico’. Maps to a command-line argument: --icoorder %d. Requires inputs: target_subject.

interp_method‘nearest’ or ‘trilinear’

Interpolation method. Maps to a command-line argument: --interp %s.

mask_labela pathlike object or string representing an existing file

Label file to mask output with. Maps to a command-line argument: --mask %s. Mutually exclusive with inputs: cortex_mask.

no_reshapea boolean

Do not reshape surface vector (default). Maps to a command-line argument: --noreshape. Mutually exclusive with inputs: reshape.

out_filea pathlike object or string representing a file

Surface file to write. Maps to a command-line argument: --o %s.

out_type‘cor’ or ‘mgh’ or ‘mgz’ or ‘minc’ or ‘analyze’ or ‘analyze4d’ or ‘spm’ or ‘afni’ or ‘brik’ or ‘bshort’ or ‘bfloat’ or ‘sdt’ or ‘outline’ or ‘otl’ or ‘gdf’ or ‘nifti1’ or ‘nii’ or ‘niigz’ or ‘gii’

Output file type. Maps to a command-line argument: --out_type %s.

override_reg_subja boolean

Override the subject in the reg file header. Maps to a command-line argument: --srcsubject %s. Requires inputs: subject_id.

reference_filea pathlike object or string representing an existing file

Reference volume (default is orig.mgz). Maps to a command-line argument: --ref %s.

reshapea boolean

Reshape surface vector to fit in non-mgh format. Maps to a command-line argument: --reshape. Mutually exclusive with inputs: no_reshape.

reshape_slicesan integer

Number of ‘slices’ for reshaping. Maps to a command-line argument: --rf %d.

sampling_rangea float or a tuple of the form: (a float, a float, a float)

Sampling range - a point or a tuple of (min, max, step).

sampling_units‘mm’ or ‘frac’

Sampling range type – either ‘mm’ or ‘frac’.

scale_inputa float

Multiple all intensities by scale factor. Maps to a command-line argument: --scale %.3f.

smooth_surfa float

Smooth output surface (mm fwhm). Maps to a command-line argument: --surf-fwhm %.3f.

smooth_vola float

Smooth input volume (mm fwhm). Maps to a command-line argument: --fwhm %.3f.

subject_ida string

Subject id.

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

surf_rega boolean or a string

Use surface registration to target subject. Maps to a command-line argument: --surfreg %s. Requires inputs: target_subject.

surfacea string

Target surface (default is white). Maps to a command-line argument: --surf %s.

target_subjecta string

Sample to surface of different subject than source. Maps to a command-line argument: --trgsubject %s.

vox_filea boolean or a pathlike object or string representing a file

Text file with the number of voxels intersecting the surface. Maps to a command-line argument: --nvox %s.

hits_filea pathlike object or string representing an existing file

Image with number of hits at each voxel.

out_filea pathlike object or string representing an existing file

Surface file.

vox_filea pathlike object or string representing an existing file

Text file with the number of voxels intersecting the surface.

SmoothTessellation

Link to code

Bases: FSCommand

Wrapped executable: mris_smooth.

Smooth a tessellated surface.

See also

nipype.interfaces.freesurfer.utils.SurfaceSmooth interface for smoothing a scalar field along a surface manifold

Example

>>> import nipype.interfaces.freesurfer as fs
>>> smooth = fs.SmoothTessellation()
>>> smooth.inputs.in_file = 'lh.hippocampus.stl'
>>> smooth.run() 
in_filea pathlike object or string representing an existing file

Input volume to tessellate voxels from. Maps to a command-line argument: %s (position: -2).

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

curvature_averaging_iterationsan integer

Number of curvature averaging iterations (default=10). Maps to a command-line argument: -a %d.

disable_estimatesa boolean

Disables the writing of curvature and area estimates. Maps to a command-line argument: -nw.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

gaussian_curvature_norm_stepsan integer

Use Gaussian curvature smoothing. Maps to a command-line argument: %d.

gaussian_curvature_smoothing_stepsan integer

Use Gaussian curvature smoothing. Maps to a command-line argument: %d.

normalize_areaa boolean

Normalizes the area after smoothing. Maps to a command-line argument: -area.

out_area_filea pathlike object or string representing a file

Write area to ?h.areaname (default “area”). Maps to a command-line argument: -b %s.

out_curvature_filea pathlike object or string representing a file

Write curvature to ?h.curvname (default “curv”). Maps to a command-line argument: -c %s.

out_filea pathlike object or string representing a file

Output filename or True to generate one. Maps to a command-line argument: %s (position: -1).

seedan integer

Seed for setting random number generator. Maps to a command-line argument: -seed %d.

smoothing_iterationsan integer

Number of smoothing iterations (default=10). Maps to a command-line argument: -n %d.

snapshot_writing_iterationsan integer

Write snapshot every n iterations. Maps to a command-line argument: -w %d.

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

use_gaussian_curvature_smoothinga boolean

Use Gaussian curvature smoothing. Maps to a command-line argument: -g.

use_momentuma boolean

Uses momentum. Maps to a command-line argument: -m.

surfacea pathlike object or string representing an existing file

Smoothed surface file.

Sphere

Link to code

Bases: FSCommandOpenMP

Wrapped executable: mris_sphere.

This program will add a template into an average surface

Examples

>>> from nipype.interfaces.freesurfer import Sphere
>>> sphere = Sphere()
>>> sphere.inputs.in_file = 'lh.pial'
>>> sphere.cmdline
'mris_sphere lh.pial lh.sphere'
in_filea pathlike object or string representing an existing file

Input file for Sphere. Maps to a command-line argument: %s (position: -2).

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

in_smoothwma pathlike object or string representing an existing file

Input surface required when -q flag is not selected.

magica boolean

No documentation. Direct questions to analysis-bugs@nmr.mgh.harvard.edu. Maps to a command-line argument: -q.

num_threadsan integer

Allows for specifying more threads.

out_filea pathlike object or string representing a file

Output file for Sphere. Maps to a command-line argument: %s (position: -1).

seedan integer

Seed for setting random number generator. Maps to a command-line argument: -seed %d.

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

out_filea pathlike object or string representing a file

Output file for Sphere.

Surface2VolTransform

Link to code

Bases: FSCommand

Wrapped executable: mri_surf2vol.

Use FreeSurfer mri_surf2vol to apply a transform.

Examples

>>> from nipype.interfaces.freesurfer import Surface2VolTransform
>>> xfm2vol = Surface2VolTransform()
>>> xfm2vol.inputs.source_file = 'lh.cope1.mgz'
>>> xfm2vol.inputs.reg_file = 'register.mat'
>>> xfm2vol.inputs.hemi = 'lh'
>>> xfm2vol.inputs.template_file = 'cope1.nii.gz'
>>> xfm2vol.inputs.subjects_dir = '.'
>>> xfm2vol.cmdline
'mri_surf2vol --hemi lh --volreg register.mat --surfval lh.cope1.mgz --sd . --template cope1.nii.gz --outvol lh.cope1_asVol.nii --vtxvol lh.cope1_asVol_vertex.nii'
>>> res = xfm2vol.run()
hemia string

Hemisphere of data. Maps to a command-line argument: --hemi %s.

reg_filea pathlike object or string representing an existing file

TkRAS-to-tkRAS matrix (tkregister2 format). Maps to a command-line argument: --volreg %s. Mutually exclusive with inputs: subject_id.

source_filea pathlike object or string representing an existing file

This is the source of the surface values. Maps to a command-line argument: --surfval %s. Mutually exclusive with inputs: mkmask.

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

mkmaska boolean

Make a mask instead of loading surface values. Maps to a command-line argument: --mkmask. Mutually exclusive with inputs: source_file.

projfraca float

Thickness fraction. Maps to a command-line argument: --projfrac %s.

subject_ida string

Subject id. Maps to a command-line argument: --identity %s. Mutually exclusive with inputs: reg_file.

subjects_dira string

Freesurfer subjects directory defaults to $SUBJECTS_DIR. Maps to a command-line argument: --sd %s.

surf_namea string

Surfname (default is white). Maps to a command-line argument: --surf %s.

template_filea pathlike object or string representing an existing file

Output template volume. Maps to a command-line argument: --template %s.

transformed_filea pathlike object or string representing a file

Output volume. Maps to a command-line argument: --outvol %s.

vertexvol_filea pathlike object or string representing a file

Path name of the vertex output volume, which is the same as output volume except that the value of each voxel is the vertex-id that is mapped to that voxel. Maps to a command-line argument: --vtxvol %s.

transformed_filea pathlike object or string representing an existing file

Path to output file if used normally.

vertexvol_filea pathlike object or string representing a file

Vertex map volume path id. Optional.

SurfaceSmooth

Link to code

Bases: FSCommand

Wrapped executable: mri_surf2surf.

Smooth a surface image with mri_surf2surf.

The surface is smoothed by an iterative process of averaging the value at each vertex with those of its adjacent neighbors. You may supply either the number of iterations to run or a desired effective FWHM of the smoothing process. If the latter, the underlying program will calculate the correct number of iterations internally.

See also

nipype.interfaces.freesurfer.utils.SmoothTessellation interface for smoothing a tessellated surface (e.g. in gifti or .stl)

Examples

>>> import nipype.interfaces.freesurfer as fs
>>> smoother = fs.SurfaceSmooth()
>>> smoother.inputs.in_file = "lh.cope1.mgz"
>>> smoother.inputs.subject_id = "subj_1"
>>> smoother.inputs.hemi = "lh"
>>> smoother.inputs.fwhm = 5
>>> smoother.cmdline 
'mri_surf2surf --cortex --fwhm 5.0000 --hemi lh --sval lh.cope1.mgz --tval ...lh.cope1_smooth5.mgz --s subj_1'
>>> smoother.run() 
hemi‘lh’ or ‘rh’

Hemisphere to operate on. Maps to a command-line argument: --hemi %s.

in_filea pathlike object or string representing a file

Source surface file. Maps to a command-line argument: --sval %s.

subject_ida string

Subject id of surface file. Maps to a command-line argument: --s %s.

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

cortexa boolean

Only smooth within $hemi.cortex.label. Maps to a command-line argument: --cortex. (Nipype default value: True)

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

fwhma float

Effective FWHM of the smoothing process. Maps to a command-line argument: --fwhm %.4f. Mutually exclusive with inputs: smooth_iters.

out_filea pathlike object or string representing a file

Surface file to write. Maps to a command-line argument: --tval %s.

reshapea boolean

Reshape surface vector to fit in non-mgh format. Maps to a command-line argument: --reshape.

smooth_itersan integer

Iterations of the smoothing process. Maps to a command-line argument: --smooth %d. Mutually exclusive with inputs: fwhm.

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

out_filea pathlike object or string representing an existing file

Smoothed surface file.

SurfaceSnapshots

Link to code

Bases: FSCommand

Wrapped executable: tksurfer.

Use Tksurfer to save pictures of the cortical surface.

By default, this takes snapshots of the lateral, medial, ventral, and dorsal surfaces. See the six_images option to add the anterior and posterior surfaces.

You may also supply your own tcl script (see the Freesurfer wiki for information on scripting tksurfer). The screenshot stem is set as the environment variable “_SNAPSHOT_STEM”, which you can use in your own scripts.

Node that this interface will not run if you do not have graphics enabled on your system.

Examples

>>> import nipype.interfaces.freesurfer as fs
>>> shots = fs.SurfaceSnapshots(subject_id="fsaverage", hemi="lh", surface="pial")
>>> shots.inputs.overlay = "zstat1.nii.gz"
>>> shots.inputs.overlay_range = (2.3, 6)
>>> shots.inputs.overlay_reg = "register.dat"
>>> res = shots.run() 
hemi‘lh’ or ‘rh’

Hemisphere to visualize. Maps to a command-line argument: %s (position: 2).

subject_ida string

Subject to visualize. Maps to a command-line argument: %s (position: 1).

surfacea string

Surface to visualize. Maps to a command-line argument: %s (position: 3).

annot_filea pathlike object or string representing an existing file

Path to annotation file to display. Maps to a command-line argument: -annotation %s. Mutually exclusive with inputs: annot_name.

annot_namea string

Name of annotation to display (must be in $subject/label directory. Maps to a command-line argument: -annotation %s. Mutually exclusive with inputs: annot_file.

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

colortablea pathlike object or string representing an existing file

Load colortable file. Maps to a command-line argument: -colortable %s.

demean_overlaya boolean

Remove mean from overlay. Maps to a command-line argument: -zm.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

identity_rega boolean

Use the identity matrix to register the overlay to the surface. Maps to a command-line argument: -overlay-reg-identity. Mutually exclusive with inputs: overlay_reg, identity_reg, mni152_reg.

invert_overlaya boolean

Invert the overlay display. Maps to a command-line argument: -invphaseflag 1.

label_filea pathlike object or string representing an existing file

Path to label file to display. Maps to a command-line argument: -label %s. Mutually exclusive with inputs: label_name.

label_namea string

Name of label to display (must be in $subject/label directory. Maps to a command-line argument: -label %s. Mutually exclusive with inputs: label_file.

label_outlinea boolean

Draw label/annotation as outline. Maps to a command-line argument: -label-outline.

label_undera boolean

Draw label/annotation under overlay. Maps to a command-line argument: -labels-under.

mni152_rega boolean

Use to display a volume in MNI152 space on the average subject. Maps to a command-line argument: -mni152reg. Mutually exclusive with inputs: overlay_reg, identity_reg, mni152_reg.

orig_suffixa string

Set the orig surface suffix string. Maps to a command-line argument: -orig %s.

overlaya pathlike object or string representing an existing file

Load an overlay volume/surface. Maps to a command-line argument: -overlay %s. Requires inputs: overlay_range.

overlay_rangea float or a tuple of the form: (a float, a float) or a tuple of the form: (a float, a float, a float)

Overlay range–either min, (min, max) or (min, mid, max). Maps to a command-line argument: %s.

overlay_range_offseta float

Overlay range will be symmetric around offset value. Maps to a command-line argument: -foffset %.3f.

overlay_rega pathlike object or string representing an existing file

Registration matrix file to register overlay to surface. Maps to a command-line argument: -overlay-reg %s. Mutually exclusive with inputs: overlay_reg, identity_reg, mni152_reg.

patch_filea pathlike object or string representing an existing file

Load a patch. Maps to a command-line argument: -patch %s.

reverse_overlaya boolean

Reverse the overlay display. Maps to a command-line argument: -revphaseflag 1.

screenshot_stema string

Stem to use for screenshot file names.

show_color_scalea boolean

Display the color scale bar. Maps to a command-line argument: -colscalebarflag 1.

show_color_texta boolean

Display text in the color scale bar. Maps to a command-line argument: -colscaletext 1.

show_curva boolean

Show curvature. Maps to a command-line argument: -curv. Mutually exclusive with inputs: show_gray_curv.

show_gray_curva boolean

Show curvature in gray. Maps to a command-line argument: -gray. Mutually exclusive with inputs: show_curv.

six_imagesa boolean

Also take anterior and posterior snapshots.

sphere_suffixa string

Set the sphere.reg suffix string. Maps to a command-line argument: -sphere %s.

stem_template_argsa list of items which are a string

Input names to use as arguments for a string-formated stem template. Requires inputs: screenshot_stem.

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

tcl_scripta pathlike object or string representing an existing file

Override default screenshot script. Maps to a command-line argument: %s.

truncate_overlaya boolean

Truncate the overlay display. Maps to a command-line argument: -truncphaseflag 1.

snapshotsa list of items which are a pathlike object or string representing an existing file

Tiff images of the surface from different perspectives.

SurfaceTransform

Link to code

Bases: FSCommand

Wrapped executable: mri_surf2surf.

Transform a surface file from one subject to another via a spherical registration.

Both the source and target subject must reside in your Subjects Directory, and they must have been processed with recon-all, unless you are transforming to one of the icosahedron meshes.

Examples

>>> from nipype.interfaces.freesurfer import SurfaceTransform
>>> sxfm = SurfaceTransform()
>>> sxfm.inputs.source_file = "lh.cope1.nii.gz"
>>> sxfm.inputs.source_subject = "my_subject"
>>> sxfm.inputs.target_subject = "fsaverage"
>>> sxfm.inputs.hemi = "lh"
>>> sxfm.run() 
hemi‘lh’ or ‘rh’

Hemisphere to transform. Maps to a command-line argument: --hemi %s.

source_annot_filea pathlike object or string representing an existing file

Surface annotation file. Maps to a command-line argument: --sval-annot %s. Mutually exclusive with inputs: source_file.

source_filea pathlike object or string representing an existing file

Surface file with source values. Maps to a command-line argument: --sval %s. Mutually exclusive with inputs: source_annot_file.

source_subjecta string

Subject id for source surface. Maps to a command-line argument: --srcsubject %s.

target_subjecta string

Subject id of target surface. Maps to a command-line argument: --trgsubject %s.

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

out_filea pathlike object or string representing a file

Surface file to write. Maps to a command-line argument: --tval %s.

reshapea boolean

Reshape output surface to conform with Nifti. Maps to a command-line argument: --reshape.

reshape_factoran integer

Number of slices in reshaped image. Maps to a command-line argument: --reshape-factor.

source_type‘cor’ or ‘mgh’ or ‘mgz’ or ‘minc’ or ‘analyze’ or ‘analyze4d’ or ‘spm’ or ‘afni’ or ‘brik’ or ‘bshort’ or ‘bfloat’ or ‘sdt’ or ‘outline’ or ‘otl’ or ‘gdf’ or ‘nifti1’ or ‘nii’ or ‘niigz’

Source file format. Maps to a command-line argument: --sfmt %s. Requires inputs: source_file.

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

target_ico_order1 or 2 or 3 or 4 or 5 or 6 or 7

Order of the icosahedron if target_subject is ‘ico’. Maps to a command-line argument: --trgicoorder %d.

target_type‘cor’ or ‘mgh’ or ‘mgz’ or ‘minc’ or ‘analyze’ or ‘analyze4d’ or ‘spm’ or ‘afni’ or ‘brik’ or ‘bshort’ or ‘bfloat’ or ‘sdt’ or ‘outline’ or ‘otl’ or ‘gdf’ or ‘nifti1’ or ‘nii’ or ‘niigz’ or ‘gii’

Output format. Maps to a command-line argument: --tfmt %s.

out_filea pathlike object or string representing an existing file

Transformed surface file.

TalairachAVI

Link to code

Bases: FSCommand

Wrapped executable: talairach_avi.

Front-end for Avi Snyders image registration tool. Computes the talairach transform that maps the input volume to the MNI average_305. This does not add the xfm to the header of the input file. When called by recon-all, the xfm is added to the header after the transform is computed.

Examples

>>> from nipype.interfaces.freesurfer import TalairachAVI
>>> example = TalairachAVI()
>>> example.inputs.in_file = 'norm.mgz'
>>> example.inputs.out_file = 'trans.mat'
>>> example.cmdline
'talairach_avi --i norm.mgz --xfm trans.mat'
>>> example.run() 
in_filea pathlike object or string representing an existing file

Input volume. Maps to a command-line argument: --i %s.

out_filea pathlike object or string representing a file

Output xfm file. Maps to a command-line argument: --xfm %s.

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

atlasa string

Alternate target atlas (in freesurfer/average dir). Maps to a command-line argument: --atlas %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

out_filea pathlike object or string representing a file

The output transform for TalairachAVI.

out_loga pathlike object or string representing a file

The output log file for TalairachAVI.

out_txta pathlike object or string representing a file

The output text file for TaliarachAVI.

TalairachQC

Link to code

Bases: FSScriptCommand

Wrapped executable: tal_QC_AZS.

Examples

>>> from nipype.interfaces.freesurfer import TalairachQC
>>> qc = TalairachQC()
>>> qc.inputs.log_file = 'dirs.txt'
>>> qc.cmdline
'tal_QC_AZS dirs.txt'
log_filea pathlike object or string representing an existing file

The log file for TalairachQC. Maps to a command-line argument: %s (position: 0).

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

log_filea pathlike object or string representing an existing file

The output log. (Nipype default value: output.nipype)

Tkregister2

Link to code

Bases: FSCommand

Wrapped executable: tkregister2.

Examples

Get transform matrix between orig (tkRAS) and native (scannerRAS) coordinates in Freesurfer. Implements the first step of mapping surfaces to native space in this guide.

>>> from nipype.interfaces.freesurfer import Tkregister2
>>> tk2 = Tkregister2(reg_file='T1_to_native.dat')
>>> tk2.inputs.moving_image = 'T1.mgz'
>>> tk2.inputs.target_image = 'structural.nii'
>>> tk2.inputs.reg_header = True
>>> tk2.cmdline
'tkregister2 --mov T1.mgz --noedit --reg T1_to_native.dat --regheader --targ structural.nii'
>>> tk2.run() 

The example below uses tkregister2 without the manual editing stage to convert FSL-style registration matrix (.mat) to FreeSurfer-style registration matrix (.dat)

>>> from nipype.interfaces.freesurfer import Tkregister2
>>> tk2 = Tkregister2()
>>> tk2.inputs.moving_image = 'epi.nii'
>>> tk2.inputs.fsl_in_matrix = 'flirt.mat'
>>> tk2.cmdline
'tkregister2 --fsl flirt.mat --mov epi.nii --noedit --reg register.dat'
>>> tk2.run() 
moving_imagea pathlike object or string representing an existing file

Moving volume. Maps to a command-line argument: --mov %s.

reg_filea pathlike object or string representing a file

Freesurfer-style registration file. Maps to a command-line argument: --reg %s. (Nipype default value: register.dat)

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

fsl_in_matrixa pathlike object or string representing an existing file

Fsl-style registration input matrix. Maps to a command-line argument: --fsl %s.

fsl_outa bool or None or a pathlike object or string representing a file

Compute an FSL-compatible resgitration matrix. Maps to a command-line argument: --fslregout %s.

fstala boolean

Set mov to be tal and reg to be tal xfm. Maps to a command-line argument: --fstal. Mutually exclusive with inputs: target_image, moving_image, reg_file.

fstarga boolean

Use subject’s T1 as reference. Maps to a command-line argument: --fstarg. Mutually exclusive with inputs: target_image.

invert_lta_ina boolean

Invert input LTA before applying. Requires inputs: lta_in.

invert_lta_outa boolean

Invert input LTA before applying. Maps to a command-line argument: --ltaout-inv. Requires inputs: lta_in.

lta_ina pathlike object or string representing an existing file

Use a matrix in MNI coordinates as initial registration. Maps to a command-line argument: --lta %s.

lta_outa bool or None or a pathlike object or string representing a file

Output registration file (LTA format). Maps to a command-line argument: --ltaout %s.

movscalea float

Adjust registration matrix to scale mov. Maps to a command-line argument: --movscale %f.

noedita boolean

Do not open edit window (exit). Maps to a command-line argument: --noedit. (Nipype default value: True)

reg_headera boolean

Compute registration from headers. Maps to a command-line argument: --regheader.

subject_ida string

Freesurfer subject ID. Maps to a command-line argument: --s %s.

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

target_imagea pathlike object or string representing an existing file

Target volume. Maps to a command-line argument: --targ %s. Mutually exclusive with inputs: fstarg.

xfma pathlike object or string representing an existing file

Use a matrix in MNI coordinates as initial registration. Maps to a command-line argument: --xfm %s.

fsl_filea pathlike object or string representing a file

FSL-style registration file.

lta_filea pathlike object or string representing a file

LTA-style registration file.

reg_filea pathlike object or string representing an existing file

Freesurfer-style registration file.

VolumeMask

Link to code

Bases: FSCommand

Wrapped executable: mris_volmask.

Computes a volume mask, at the same resolution as the <subject>/mri/brain.mgz. The volume mask contains 4 values: LH_WM (default 10), LH_GM (default 100), RH_WM (default 20), RH_GM (default 200). The algorithm uses the 4 surfaces situated in <subject>/surf/ [lh|rh].[white|pial] and labels voxels based on the signed-distance function from the surface.

Examples

>>> from nipype.interfaces.freesurfer import VolumeMask
>>> volmask = VolumeMask()
>>> volmask.inputs.left_whitelabel = 2
>>> volmask.inputs.left_ribbonlabel = 3
>>> volmask.inputs.right_whitelabel = 41
>>> volmask.inputs.right_ribbonlabel = 42
>>> volmask.inputs.lh_pial = 'lh.pial'
>>> volmask.inputs.rh_pial = 'lh.pial'
>>> volmask.inputs.lh_white = 'lh.pial'
>>> volmask.inputs.rh_white = 'lh.pial'
>>> volmask.inputs.subject_id = '10335'
>>> volmask.inputs.save_ribbon = True
>>> volmask.cmdline
'mris_volmask --label_left_ribbon 3 --label_left_white 2 --label_right_ribbon 42 --label_right_white 41 --save_ribbon 10335'
left_ribbonlabelan integer

Left cortical ribbon label. Maps to a command-line argument: --label_left_ribbon %d.

left_whitelabelan integer

Left white matter label. Maps to a command-line argument: --label_left_white %d.

lh_piala pathlike object or string representing an existing file

Implicit input left pial surface.

lh_whitea pathlike object or string representing an existing file

Implicit input left white matter surface.

rh_piala pathlike object or string representing an existing file

Implicit input right pial surface.

rh_whitea pathlike object or string representing an existing file

Implicit input right white matter surface.

right_ribbonlabelan integer

Right cortical ribbon label. Maps to a command-line argument: --label_right_ribbon %d.

right_whitelabelan integer

Right white matter label. Maps to a command-line argument: --label_right_white %d.

subject_ida string

Subject being processed. Maps to a command-line argument: %s (position: -1). (Nipype default value: subject_id)

argsa string

Additional parameters to the command. Maps to a command-line argument: %s.

asega pathlike object or string representing an existing file

Implicit aseg.mgz segmentation. Specify a different aseg by using the ‘in_aseg’ input. Mutually exclusive with inputs: in_aseg.

copy_inputsa boolean

If running as a node, set this to True. This will copy the implicit input files to the node directory.

environa dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’

Environment variables. (Nipype default value: {})

in_asega pathlike object or string representing an existing file

Input aseg file for VolumeMask. Maps to a command-line argument: --aseg_name %s. Mutually exclusive with inputs: aseg.

save_ribbona boolean

Option to save just the ribbon for the hemispheres in the format ?h.ribbon.mgz. Maps to a command-line argument: --save_ribbon.

subjects_dira pathlike object or string representing an existing directory

Subjects directory.

lh_ribbona pathlike object or string representing a file

Output left cortical ribbon mask.

out_ribbona pathlike object or string representing a file

Output cortical ribbon mask.

rh_ribbona pathlike object or string representing a file

Output right cortical ribbon mask.

VolumeMask.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

nipype.interfaces.freesurfer.utils.copy2subjdir(cls, in_file, folder=None, basename=None, subject_id=None)

Method to copy an input to the subjects directory

nipype.interfaces.freesurfer.utils.createoutputdirs(outputs)

create all output directories. If not created, some freesurfer interfaces fail