nidl.transforms: Available transformations

This modules details the public API you should use and implement for a nidl compatible transform, as well as the transforms available in nidl.

Introduction

A transform is an object that can be called on some data and is capable of modifying some properties to generate new data.

Instanciation

The transform __init__ method only accepts the probability that this transform will be applied. It should not take the data as an argument, as this is left to the __call__ method.

Composability

Transforms can be composed using the torchvision.transforms.Compose class to create directed acyclic graphs defining the probability that each transform will be applied.

Reproducibility

When transforms are instantiated, we typically need to pass values that will be used to sample the transform parameters when the __call__ method of the transform is called, i.e., when the transform instance is called.

All random transforms have a seed parameter to have a corresponding deterministic behaviour.

Base Classes

Base classes for all augmentations and various utility functions.

Transform([p])

Abstract class for all nidl transformations.

Identity([p])

Identity transformation.

MultiViewsTransform(transforms[, n_views])

Multi-views transformation.

VolumeTransform([p])

Transformation applied to a 3d volume.

Volume

Preprocessing

Classes that implement useful spatial and intensity pre-processing transformations on brain 3D volumes.

RobustRescaling([out_min_max, percentiles, ...])

Rescale intensities in a 3d volume to a given range.

ZNormalization([masking_fn, eps])

Normalize a 3d volume by removing the mean and scaling to unit variance.

CropOrPad(target_shape[, padding_mode, ...])

Crop and/or pad a 3d volume to match the target shape.

Resample([target, interpolation])

Resample a 3d volume to a different physical space.

Resize(target_shape[, interpolation])

Resize a 3d volume to match a target shape.

        classDiagram
  Resample <|-- Resize
  VolumeTransform <|-- CropOrPad
  VolumeTransform <|-- Resample
  VolumeTransform <|-- RobustRescaling
  VolumeTransform <|-- ZNormalization
    

Augmentations

Classes that implement augmentations on brain 3D volumes and various utility functions.

RandomGaussianBlur([sigma])

Blur a 3d volume using a Gaussian filter with random kernel size.

RandomGaussianNoise([mean, std])

Add Gaussian noise to input data with random parameters.

RandomErasing([scale, ratio, ...])

Randomly erases boxes in a 3d volume.

RandomFlip([axes, flip_probability])

Reverse the order of elements in a 3d volume along the given axes.

RandomResizedCrop(target_shape[, scale, ...])

Crop a random portion of a 3d volume and resize it.

RandomRotation([axes, rotation_probability])

Randomly rotates a 3d volume by 90-degree multiples around spatial axes.

        classDiagram
  VolumeTransform <|-- RandomErasing
  VolumeTransform <|-- RandomFlip
  VolumeTransform <|-- RandomGaussianBlur
  VolumeTransform <|-- RandomGaussianNoise
  VolumeTransform <|-- RandomResizedCrop
  VolumeTransform <|-- RandomRotation
    

Surface

Classes that implement augmentations on brain surface and various utility functions.

coming soon