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/ Model tools are found in fsl/ DTI tools are found in fsl/

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


See the docstrings of the individual classes for examples.


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.

FSLCommand.references_ = [{'entry': None, 'tags': ['implementation']}]
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


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


fsl_ftype – Represents the current environment setting of FSLOUTPUTTYPE

Return type


classmethod output_type_to_ext(output_type)

Get the file extension for the given output type.


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


extension – The file extension for the output type.

Return type


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


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


check if fsl_course data is present