A collection of “vanilla” transforms for utility functions.



Adds a 1-length channel dimension to the input image.


Appends additional channels encoding coordinates of the input.

AddExtremePointsChannel([background, pert])

Add extreme points of label to the image as a new channel.


Change the channel dimension of the image to the first dimension.


Change the channel dimension of the image to the last dimension.


Cast the Numpy data to specified numpy data type, or cast the PyTorch Tensor to specified PyTorch data type.

ClassesToIndices([num_classes, ...])


Convert labels to multi channels based on brats18 classes: label 1 is the necrotic and non-enhancing tumor core label 2 is the peritumoral edema label 4 is the GD-enhancing tumor The possible classes are TC (Tumor core), WT (Whole tumor) and ET (Enhancing tumor).

CuCIM(name, *args, **kwargs)

Wrap a non-randomized cuCIM transform, defined based on the transform name and args.

DataStats([prefix, data_type, data_shape, ...])

Utility transform to show the statistics of data for debug or analysis.

EnsureChannelFirst([strict_check, channel_dim])

Adjust or add the channel dimension of input data to ensure channel_first shape.

EnsureType([data_type, dtype, device, ...])

Ensure the input data to be a PyTorch Tensor or numpy array, support: numpy array, PyTorch Tensor, float, int, bool, string and object keep the original.

FgBgToIndices([image_threshold, output_shape])

Compute foreground and background of the input label data, return the indices.


Do nothing to the data.

ImageFilter(filter[, filter_size])

Applies a convolution filter to the input image.

IntensityStats(ops, key_prefix[, channel_wise])

Compute statistics for the intensity values of input image and store into the metadata dictionary.

LabelToMask(select_labels[, merge_channels])

Convert labels to mask for other tasks.

Lambda([func, inv_func, track_meta])

Apply a user-defined lambda as a transform.

MapLabelValue(orig_labels, target_labels[, ...])

Utility to map label values to another set of values.

RandCuCIM(name, *args, **kwargs)

Wrap a randomized cuCIM transform, defined based on the transform name and args For deterministic non-randomized transforms use monai.transforms.CuCIM.


Do nothing to the data.

RandImageFilter(filter[, filter_size, prob])

Randomly apply a convolutional filter to the input data.

RandLambda([func, prob, inv_func, track_meta])

Randomizable version monai.transforms.Lambda, the input func may contain random logic, or randomly execute the function based on prob.


RemoveRepeatedChannel data to undo RepeatChannel The repeats count specifies the deletion of the origin data, for example: RemoveRepeatedChannel(repeats=2)([[1, 2], [1, 2], [3, 4], [3, 4]]) generates: [[1, 2], [3, 4]]


Repeat channel data to construct expected input shape for models.


This is a pass through transform to be used for testing purposes.


Split Numpy array or PyTorch Tensor data according to the channel dim.

SplitDim([dim, keepdim, update_meta])

Given an image of size X along a certain dimension, return a list of length X containing images.

SqueezeDim([dim, update_meta])

Squeeze a unitary dimension.

ToCupy([dtype, wrap_sequence])

Converts the input data to CuPy array, can support list or tuple of numbers, NumPy and PyTorch Tensor.

ToDevice(device, **kwargs)

Move PyTorch Tensor to the specified device.

ToNumpy([dtype, wrap_sequence])

Converts the input data to numpy array, can support list or tuple of numbers and PyTorch Tensor.


Converts the input image (in the form of NumPy array or PyTorch Tensor) to PIL image

ToTensor([dtype, device, wrap_sequence, ...])

Converts the input image to a tensor without applying any other transformations.

TorchVision(name, *args, **kwargs)

This is a wrapper transform for PyTorch TorchVision transform based on the specified transform name and args.


Transposes the input image based on the given indices dimension ordering.