nipype.interfaces.fsl.base module

The fsl module provides classes for interfacing with the FSL command line tools. This was written to work with FSL version 4.1.4.

These are the base tools for working with FSL. Preprocessing tools are found in fsl/preprocess.py Model tools are found in fsl/model.py DTI tools are found in fsl/dti.py

XXX Make this doc current!

Currently these tools are supported:

  • BET v2.1: brain extraction

  • FAST v4.1: segmentation and bias correction

  • FLIRT v5.5: linear registration

  • MCFLIRT: motion correction

  • FNIRT v1.0: non-linear warp

Examples

See the docstrings of the individual classes for examples.

FSLCommand

Link to code

Bases: CommandLine

Base support for FSL commands.

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: {})

  • output_type (‘NIFTI’ or ‘NIFTI_PAIR’ or ‘NIFTI_GZ’ or ‘NIFTI_PAIR_GZ’) – FSL output type.

classmethod FSLCommand.set_default_output_type(output_type)

Set the default output type for FSL classes.

This method is used to set the default output type for all fSL subclasses. However, setting this will not update the output type for any existing instances. For these, assign the <instance>.inputs.output_type.

property FSLCommand.version

interfaces should implement a version property

class nipype.interfaces.fsl.base.Info

Bases: nipype.interfaces.base.core.PackageInfo

Handle FSL output_type and version information.

output type refers to the type of file fsl defaults to writing eg, NIFTI, NIFTI_GZ

Examples

>>> from nipype.interfaces.fsl import Info
>>> Info.version()  
>>> Info.output_type()  
ftypes = {'NIFTI': '.nii', 'NIFTI_GZ': '.nii.gz', 'NIFTI_PAIR': '.img', 'NIFTI_PAIR_GZ': '.img.gz'}
classmethod output_type()

Get the global FSL output file type FSLOUTPUTTYPE.

This returns the value of the environment variable FSLOUTPUTTYPE. An exception is raised if it is not defined.

Returns:

fsl_ftype – Represents the current environment setting of FSLOUTPUTTYPE

Return type:

string

classmethod output_type_to_ext(output_type)

Get the file extension for the given output type.

Parameters:

output_type ({‘NIFTI’, ‘NIFTI_GZ’, ‘NIFTI_PAIR’, ‘NIFTI_PAIR_GZ’}) – String specifying the output type.

Returns:

extension – The file extension for the output type.

Return type:

str

static parse_version(raw_info)
static standard_image(img_name=None)

Grab an image from the standard location.

Returns a list of standard images if called without arguments.

Could be made more fancy to allow for more relocatability

nipype.interfaces.fsl.base.check_fsl()
nipype.interfaces.fsl.base.no_fsl()

Checks if FSL is NOT installed used with skipif to skip tests that will fail if FSL is not installed

nipype.interfaces.fsl.base.no_fsl_course_data()

check if fsl_course data is present