nipype.interfaces.ants.visualization module

The ants visualisation module provides basic functions based on ITK.

ConvertScalarImageToRGB

Link to code

Bases: ANTSCommand

Wrapped executable: ConvertScalarImageToRGB.

Convert scalar images to RGB.

Examples

>>> from nipype.interfaces.ants.visualization import ConvertScalarImageToRGB
>>> converter = ConvertScalarImageToRGB()
>>> converter.inputs.dimension = 3
>>> converter.inputs.input_image = 'T1.nii.gz'
>>> converter.inputs.colormap = 'jet'
>>> converter.inputs.minimum_input = 0
>>> converter.inputs.maximum_input = 6
>>> converter.cmdline
'ConvertScalarImageToRGB 3 T1.nii.gz rgb.nii.gz none jet none 0 6 0 255'
Mandatory Inputs:
  • colormap (‘grey’ or ‘red’ or ‘green’ or ‘blue’ or ‘copper’ or ‘jet’ or ‘hsv’ or ‘spring’ or ‘summer’ or ‘autumn’ or ‘winter’ or ‘hot’ or ‘cool’ or ‘overunder’ or ‘custom’) – Select a colormap. Maps to a command-line argument: %s (position: 4).

  • dimension (3 or 2) – Image dimension (2 or 3). Maps to a command-line argument: %d (position: 0). (Nipype default value: 3)

  • input_image (a pathlike object or string representing an existing file) – Main input is a 3-D grayscale image. Maps to a command-line argument: %s (position: 1).

  • maximum_input (an integer) – Maximum input. Maps to a command-line argument: %d (position: 7).

  • minimum_input (an integer) – Minimum input. Maps to a command-line argument: %d (position: 6).

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

  • custom_color_map_file (a string) – Custom color map file. Maps to a command-line argument: %s (position: 5). (Nipype default value: none)

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

  • mask_image (a string or os.PathLike object referring to an existing file or ‘none’) – Mask image. Maps to a command-line argument: %s (position: 3). (Nipype default value: none)

  • maximum_RGB_output (an integer) – Maps to a command-line argument: %d (position: 9). (Nipype default value: 255)

  • minimum_RGB_output (an integer) – Maps to a command-line argument: %d (position: 8). (Nipype default value: 0)

  • num_threads (an integer) – Number of ITK threads to use. (Nipype default value: 1)

  • output_image (a string) – Rgb output image. Maps to a command-line argument: %s (position: 2). (Nipype default value: rgb.nii.gz)

Outputs:

output_image (a pathlike object or string representing an existing file) – Converted RGB image.

CreateTiledMosaic

Link to code

Bases: ANTSCommand

Wrapped executable: CreateTiledMosaic.

The program CreateTiledMosaic in conjunction with ConvertScalarImageToRGB provides useful functionality for common image analysis tasks. The basic usage of CreateTiledMosaic is to tile a 3-D image volume slice-wise into a 2-D image.

Examples

>>> from nipype.interfaces.ants.visualization import CreateTiledMosaic
>>> mosaic_slicer = CreateTiledMosaic()
>>> mosaic_slicer.inputs.input_image = 'T1.nii.gz'
>>> mosaic_slicer.inputs.rgb_image = 'rgb.nii.gz'
>>> mosaic_slicer.inputs.mask_image = 'mask.nii.gz'
>>> mosaic_slicer.inputs.output_image = 'output.png'
>>> mosaic_slicer.inputs.alpha_value = 0.5
>>> mosaic_slicer.inputs.direction = 2
>>> mosaic_slicer.inputs.pad_or_crop = '[ -15x -50 , -15x -30 ,0]'
>>> mosaic_slicer.inputs.slices = '[2 ,100 ,160]'
>>> mosaic_slicer.cmdline
'CreateTiledMosaic -a 0.50 -d 2 -i T1.nii.gz -x mask.nii.gz -o output.png -p [ -15x -50 , -15x -30 ,0] -r rgb.nii.gz -s [2 ,100 ,160]'
Mandatory Inputs:
  • input_image (a pathlike object or string representing an existing file) – Main input is a 3-D grayscale image. Maps to a command-line argument: -i %s.

  • rgb_image (a pathlike object or string representing an existing file) – An optional Rgb image can be added as an overlay.It must have the same imagegeometry as the input grayscale image. Maps to a command-line argument: -r %s.

Optional Inputs:
  • alpha_value (a float) – If an Rgb image is provided, render the overlay using the specified alpha parameter. Maps to a command-line argument: -a %.2f.

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

  • direction (an integer) – Specifies the direction of the slices. If no direction is specified, the direction with the coarsest spacing is chosen. Maps to a command-line argument: -d %d.

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

  • flip_slice (a string) – FlipXxflipY. Maps to a command-line argument: -f %s.

  • mask_image (a pathlike object or string representing an existing file) – Specifies the ROI of the RGB voxels used. Maps to a command-line argument: -x %s.

  • num_threads (an integer) – Number of ITK threads to use. (Nipype default value: 1)

  • output_image (a string) – The output consists of the tiled mosaic image. Maps to a command-line argument: -o %s. (Nipype default value: output.png)

  • pad_or_crop (a string) – Argument passed to -p flag:[padVoxelWidth,<constantValue=0>][lowerPadding[0]xlowerPadding[1],upperPadding[0]xupperPadding[1],constantValue]The user can specify whether to pad or crop a specified voxel-width boundary of each individual slice. For this program, cropping is simply padding with negative voxel-widths.If one pads (+), the user can also specify a constant pad value (default = 0). If a mask is specified, the user can use the mask to define the region, by using the keyword “mask” plus an offset, e.g. “-p mask+3”. Maps to a command-line argument: -p %s.

  • permute_axes (a boolean) – DoPermute. Maps to a command-line argument: -g.

  • slices (a string) – Number of slices to increment Slice1xSlice2xSlice3[numberOfSlicesToIncrement,<minSlice=0>,<maxSlice=lastSlice>]. Maps to a command-line argument: -s %s.

  • tile_geometry (a string) – The tile geometry specifies the number of rows and columnsin the output image. For example, if the user specifies “5x10”, then 5 rows by 10 columns of slices are rendered. If R < 0 and C > 0 (or vice versa), the negative value is selectedbased on direction. Maps to a command-line argument: -t %s.

Outputs:

output_image (a pathlike object or string representing an existing file) – Image file.