NIPY logo

Table Of Contents

Previous topic

interfaces.base

Next topic

interfaces.fsl

This Page

interfaces.freesurfer

Module: interfaces.freesurfer

Inheritance diagram for nipype.interfaces.freesurfer:

digraph inheritance1cbe1fbbdc { rankdir=LR; ratio=compress; fontsize=14; size="6.0, 8.0"; "base.Interface" [shape=ellipse,URL="nipype.interfaces.base.html#nipype.interfaces.base.Interface",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,fontsize=14,color=dodgerblue1,style=filled,height=0.75]; "fsl.FSLCommand" [shape=ellipse,URL="nipype.interfaces.fsl.html#nipype.interfaces.fsl.FSLCommand",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,fontsize=14,color=dodgerblue1,style=filled,height=0.75]; "base.CommandLine" -> "fsl.FSLCommand" [arrowsize=0.5,style="setlinewidth(0.5)"]; "freesurfer.Resample" [shape=ellipse,URL="#nipype.interfaces.freesurfer.Resample",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,fontsize=14,color=dodgerblue1,style=filled,height=0.75]; "freesurfer.FSCommandLine" -> "freesurfer.Resample" [arrowsize=0.5,style="setlinewidth(0.5)"]; "freesurfer.FSCommandLine" [shape=ellipse,URL="#nipype.interfaces.freesurfer.FSCommandLine",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,fontsize=14,color=dodgerblue1,style=filled,height=0.75]; "base.CommandLine" -> "freesurfer.FSCommandLine" [arrowsize=0.5,style="setlinewidth(0.5)"]; "freesurfer.BBRegister" [shape=ellipse,URL="#nipype.interfaces.freesurfer.BBRegister",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,fontsize=14,color=dodgerblue1,style=filled,height=0.75]; "fsl.FSLCommand" -> "freesurfer.BBRegister" [arrowsize=0.5,style="setlinewidth(0.5)"]; "freesurfer.ApplyVolTransform" [shape=ellipse,URL="#nipype.interfaces.freesurfer.ApplyVolTransform",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,fontsize=14,color=dodgerblue1,style=filled,height=0.75]; "fsl.FSLCommand" -> "freesurfer.ApplyVolTransform" [arrowsize=0.5,style="setlinewidth(0.5)"]; "freesurfer.SurfConcat" [shape=ellipse,URL="#nipype.interfaces.freesurfer.SurfConcat",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,fontsize=14,color=dodgerblue1,style=filled,height=0.75]; "fsl.FSLCommand" -> "freesurfer.SurfConcat" [arrowsize=0.5,style="setlinewidth(0.5)"]; "freesurfer.Smooth" [shape=ellipse,URL="#nipype.interfaces.freesurfer.Smooth",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,fontsize=14,color=dodgerblue1,style=filled,height=0.75]; "fsl.FSLCommand" -> "freesurfer.Smooth" [arrowsize=0.5,style="setlinewidth(0.5)"]; "freesurfer.ReconAll" [shape=ellipse,URL="#nipype.interfaces.freesurfer.ReconAll",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,fontsize=14,color=dodgerblue1,style=filled,height=0.75]; "freesurfer.FSCommandLine" -> "freesurfer.ReconAll" [arrowsize=0.5,style="setlinewidth(0.5)"]; "freesurfer.Dicom2Nifti" [shape=ellipse,URL="#nipype.interfaces.freesurfer.Dicom2Nifti",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,fontsize=14,color=dodgerblue1,style=filled,height=0.75]; "freesurfer.FSCommandLine" -> "freesurfer.Dicom2Nifti" [arrowsize=0.5,style="setlinewidth(0.5)"]; "freesurfer.OneSampleTTest" [shape=ellipse,URL="#nipype.interfaces.freesurfer.OneSampleTTest",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,fontsize=14,color=dodgerblue1,style=filled,height=0.75]; "fsl.FSLCommand" -> "freesurfer.OneSampleTTest" [arrowsize=0.5,style="setlinewidth(0.5)"]; "base.CommandLine" [shape=ellipse,URL="nipype.interfaces.base.html#nipype.interfaces.base.CommandLine",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,fontsize=14,color=dodgerblue1,style=filled,height=0.75]; "base.Interface" -> "base.CommandLine" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

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

Currently these tools are supported:

  • Dicom2Nifti: using mri_convert
  • Resample: using mri_convert

Examples

See the docstrings for the individual classes for ‘working’ examples.

Classes

ApplyVolTransform

class nipype.interfaces.freesurfer.ApplyVolTransform(*args, **inputs)

Bases: nipype.interfaces.fsl.FSLCommand

Use FreeSurfer mri_vol2vol to apply a transform.

Parameters:

To see optional arguments :

ApplyVolTransform().inputs_help() :

Examples

>>> from nipype.interfaces.freesurfer import ApplyVolTransform
>>> applyreg = ApplyVolTransform(tkreg='me.dat', sourcefile='foo.nii',                                      fstarg=True)
>>> applyreg.cmdline
'mri_vol2vol --fstarg --mov foo.nii --reg me.dat --o foo_warped.nii'
__init__(*args, **inputs)
aggregate_outputs()
cmd
sets base command, not editable
cmdline
validates fsl options and generates command line argument
get_input_info()
Provides information about inputs as a dict info = [Bunch(key=string,copy=bool,ext=’.nii’),...]
inputs_help()
Print command line documentation for mri_vol2vol.
outputs()
outfile: filename
Warped source file
outputs_help()
Print outputs help
run(**inputs)
Execute the command.

BBRegister

class nipype.interfaces.freesurfer.BBRegister(*args, **inputs)

Bases: nipype.interfaces.fsl.FSLCommand

Use FreeSurfer bbregister to register a volume two a surface mesh

This program performs within-subject, cross-modal registration using a boundary-based cost function. The registration is constrained to be 6 DOF (rigid). It is required that you have an anatomical scan of the subject that has been analyzed in freesurfer.

Parameters:

To see optional arguments :

BBRegister().inputs_help() :

Examples

>>> from nipype.interfaces.freesurfer import BBRegister
>>> bbreg = BBRegister(subject_id='me', sourcefile='foo.nii',                            init_header=True, t2_contrast=True)
>>> bbreg.cmdline
'bbregister --init-header --mov foo.nii --s me --t2 --reg foo_bbreg_me.dat'
__init__(*args, **inputs)
aggregate_outputs()
cmd
sets base command, not editable
cmdline
validates fsl options and generates command line argument
get_input_info()
Provides information about inputs as a dict info = [Bunch(key=string,copy=bool,ext=’.nii’),...]
inputs_help()
Print command line documentation for bbregister.
outputs()
outregfile: filename
Output registration file
outfile: filename
Registered and resampled source file
outputs_help()
Print outputs help
run(**inputs)
Execute the command.

Dicom2Nifti

class nipype.interfaces.freesurfer.Dicom2Nifti

Bases: nipype.interfaces.freesurfer.FSCommandLine

use fs mri_convert to convert dicom files to nifti-1 files

Parameters:

To see optional arguments :

Dicom2Nifti().inputs_help() :

Examples

>>> from nipype.interfaces import freesurfer
>>> cvt = freesurfer.Dicom2Nifti()
>>> cvt.inputs.dicomdir = '/software/data/STUT/RAWDATA/TrioTim-35115-20090428-081900-234000/'
>>> cvt.inputs.file_mapping = [('nifti','*.nii'),('info','dicom*.txt'),('dti','*dti.bv*')]
>>> #out = cvt.run() # commented out as above directories are not installed
__init__()
aggregate_outputs()
cmd
sets base command, not editable
cmdline
get_input_info()

Provides information about file inputs to copy or link to cwd.

Notes

see spm.Realign.get_input_info

inputs_help()
Parameters:

(all default to None and are unset) :

dicomdir : /path/to/dicomfiles

directory from which to convert dicom files

base_output_dir : /path/to/outputdir

base output directory in which subject specific directories are created to store the nifti files

subject_dir_template : string

template for subject directory name Default:’S.%04d’

subject_id : string or int

subject identifier to insert into template. For the example above template subject_identifier should be an integer. Default: id from Dicom file name

file_mapping : list of tuples

defines the output fields of interface and the kind of file type they store Example: [(‘niftifiles’,’.nii’),(‘dtiinfo’,’*mghdti.bv‘)]

flags = unsupported flags, use at your own risk :

run(**inputs)

Execute the command.

Returns:

results : InterfaceResult

A InterfaceResult object with a copy of self in interface

FSCommandLine

class nipype.interfaces.freesurfer.FSCommandLine

Bases: nipype.interfaces.base.CommandLine

__init__()
aggregate_outputs()

Called to populate outputs

Currently, search for discussion of this on private e-mails between Dav and Satra (ugh!). This needs to get in here!

cmdline
get_input_info()

Provides information about file inputs to copy or link to cwd.

Notes

see spm.Realign.get_input_info

run(**inputs)

Execute the command.

Returns:

results : InterfaceResult

A InterfaceResult object with a copy of self in interface

OneSampleTTest

class nipype.interfaces.freesurfer.OneSampleTTest(*args, **inputs)

Bases: nipype.interfaces.fsl.FSLCommand

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

Parameters:

To see optional arguments :

SurfConcat().inputs_help() :

__init__(*args, **inputs)
aggregate_outputs()
cmd
sets base command, not editable
cmdline
validates fsl options and generates command line argument
get_input_info()
Provides information about inputs as a dict info = [Bunch(key=string,copy=bool,ext=’.nii’),...]
inputs_help()
Print command line documentation for mris_preproc.
outputs()
outputs_help()
Print outputs help
run(cwd=None, **inputs)
Execute the command.

ReconAll

class nipype.interfaces.freesurfer.ReconAll

Bases: nipype.interfaces.freesurfer.FSCommandLine

Use FreeSurfer recon-all to generate surfaces and parcellations of structural data from an anatomical image of a subject.

Parameters:

To see optional arguments :

ReconAll().inputs_help() :

Examples

>>> from nipype.interfaces import freesurfer
>>> reconall = freesurfer.ReconAll()
>>> reconall.inputs.subject_id = 'foo'
>>> reconall.inputs.directive  = '-all'
>>> reconall.inputs.parent_dir = '.'
>>> reconall.inputs.T1files = 'structfile.nii'
>>> out = reconall.run() # doctest +SKIP
__init__()
aggregate_outputs()
cmd
sets base command, not editable
cmdline
get_input_info()

Provides information about file inputs to copy or link to cwd.

Notes

see spm.Realign.get_input_info

inputs_help()
Parameters:

(all default to None and are unset) :

T1files: filename(s) :

T1 file or list of files to extract surfaces from. The T1 files must come from the same subject

hemi: string :

just do lh or rh (default is to do both)

parent_dir: string :

defaults to SUBJECTS_DIR environment variable. If the variable is not set, it defaults to current working directory.

test: :

Do everything but execute each command

flags: :

unsupported flags, use at your own risk

outputs_help()
No outputs
run(**inputs)

Execute the command.

Returns:

results : InterfaceResult

A InterfaceResult object with a copy of self in interface

Resample

class nipype.interfaces.freesurfer.Resample

Bases: nipype.interfaces.freesurfer.FSCommandLine

Use FreeSurfer mri_convert to up or down-sample image files

Parameters:

To see optional arguments :

Resample().inputs_help() :

Examples

>>> from nipype.interfaces import freesurfer
>>> resampler = freesurfer.Resample()
>>> resampler.inputs.infile = 'infile.nii'
>>> resampler.inputs.voxel_size = [2, 2, 2]
>>> out = resampler.run()
__init__()
aggregate_outputs()
cmd
sets base command, not editable
cmdline
get_input_info()

Provides information about file inputs to copy or link to cwd.

Notes

see spm.Realign.get_input_info

inputs_help()
Parameters:

(all default to None and are unset) :

infile : string or list

file(s) to resample

voxel_size: 3-element list :

size of x, y and z voxels in mm of resampled image

outfile_postfix : string

string appended to input file name to generate output file name. Default: ‘_fsresample’

flags = unsupported flags, use at your own risk :

outputs_help()
outfile : string or list
resampled file(s)
run(**inputs)

Execute the command.

Returns:

results : InterfaceResult

A InterfaceResult object with a copy of self in interface

Smooth

class nipype.interfaces.freesurfer.Smooth(*args, **inputs)

Bases: nipype.interfaces.fsl.FSLCommand

Use FreeSurfer mris_volsmooth to smooth a volume

This function smoothes cortical regions on a surface and non-cortical regions in volume.

Parameters:

To see optional arguments :

Smooth().inputs_help() :

Examples

>>> from nipype.interfaces.freesurfer import Smooth
>>> smoothvol = Smooth(sourcefile='foo.nii', regfile='reg.dat',                            surface_fwhm=10, vol_fwhm=6)
>>> smoothvol.cmdline
'mris_volsmooth --reg reg.dat --i foo.nii --fwhm 10 --vol-fwhm 6 --o foo_surfsmooth.nii'
__init__(*args, **inputs)
aggregate_outputs()
cmd
sets base command, not editable
cmdline
validates fsl options and generates command line argument
get_input_info()
Provides information about inputs as a dict info = [Bunch(key=string,copy=bool,ext=’.nii’),...]
inputs_help()
Print command line documentation for mris_volsmooth.
outputs()
outfile: filename
Smoothed input volume
outputs_help()
Print outputs help
run(**inputs)
Execute the command.

SurfConcat

class nipype.interfaces.freesurfer.SurfConcat(*args, **inputs)

Bases: nipype.interfaces.fsl.FSLCommand

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

Parameters:

To see optional arguments :

SurfConcat().inputs_help() :

__init__(*args, **inputs)
aggregate_outputs()
cmd
sets base command, not editable
cmdline
validates fsl options and generates command line argument
get_input_info()
Provides information about inputs as a dict info = [Bunch(key=string,copy=bool,ext=’.nii’),...]
inputs_help()
Print command line documentation for mris_preproc.
outputs()
outfile: filename
Concatenated volume
outputs_help()
Print outputs help
run(**inputs)
Execute the command.

Functions

nipype.interfaces.freesurfer.freesurferversion()

Check for freesurfer version on system

Parameters:

None :

Returns:

version : string

version number as string or None if freesurfer version not found

nipype.interfaces.freesurfer.fssubjectsdir(subjects_dir=None)

Check and or set the global SUBJECTS_DIR

Parameters:

subjects_dir : string

The system defined subjects directory

Returns:

subject_dir : string

Represents the current environment setting of SUBJECTS_DIR