NIPY logo

Table Of Contents

Previous topic

nipype.interfaces.fsl.dti

Next topic

nipype.interfaces.fsl.model

This Page

nipype.interfaces.fsl.maths

ApplyMask

Wraps command fslmaths

Use fslmaths to apply a binary mask to another image.

Inputs:

[Mandatory]
in_file : (an existing file name)
        image to operate on
mask_file : (an existing file name)
        binary image defining mask space

[Optional]
args : (a string)
        Additional parameters to the command
environ : (a dictionary with keys which are a value of type 'str' and with values which are a value of type 'str')
        Environment variables
ignore_exception : (a boolean)
        Print an error message instead of throwing an exception in case the interface fails to run
internal_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for calculations (default is float)
out_file : (a file name)
        image to write
output_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for output (default uses input type)
output_type : ('NIFTI_PAIR' or 'NIFTI_PAIR_GZ' or 'NIFTI_GZ' or 'NIFTI')
        FSL output type

Outputs:

out_file : (an existing file name)
        image written after calculations

ApplyMaskInput

BinaryMaths

Wraps command fslmaths

Use fslmaths to perform mathematical operations using a second image or a numeric value.

Inputs:

[Mandatory]
in_file : (an existing file name)
        image to operate on
operand_file : (an existing file name)
        second image to perform operation with
        exclusive: operand_value
operand_value : (a float)
        value to perform operation with
        exclusive: operand_file
operation : ('add' or 'sub' or 'mul' or 'div' or 'rem' or 'max' or 'min')
        operation to perform

[Optional]
args : (a string)
        Additional parameters to the command
environ : (a dictionary with keys which are a value of type 'str' and with values which are a value of type 'str')
        Environment variables
ignore_exception : (a boolean)
        Print an error message instead of throwing an exception in case the interface fails to run
internal_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for calculations (default is float)
out_file : (a file name)
        image to write
output_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for output (default uses input type)
output_type : ('NIFTI_PAIR' or 'NIFTI_PAIR_GZ' or 'NIFTI_GZ' or 'NIFTI')
        FSL output type

Outputs:

out_file : (an existing file name)
        image written after calculations

BinaryMathsInput

ChangeDataType

Wraps command fslmaths

Use fslmaths to change the datatype of an image.

Inputs:

[Mandatory]
in_file : (an existing file name)
        image to operate on
output_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        output data type

[Optional]
args : (a string)
        Additional parameters to the command
environ : (a dictionary with keys which are a value of type 'str' and with values which are a value of type 'str')
        Environment variables
ignore_exception : (a boolean)
        Print an error message instead of throwing an exception in case the interface fails to run
internal_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for calculations (default is float)
out_file : (a file name)
        image to write
output_type : ('NIFTI_PAIR' or 'NIFTI_PAIR_GZ' or 'NIFTI_GZ' or 'NIFTI')
        FSL output type

Outputs:

out_file : (an existing file name)
        image written after calculations

ChangeDataTypeInput

DilateImage

Wraps command fslmaths

Use fslmaths to perform a spatial dilation of an image.

Inputs:

[Mandatory]
in_file : (an existing file name)
        image to operate on
operation : ('mean' or 'modal' or 'max')
        filtering operation to perfoem in dilation

[Optional]
args : (a string)
        Additional parameters to the command
environ : (a dictionary with keys which are a value of type 'str' and with values which are a value of type 'str')
        Environment variables
ignore_exception : (a boolean)
        Print an error message instead of throwing an exception in case the interface fails to run
internal_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for calculations (default is float)
kernel_file : (an existing file name)
        use external file for kernel
        exclusive: kernel_size
kernel_shape : ('3D' or '2D' or 'box' or 'boxv' or 'gauss' or 'sphere' or 'file')
        kernel shape to use
kernel_size : (a float)
        kernel size - voxels for box/boxv, mm for sphere, mm sigma for gauss
        exclusive: kernel_file
out_file : (a file name)
        image to write
output_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for output (default uses input type)
output_type : ('NIFTI_PAIR' or 'NIFTI_PAIR_GZ' or 'NIFTI_GZ' or 'NIFTI')
        FSL output type

Outputs:

out_file : (an existing file name)
        image written after calculations

DilateInput

ErodeImage

Wraps command fslmaths

Use fslmaths to perform a spatial erosion of an image.

Inputs:

[Mandatory]
in_file : (an existing file name)
        image to operate on

[Optional]
args : (a string)
        Additional parameters to the command
environ : (a dictionary with keys which are a value of type 'str' and with values which are a value of type 'str')
        Environment variables
ignore_exception : (a boolean)
        Print an error message instead of throwing an exception in case the interface fails to run
internal_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for calculations (default is float)
kernel_file : (an existing file name)
        use external file for kernel
        exclusive: kernel_size
kernel_shape : ('3D' or '2D' or 'box' or 'boxv' or 'gauss' or 'sphere' or 'file')
        kernel shape to use
kernel_size : (a float)
        kernel size - voxels for box/boxv, mm for sphere, mm sigma for gauss
        exclusive: kernel_file
minimum_filter : (a boolean)
        if true, minimum filter rather than erosion by zeroing-out
out_file : (a file name)
        image to write
output_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for output (default uses input type)
output_type : ('NIFTI_PAIR' or 'NIFTI_PAIR_GZ' or 'NIFTI_GZ' or 'NIFTI')
        FSL output type

Outputs:

out_file : (an existing file name)
        image written after calculations

ErodeInput

IsotropicSmooth

Wraps command fslmaths

Use fslmaths to spatially smooth an image with a gaussian kernel.

Inputs:

[Mandatory]
fwhm : (a float)
        fwhm of smoothing kernel
        exclusive: sigma
in_file : (an existing file name)
        image to operate on
sigma : (a float)
        sigma of smoothing kernel
        exclusive: fwhm

[Optional]
args : (a string)
        Additional parameters to the command
environ : (a dictionary with keys which are a value of type 'str' and with values which are a value of type 'str')
        Environment variables
ignore_exception : (a boolean)
        Print an error message instead of throwing an exception in case the interface fails to run
internal_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for calculations (default is float)
out_file : (a file name)
        image to write
output_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for output (default uses input type)
output_type : ('NIFTI_PAIR' or 'NIFTI_PAIR_GZ' or 'NIFTI_GZ' or 'NIFTI')
        FSL output type

Outputs:

out_file : (an existing file name)
        image written after calculations

IsotropicSmoothInput

KernelInput

MathsCommand

Wraps command fslmaths

Inputs:

[Mandatory]
in_file : (an existing file name)
        image to operate on

[Optional]
args : (a string)
        Additional parameters to the command
environ : (a dictionary with keys which are a value of type 'str' and with values which are a value of type 'str')
        Environment variables
ignore_exception : (a boolean)
        Print an error message instead of throwing an exception in case the interface fails to run
internal_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for calculations (default is float)
out_file : (a file name)
        image to write
output_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for output (default uses input type)
output_type : ('NIFTI_PAIR' or 'NIFTI_PAIR_GZ' or 'NIFTI_GZ' or 'NIFTI')
        FSL output type

Outputs:

out_file : (an existing file name)
        image written after calculations

MathsInput

MathsOutput

MeanImage

Wraps command fslmaths

Use fslmaths to generate a mean image across a given dimension.

Inputs:

[Mandatory]
in_file : (an existing file name)
        image to operate on

[Optional]
args : (a string)
        Additional parameters to the command
dimension : ('T' or 'X' or 'Y' or 'Z')
        dimension to mean across
environ : (a dictionary with keys which are a value of type 'str' and with values which are a value of type 'str')
        Environment variables
ignore_exception : (a boolean)
        Print an error message instead of throwing an exception in case the interface fails to run
internal_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for calculations (default is float)
out_file : (a file name)
        image to write
output_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for output (default uses input type)
output_type : ('NIFTI_PAIR' or 'NIFTI_PAIR_GZ' or 'NIFTI_GZ' or 'NIFTI')
        FSL output type

Outputs:

out_file : (an existing file name)
        image written after calculations

MeanImageInput

MultiImageMaths

Wraps command fslmaths

Use fslmaths to perform a sequence of mathematical operations.

Examples

from nipype.interfaces.fsl import MultiImageMaths maths = MultiImageMaths() maths.inputs.in_file = “functional.nii” maths.inputs.op_string = “-add %s -mul -1 -div %s” maths.inputs.operand_files = [“functional2.nii”, “functional3.nii”] maths.inputs.out_file = functional4.nii maths.cmdline fslmaths functional1.nii -add functional2.nii -mul -1 -div functional3.nii functional4.nii

Inputs:

[Mandatory]
in_file : (an existing file name)
        image to operate on
op_string : (a string)
        python formatted string of operations to perform
operand_files : (an existing file name)
        list of file names to plug into op string

[Optional]
args : (a string)
        Additional parameters to the command
environ : (a dictionary with keys which are a value of type 'str' and with values which are a value of type 'str')
        Environment variables
ignore_exception : (a boolean)
        Print an error message instead of throwing an exception in case the interface fails to run
internal_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for calculations (default is float)
out_file : (a file name)
        image to write
output_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for output (default uses input type)
output_type : ('NIFTI_PAIR' or 'NIFTI_PAIR_GZ' or 'NIFTI_GZ' or 'NIFTI')
        FSL output type

Outputs:

out_file : (an existing file name)
        image written after calculations

MultiImageMathsInput

SpatialFilter

Wraps command fslmaths

Use fslmaths to spatially filter an image.

Inputs:

[Mandatory]
in_file : (an existing file name)
        image to operate on
operation : ('mean' or 'median' or 'meanu')
        operation to filter with

[Optional]
args : (a string)
        Additional parameters to the command
environ : (a dictionary with keys which are a value of type 'str' and with values which are a value of type 'str')
        Environment variables
ignore_exception : (a boolean)
        Print an error message instead of throwing an exception in case the interface fails to run
internal_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for calculations (default is float)
kernel_file : (an existing file name)
        use external file for kernel
        exclusive: kernel_size
kernel_shape : ('3D' or '2D' or 'box' or 'boxv' or 'gauss' or 'sphere' or 'file')
        kernel shape to use
kernel_size : (a float)
        kernel size - voxels for box/boxv, mm for sphere, mm sigma for gauss
        exclusive: kernel_file
out_file : (a file name)
        image to write
output_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for output (default uses input type)
output_type : ('NIFTI_PAIR' or 'NIFTI_PAIR_GZ' or 'NIFTI_GZ' or 'NIFTI')
        FSL output type

Outputs:

out_file : (an existing file name)
        image written after calculations

SpatialFilterInput

TemporalFilter

Wraps command fslmaths

Use fslmaths to apply a low, high, or bandpass temporal filter to a timeseries.

Inputs:

[Mandatory]
in_file : (an existing file name)
        image to operate on

[Optional]
args : (a string)
        Additional parameters to the command
environ : (a dictionary with keys which are a value of type 'str' and with values which are a value of type 'str')
        Environment variables
highpass_sigma : (a float)
        highpass filter sigma (in volumes)
ignore_exception : (a boolean)
        Print an error message instead of throwing an exception in case the interface fails to run
internal_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for calculations (default is float)
lowpass_sigma : (a float)
        lowpass filter sigma (in volumes)
out_file : (a file name)
        image to write
output_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for output (default uses input type)
output_type : ('NIFTI_PAIR' or 'NIFTI_PAIR_GZ' or 'NIFTI_GZ' or 'NIFTI')
        FSL output type

Outputs:

out_file : (an existing file name)
        image written after calculations

TemporalFilterInput

Threshold

Wraps command fslmaths

Use fslmaths to apply a threshold to an image in a variety of ways.

Inputs:

[Mandatory]
in_file : (an existing file name)
        image to operate on
thresh : (a float)
        threshold value

[Optional]
args : (a string)
        Additional parameters to the command
direction : ('below' or 'above')
        zero-out either below or above thresh value
environ : (a dictionary with keys which are a value of type 'str' and with values which are a value of type 'str')
        Environment variables
ignore_exception : (a boolean)
        Print an error message instead of throwing an exception in case the interface fails to run
internal_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for calculations (default is float)
out_file : (a file name)
        image to write
output_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for output (default uses input type)
output_type : ('NIFTI_PAIR' or 'NIFTI_PAIR_GZ' or 'NIFTI_GZ' or 'NIFTI')
        FSL output type
use_nonzero_voxels : (a boolean)
        use nonzero voxels to caluclate robust range
        requires: use_robust_range
use_robust_range : (a boolean)
        inteperet thresh as percentage (0-100) of robust range

Outputs:

out_file : (an existing file name)
        image written after calculations

UnaryMaths

Wraps command fslmaths

Use fslmaths to perorm a variety of mathematical operations on an image.

Inputs:

[Mandatory]
in_file : (an existing file name)
        image to operate on
operation : ('exp' or 'log' or 'sin' or 'cos' or 'sqr' or 'sqrt' or 'recip' or 'abs' or 'bin' or 'index')
        operation to perform

[Optional]
args : (a string)
        Additional parameters to the command
environ : (a dictionary with keys which are a value of type 'str' and with values which are a value of type 'str')
        Environment variables
ignore_exception : (a boolean)
        Print an error message instead of throwing an exception in case the interface fails to run
internal_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for calculations (default is float)
out_file : (a file name)
        image to write
output_datatype : ('float' or 'char' or 'int' or 'short' or 'double' or 'input')
        datatype to use for output (default uses input type)
output_type : ('NIFTI_PAIR' or 'NIFTI_PAIR_GZ' or 'NIFTI_GZ' or 'NIFTI')
        FSL output type

Outputs:

out_file : (an existing file name)
        image written after calculations

UnaryMathsInput