A collection of “vanilla” transforms for spatial operations.


Affine([rotate_params, shear_params, ...])

Transform img given the affine parameters.

AffineGrid([rotate_params, shear_params, ...])

Affine transforms on the coordinates.

Flip([spatial_axis, lazy])

Reverses the order of elements along the given spatial axis.

GridDistortion(num_cells, distort_steps[, ...])

GridPatch(patch_size[, offset, num_patches, ...])

Extract all the patches sweeping the entire image in a row-major sliding-window manner with possible overlaps.

GridSplit([grid, size])

Split the image into patches based on the provided grid in 2D.

Orientation([axcodes, as_closest_canonical, ...])

Change the input image's orientation into the specified based on axcodes.

Rand2DElastic(spacing, magnitude_range[, ...])

Random elastic deformation and affine in 2D.

Rand3DElastic(sigma_range, magnitude_range)

Random elastic deformation and affine in 3D.

RandAffine([prob, rotate_range, ...])

Random affine transform.

RandAffineGrid([rotate_range, shear_range, ...])

Generate randomised affine grid.

RandAxisFlip([prob, lazy])

Randomly select a spatial axis and flip along it.

RandDeformGrid(spacing, magnitude_range[, ...])

Generate random deformation grid.

RandFlip([prob, spatial_axis, lazy])

Randomly flips the image along axes.

RandGridDistortion([num_cells, prob, ...])

RandGridPatch(patch_size[, min_offset, ...])

Extract all the patches sweeping the entire image in a row-major sliding-window manner with possible overlaps, and with random offset for the minimal corner of the image, (0,0) for 2D and (0,0,0) for 3D.

RandRotate([range_x, range_y, range_z, ...])

Randomly rotate the input arrays.

RandRotate90([prob, max_k, spatial_axes, lazy])

With probability prob, input arrays are rotated by 90 degrees in the plane specified by spatial_axes.

RandSimulateLowResolution([prob, ...])

Random simulation of low resolution corresponding to nnU-Net's SimulateLowResolutionTransform (MIC-DKFZ/batchgenerators) First, the array/tensor is resampled at lower resolution as determined by the zoom_factor which is uniformly sampled from the zoom_range.

RandZoom([prob, min_zoom, max_zoom, mode, ...])

Randomly zooms input arrays with given probability within given zoom range.

Resample([mode, padding_mode, norm_coords, ...])

ResampleToMatch([mode, padding_mode, ...])

Resample an image to match given metadata.

Resize(spatial_size[, size_mode, mode, ...])

Resize the input image to given spatial size (with scaling, not cropping/padding).

Rotate(angle[, keep_size, mode, ...])

Rotates an input image by given angle using monai.networks.layers.AffineTransform.

Rotate90([k, spatial_axes, lazy])

Rotate an array by 90 degrees in the plane specified by axes.

Spacing(pixdim[, diagonal, mode, ...])

Resample input image into the specified pixdim.

SpatialResample([mode, padding_mode, ...])

Resample input image from the orientation/spacing defined by src_affine affine matrix into the ones specified by dst_affine affine matrix.

Zoom(zoom[, mode, padding_mode, ...])

Zooms an ND image using torch.nn.functional.interpolate.