Skip to content

Compose

Compose

Bases: Transform

Compose several transforms together.

Parameters:

Name Type Description Default
transforms Sequence[Transform]

Sequence of instances of Transform.

required
**kwargs

See Transform for additional keyword arguments.

{}

__call__(data)

Transform data and return a result of the same type.

Parameters:

Name Type Description Default
data InputType

Instance of torchio.Subject, 4D torch.Tensor or numpy.ndarray with dimensions \((C, W, H, D)\), where \(C\) is the number of channels and \(W, H, D\) are the spatial dimensions. If the input is a tensor, the affine matrix will be set to identity. Other valid input types are a SimpleITK image, a torchio.Image, a NiBabel Nifti1 image or a dict. The output type is the same as the input type.

required

add_base_args(arguments, overwrite_on_existing=False)

Add the init args to existing arguments

validate_keys_sequence(keys, name) staticmethod

Ensure that the input is not a string but a sequence of strings.

inverse(warn=True)

Return a composed transform with inverted order and transforms.

Parameters:

Name Type Description Default
warn bool

Issue a warning if some transforms are not invertible.

True

to_hydra_config()

Return a dictionary representation of the transform for Hydra instantiation.