nipype.interfaces.freesurfer.base module¶
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.
FSCommand¶
Bases: CommandLine
General support for FreeSurfer commands.
Every FS command accepts ‘subjects_dir’ input.
- Optional Inputs
args (a string) – Additional parameters to the command. Maps to a command-line argument:
%s
.environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value:
{}
)subjects_dir (a pathlike object or string representing an existing directory) – Subjects directory.
- FSCommand.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
- classmethod FSCommand.set_default_subjects_dir(subjects_dir)¶
- property FSCommand.version¶
interfaces should implement a version property
FSCommandOpenMP¶
Bases: FSCommand
Support for FS commands that utilize OpenMP
Sets the environment variable ‘OMP_NUM_THREADS’ to the number of threads specified by the input num_threads.
- Optional Inputs
args (a string) – Additional parameters to the command. Maps to a command-line argument:
%s
.environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value:
{}
)num_threads (an integer) – Allows for specifying more threads.
subjects_dir (a pathlike object or string representing an existing directory) – Subjects directory.
- FSCommandOpenMP.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
FSScriptCommand¶
Bases: FSCommand
Support for Freesurfer script commands with log terminal_output
- Optional Inputs
args (a string) – Additional parameters to the command. Maps to a command-line argument:
%s
.environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value:
{}
)subjects_dir (a pathlike object or string representing an existing directory) – Subjects directory.
FSSurfaceCommand¶
Bases: FSCommand
Support for FreeSurfer surface-related functions. For some functions, if the output file is not specified starting with ‘lh.’ or ‘rh.’, FreeSurfer prepends the prefix from the input file to the output filename. Output out_file must be adjusted to accommodate this. By including the full path in the filename, we can also avoid this behavior.
- Optional Inputs
args (a string) – Additional parameters to the command. Maps to a command-line argument:
%s
.environ (a dictionary with keys which are a bytes or None or a value of class ‘str’ and with values which are a bytes or None or a value of class ‘str’) – Environment variables. (Nipype default value:
{}
)subjects_dir (a pathlike object or string representing an existing directory) – Subjects directory.
- class nipype.interfaces.freesurfer.base.Info¶
Bases:
nipype.interfaces.base.core.PackageInfo
Freesurfer subject directory and version information.
Examples
>>> from nipype.interfaces.freesurfer import Info >>> Info.version() >>> Info.subjectsdir()
- classmethod looseversion()¶
Return a comparable version object
If no version found, use LooseVersion(‘0.0.0’)
- static parse_version(raw_info)¶
- classmethod subjectsdir()¶
Check the global SUBJECTS_DIR
- Parameters
subjects_dir (string) – The system defined subjects directory
- Returns
subject_dir – Represents the current environment setting of SUBJECTS_DIR
- Return type
string
- nipype.interfaces.freesurfer.base.no_freesurfer()¶
Checks if FreeSurfer is NOT installed used with skipif to skip tests that will fail if FreeSurfer is not installed