nipype.interfaces.fsl.maths module

The maths module provides higher-level interfaces to some of the operations that can be performed with the fslmaths command-line program.

AR1Image

Link to code

Bases: MathsCommand

Wrapped executable: fslmaths.

Use fslmaths to generate an AR1 coefficient image across a given dimension. (Should use -odt float and probably demean first)

Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – Image to operate on. Maps to a command-line argument: %s (position: 2).

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • dimension (‘T’ or ‘X’ or ‘Y’ or ‘Z’) – Dimension to find AR(1) coefficient across. Maps to a command-line argument: -%sar1 (position: 4). (Nipype default value: T)

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

  • internal_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for calculations (default is float). Maps to a command-line argument: -dt %s (position: 1).

  • nan2zeros (a boolean) – Change NaNs to zeros before doing anything. Maps to a command-line argument: -nan (position: 3).

  • out_file (a pathlike object or string representing a file) – Image to write. Maps to a command-line argument: %s (position: -2).

  • output_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for output (default uses input type). Maps to a command-line argument: -odt %s (position: -1).

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

Outputs:

out_file (a pathlike object or string representing a file) – Image written after calculations.

ApplyMask

Link to code

Bases: MathsCommand

Wrapped executable: fslmaths.

Use fslmaths to apply a binary mask to another image.

Mandatory Inputs:
  • in_file (a pathlike object or string representing an existing file) – Image to operate on. Maps to a command-line argument: %s (position: 2).

  • mask_file (a pathlike object or string representing an existing file) – Binary image defining mask space. Maps to a command-line argument: -mas %s (position: 4).

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

  • internal_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for calculations (default is float). Maps to a command-line argument: -dt %s (position: 1).

  • nan2zeros (a boolean) – Change NaNs to zeros before doing anything. Maps to a command-line argument: -nan (position: 3).

  • out_file (a pathlike object or string representing a file) – Image to write. Maps to a command-line argument: %s (position: -2).

  • output_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for output (default uses input type). Maps to a command-line argument: -odt %s (position: -1).

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

Outputs:

out_file (a pathlike object or string representing a file) – Image written after calculations.

BinaryMaths

Link to code

Bases: MathsCommand

Wrapped executable: fslmaths.

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

Mandatory Inputs:
  • in_file (a pathlike object or string representing an existing file) – Image to operate on. Maps to a command-line argument: %s (position: 2).

  • operand_file (a pathlike object or string representing an existing file) – Second image to perform operation with. Maps to a command-line argument: %s (position: 5). Mutually exclusive with inputs: operand_value.

  • operand_value (a float) – Value to perform operation with. Maps to a command-line argument: %.8f (position: 5). Mutually exclusive with inputs: operand_file.

  • operation (‘add’ or ‘sub’ or ‘mul’ or ‘div’ or ‘rem’ or ‘max’ or ‘min’) – Operation to perform. Maps to a command-line argument: -%s (position: 4).

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

  • internal_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for calculations (default is float). Maps to a command-line argument: -dt %s (position: 1).

  • nan2zeros (a boolean) – Change NaNs to zeros before doing anything. Maps to a command-line argument: -nan (position: 3).

  • out_file (a pathlike object or string representing a file) – Image to write. Maps to a command-line argument: %s (position: -2).

  • output_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for output (default uses input type). Maps to a command-line argument: -odt %s (position: -1).

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

Outputs:

out_file (a pathlike object or string representing a file) – Image written after calculations.

ChangeDataType

Link to code

Bases: MathsCommand

Wrapped executable: fslmaths.

Use fslmaths to change the datatype of an image.

Mandatory Inputs:
  • in_file (a pathlike object or string representing an existing file) – Image to operate on. Maps to a command-line argument: %s (position: 2).

  • output_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Output data type. Maps to a command-line argument: -odt %s (position: -1).

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

  • internal_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for calculations (default is float). Maps to a command-line argument: -dt %s (position: 1).

  • nan2zeros (a boolean) – Change NaNs to zeros before doing anything. Maps to a command-line argument: -nan (position: 3).

  • out_file (a pathlike object or string representing a file) – Image to write. Maps to a command-line argument: %s (position: -2).

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

Outputs:

out_file (a pathlike object or string representing a file) – Image written after calculations.

DilateImage

Link to code

Bases: MathsCommand

Wrapped executable: fslmaths.

Use fslmaths to perform a spatial dilation of an image.

Mandatory Inputs:
  • in_file (a pathlike object or string representing an existing file) – Image to operate on. Maps to a command-line argument: %s (position: 2).

  • operation (‘mean’ or ‘modal’ or ‘max’) – Filtering operation to perform in dilation. Maps to a command-line argument: -dil%s (position: 6).

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

  • internal_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for calculations (default is float). Maps to a command-line argument: -dt %s (position: 1).

  • kernel_file (a pathlike object or string representing an existing file) – Use external file for kernel. Maps to a command-line argument: %s (position: 5). Mutually exclusive with inputs: kernel_size.

  • kernel_shape (‘3D’ or ‘2D’ or ‘box’ or ‘boxv’ or ‘gauss’ or ‘sphere’ or ‘file’) – Kernel shape to use. Maps to a command-line argument: -kernel %s (position: 4).

  • kernel_size (a float) – Kernel size - voxels for box/boxv, mm for sphere, mm sigma for gauss. Maps to a command-line argument: %.4f (position: 5). Mutually exclusive with inputs: kernel_file.

  • nan2zeros (a boolean) – Change NaNs to zeros before doing anything. Maps to a command-line argument: -nan (position: 3).

  • out_file (a pathlike object or string representing a file) – Image to write. Maps to a command-line argument: %s (position: -2).

  • output_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for output (default uses input type). Maps to a command-line argument: -odt %s (position: -1).

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

Outputs:

out_file (a pathlike object or string representing a file) – Image written after calculations.

ErodeImage

Link to code

Bases: MathsCommand

Wrapped executable: fslmaths.

Use fslmaths to perform a spatial erosion of an image.

Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – Image to operate on. Maps to a command-line argument: %s (position: 2).

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

  • internal_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for calculations (default is float). Maps to a command-line argument: -dt %s (position: 1).

  • kernel_file (a pathlike object or string representing an existing file) – Use external file for kernel. Maps to a command-line argument: %s (position: 5). Mutually exclusive with inputs: kernel_size.

  • kernel_shape (‘3D’ or ‘2D’ or ‘box’ or ‘boxv’ or ‘gauss’ or ‘sphere’ or ‘file’) – Kernel shape to use. Maps to a command-line argument: -kernel %s (position: 4).

  • kernel_size (a float) – Kernel size - voxels for box/boxv, mm for sphere, mm sigma for gauss. Maps to a command-line argument: %.4f (position: 5). Mutually exclusive with inputs: kernel_file.

  • minimum_filter (a boolean) – If true, minimum filter rather than erosion by zeroing-out. Maps to a command-line argument: %s (position: 6). (Nipype default value: False)

  • nan2zeros (a boolean) – Change NaNs to zeros before doing anything. Maps to a command-line argument: -nan (position: 3).

  • out_file (a pathlike object or string representing a file) – Image to write. Maps to a command-line argument: %s (position: -2).

  • output_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for output (default uses input type). Maps to a command-line argument: -odt %s (position: -1).

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

Outputs:

out_file (a pathlike object or string representing a file) – Image written after calculations.

IsotropicSmooth

Link to code

Bases: MathsCommand

Wrapped executable: fslmaths.

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

Mandatory Inputs:
  • fwhm (a float) – Fwhm of smoothing kernel [mm]. Maps to a command-line argument: -s %.5f (position: 4). Mutually exclusive with inputs: sigma.

  • in_file (a pathlike object or string representing an existing file) – Image to operate on. Maps to a command-line argument: %s (position: 2).

  • sigma (a float) – Sigma of smoothing kernel [mm]. Maps to a command-line argument: -s %.5f (position: 4). Mutually exclusive with inputs: fwhm.

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

  • internal_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for calculations (default is float). Maps to a command-line argument: -dt %s (position: 1).

  • nan2zeros (a boolean) – Change NaNs to zeros before doing anything. Maps to a command-line argument: -nan (position: 3).

  • out_file (a pathlike object or string representing a file) – Image to write. Maps to a command-line argument: %s (position: -2).

  • output_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for output (default uses input type). Maps to a command-line argument: -odt %s (position: -1).

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

Outputs:

out_file (a pathlike object or string representing a file) – Image written after calculations.

MathsCommand

Link to code

Bases: FSLCommand

Wrapped executable: fslmaths.

Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – Image to operate on. Maps to a command-line argument: %s (position: 2).

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

  • internal_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for calculations (default is float). Maps to a command-line argument: -dt %s (position: 1).

  • nan2zeros (a boolean) – Change NaNs to zeros before doing anything. Maps to a command-line argument: -nan (position: 3).

  • out_file (a pathlike object or string representing a file) – Image to write. Maps to a command-line argument: %s (position: -2).

  • output_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for output (default uses input type). Maps to a command-line argument: -odt %s (position: -1).

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

Outputs:

out_file (a pathlike object or string representing a file) – Image written after calculations.

MaxImage

Link to code

Bases: MathsCommand

Wrapped executable: fslmaths.

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

Examples

>>> from nipype.interfaces.fsl.maths import MaxImage
>>> maxer = MaxImage()
>>> maxer.inputs.in_file = "functional.nii"  
>>> maxer.dimension = "T"
>>> maxer.cmdline  
'fslmaths functional.nii -Tmax functional_max.nii'
Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – Image to operate on. Maps to a command-line argument: %s (position: 2).

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • dimension (‘T’ or ‘X’ or ‘Y’ or ‘Z’) – Dimension to max across. Maps to a command-line argument: -%smax (position: 4). (Nipype default value: T)

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

  • internal_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for calculations (default is float). Maps to a command-line argument: -dt %s (position: 1).

  • nan2zeros (a boolean) – Change NaNs to zeros before doing anything. Maps to a command-line argument: -nan (position: 3).

  • out_file (a pathlike object or string representing a file) – Image to write. Maps to a command-line argument: %s (position: -2).

  • output_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for output (default uses input type). Maps to a command-line argument: -odt %s (position: -1).

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

Outputs:

out_file (a pathlike object or string representing a file) – Image written after calculations.

MaxnImage

Link to code

Bases: MathsCommand

Wrapped executable: fslmaths.

Use fslmaths to generate an image of index of max across a given dimension.

Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – Image to operate on. Maps to a command-line argument: %s (position: 2).

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • dimension (‘T’ or ‘X’ or ‘Y’ or ‘Z’) – Dimension to index max across. Maps to a command-line argument: -%smaxn (position: 4). (Nipype default value: T)

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

  • internal_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for calculations (default is float). Maps to a command-line argument: -dt %s (position: 1).

  • nan2zeros (a boolean) – Change NaNs to zeros before doing anything. Maps to a command-line argument: -nan (position: 3).

  • out_file (a pathlike object or string representing a file) – Image to write. Maps to a command-line argument: %s (position: -2).

  • output_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for output (default uses input type). Maps to a command-line argument: -odt %s (position: -1).

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

Outputs:

out_file (a pathlike object or string representing a file) – Image written after calculations.

MeanImage

Link to code

Bases: MathsCommand

Wrapped executable: fslmaths.

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

Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – Image to operate on. Maps to a command-line argument: %s (position: 2).

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • dimension (‘T’ or ‘X’ or ‘Y’ or ‘Z’) – Dimension to mean across. Maps to a command-line argument: -%smean (position: 4). (Nipype default value: T)

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

  • internal_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for calculations (default is float). Maps to a command-line argument: -dt %s (position: 1).

  • nan2zeros (a boolean) – Change NaNs to zeros before doing anything. Maps to a command-line argument: -nan (position: 3).

  • out_file (a pathlike object or string representing a file) – Image to write. Maps to a command-line argument: %s (position: -2).

  • output_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for output (default uses input type). Maps to a command-line argument: -odt %s (position: -1).

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

Outputs:

out_file (a pathlike object or string representing a file) – Image written after calculations.

MedianImage

Link to code

Bases: MathsCommand

Wrapped executable: fslmaths.

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

Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – Image to operate on. Maps to a command-line argument: %s (position: 2).

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • dimension (‘T’ or ‘X’ or ‘Y’ or ‘Z’) – Dimension to median across. Maps to a command-line argument: -%smedian (position: 4). (Nipype default value: T)

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

  • internal_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for calculations (default is float). Maps to a command-line argument: -dt %s (position: 1).

  • nan2zeros (a boolean) – Change NaNs to zeros before doing anything. Maps to a command-line argument: -nan (position: 3).

  • out_file (a pathlike object or string representing a file) – Image to write. Maps to a command-line argument: %s (position: -2).

  • output_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for output (default uses input type). Maps to a command-line argument: -odt %s (position: -1).

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

Outputs:

out_file (a pathlike object or string representing a file) – Image written after calculations.

MinImage

Link to code

Bases: MathsCommand

Wrapped executable: fslmaths.

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

Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – Image to operate on. Maps to a command-line argument: %s (position: 2).

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • dimension (‘T’ or ‘X’ or ‘Y’ or ‘Z’) – Dimension to min across. Maps to a command-line argument: -%smin (position: 4). (Nipype default value: T)

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

  • internal_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for calculations (default is float). Maps to a command-line argument: -dt %s (position: 1).

  • nan2zeros (a boolean) – Change NaNs to zeros before doing anything. Maps to a command-line argument: -nan (position: 3).

  • out_file (a pathlike object or string representing a file) – Image to write. Maps to a command-line argument: %s (position: -2).

  • output_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for output (default uses input type). Maps to a command-line argument: -odt %s (position: -1).

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

Outputs:

out_file (a pathlike object or string representing a file) – Image written after calculations.

MultiImageMaths

Link to code

Bases: MathsCommand

Wrapped executable: 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 functional.nii -add functional2.nii -mul -1 -div functional3.nii functional4.nii'
Mandatory Inputs:
  • in_file (a pathlike object or string representing an existing file) – Image to operate on. Maps to a command-line argument: %s (position: 2).

  • op_string (a string) – Python formatted string of operations to perform. Maps to a command-line argument: %s (position: 4).

  • operand_files (a list of items which are a pathlike object or string representing an existing file) – List of file names to plug into op string.

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

  • internal_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for calculations (default is float). Maps to a command-line argument: -dt %s (position: 1).

  • nan2zeros (a boolean) – Change NaNs to zeros before doing anything. Maps to a command-line argument: -nan (position: 3).

  • out_file (a pathlike object or string representing a file) – Image to write. Maps to a command-line argument: %s (position: -2).

  • output_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for output (default uses input type). Maps to a command-line argument: -odt %s (position: -1).

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

Outputs:

out_file (a pathlike object or string representing a file) – Image written after calculations.

PercentileImage

Link to code

Bases: MathsCommand

Wrapped executable: fslmaths.

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

Examples

>>> from nipype.interfaces.fsl.maths import MaxImage
>>> percer = PercentileImage()
>>> percer.inputs.in_file = "functional.nii"  
>>> percer.dimension = "T"
>>> percer.perc = 90
>>> percer.cmdline  
'fslmaths functional.nii -Tperc 90 functional_perc.nii'
Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – Image to operate on. Maps to a command-line argument: %s (position: 2).

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • dimension (‘T’ or ‘X’ or ‘Y’ or ‘Z’) – Dimension to percentile across. Maps to a command-line argument: -%sperc (position: 4). (Nipype default value: T)

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

  • internal_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for calculations (default is float). Maps to a command-line argument: -dt %s (position: 1).

  • nan2zeros (a boolean) – Change NaNs to zeros before doing anything. Maps to a command-line argument: -nan (position: 3).

  • out_file (a pathlike object or string representing a file) – Image to write. Maps to a command-line argument: %s (position: -2).

  • output_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for output (default uses input type). Maps to a command-line argument: -odt %s (position: -1).

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

  • perc (0 <= an integer <= 100) – Nth percentile (0-100) of FULL RANGE across dimension. Maps to a command-line argument: %f (position: 5).

Outputs:

out_file (a pathlike object or string representing a file) – Image written after calculations.

SpatialFilter

Link to code

Bases: MathsCommand

Wrapped executable: fslmaths.

Use fslmaths to spatially filter an image.

Mandatory Inputs:
  • in_file (a pathlike object or string representing an existing file) – Image to operate on. Maps to a command-line argument: %s (position: 2).

  • operation (‘mean’ or ‘median’ or ‘meanu’) – Operation to filter with. Maps to a command-line argument: -f%s (position: 6).

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

  • internal_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for calculations (default is float). Maps to a command-line argument: -dt %s (position: 1).

  • kernel_file (a pathlike object or string representing an existing file) – Use external file for kernel. Maps to a command-line argument: %s (position: 5). Mutually exclusive with inputs: kernel_size.

  • kernel_shape (‘3D’ or ‘2D’ or ‘box’ or ‘boxv’ or ‘gauss’ or ‘sphere’ or ‘file’) – Kernel shape to use. Maps to a command-line argument: -kernel %s (position: 4).

  • kernel_size (a float) – Kernel size - voxels for box/boxv, mm for sphere, mm sigma for gauss. Maps to a command-line argument: %.4f (position: 5). Mutually exclusive with inputs: kernel_file.

  • nan2zeros (a boolean) – Change NaNs to zeros before doing anything. Maps to a command-line argument: -nan (position: 3).

  • out_file (a pathlike object or string representing a file) – Image to write. Maps to a command-line argument: %s (position: -2).

  • output_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for output (default uses input type). Maps to a command-line argument: -odt %s (position: -1).

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

Outputs:

out_file (a pathlike object or string representing a file) – Image written after calculations.

StdImage

Link to code

Bases: MathsCommand

Wrapped executable: fslmaths.

Use fslmaths to generate a standard deviation in an image across a given dimension.

Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – Image to operate on. Maps to a command-line argument: %s (position: 2).

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • dimension (‘T’ or ‘X’ or ‘Y’ or ‘Z’) – Dimension to standard deviate across. Maps to a command-line argument: -%sstd (position: 4). (Nipype default value: T)

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

  • internal_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for calculations (default is float). Maps to a command-line argument: -dt %s (position: 1).

  • nan2zeros (a boolean) – Change NaNs to zeros before doing anything. Maps to a command-line argument: -nan (position: 3).

  • out_file (a pathlike object or string representing a file) – Image to write. Maps to a command-line argument: %s (position: -2).

  • output_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for output (default uses input type). Maps to a command-line argument: -odt %s (position: -1).

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

Outputs:

out_file (a pathlike object or string representing a file) – Image written after calculations.

TemporalFilter

Link to code

Bases: MathsCommand

Wrapped executable: fslmaths.

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

Mandatory Inputs:

in_file (a pathlike object or string representing an existing file) – Image to operate on. Maps to a command-line argument: %s (position: 2).

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

  • highpass_sigma (a float) – Highpass filter sigma (in volumes). Maps to a command-line argument: -bptf %.6f (position: 4). (Nipype default value: -1)

  • internal_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for calculations (default is float). Maps to a command-line argument: -dt %s (position: 1).

  • lowpass_sigma (a float) – Lowpass filter sigma (in volumes). Maps to a command-line argument: %.6f (position: 5). (Nipype default value: -1)

  • nan2zeros (a boolean) – Change NaNs to zeros before doing anything. Maps to a command-line argument: -nan (position: 3).

  • out_file (a pathlike object or string representing a file) – Image to write. Maps to a command-line argument: %s (position: -2).

  • output_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for output (default uses input type). Maps to a command-line argument: -odt %s (position: -1).

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

Outputs:

out_file (a pathlike object or string representing a file) – Image written after calculations.

Threshold

Link to code

Bases: MathsCommand

Wrapped executable: fslmaths.

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

Mandatory Inputs:
  • in_file (a pathlike object or string representing an existing file) – Image to operate on. Maps to a command-line argument: %s (position: 2).

  • thresh (a float) – Threshold value. Maps to a command-line argument: %s (position: 4).

Optional Inputs:
  • args (a string) – Additional parameters to the command. Maps to a command-line argument: %s.

  • direction (‘below’ or ‘above’) – Zero-out either below or above thresh value. (Nipype default value: below)

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

  • internal_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for calculations (default is float). Maps to a command-line argument: -dt %s (position: 1).

  • nan2zeros (a boolean) – Change NaNs to zeros before doing anything. Maps to a command-line argument: -nan (position: 3).

  • out_file (a pathlike object or string representing a file) – Image to write. Maps to a command-line argument: %s (position: -2).

  • output_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for output (default uses input type). Maps to a command-line argument: -odt %s (position: -1).

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

  • use_nonzero_voxels (a boolean) – Use nonzero voxels to calculate robust range. Requires inputs: use_robust_range.

  • use_robust_range (a boolean) – Interpret thresh as percentage (0-100) of robust range.

Outputs:

out_file (a pathlike object or string representing a file) – Image written after calculations.

UnaryMaths

Link to code

Bases: MathsCommand

Wrapped executable: fslmaths.

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

Mandatory Inputs:
  • in_file (a pathlike object or string representing an existing file) – Image to operate on. Maps to a command-line argument: %s (position: 2).

  • operation (‘exp’ or ‘log’ or ‘sin’ or ‘cos’ or ‘tan’ or ‘asin’ or ‘acos’ or ‘atan’ or ‘sqr’ or ‘sqrt’ or ‘recip’ or ‘abs’ or ‘bin’ or ‘binv’ or ‘fillh’ or ‘fillh26’ or ‘index’ or ‘edge’ or ‘nan’ or ‘nanm’ or ‘rand’ or ‘randn’ or ‘range’) – Operation to perform. Maps to a command-line argument: -%s (position: 4).

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

  • internal_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for calculations (default is float). Maps to a command-line argument: -dt %s (position: 1).

  • nan2zeros (a boolean) – Change NaNs to zeros before doing anything. Maps to a command-line argument: -nan (position: 3).

  • out_file (a pathlike object or string representing a file) – Image to write. Maps to a command-line argument: %s (position: -2).

  • output_datatype (‘float’ or ‘char’ or ‘int’ or ‘short’ or ‘double’ or ‘input’) – Datatype to use for output (default uses input type). Maps to a command-line argument: -odt %s (position: -1).

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

Outputs:

out_file (a pathlike object or string representing a file) – Image written after calculations.