Flip
Bases: SpatialTransform
Reverse the order of elements in an image along the given axes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axes
|
int | str | Sequence[int | str]
|
Index or tuple of indices of the spatial dimensions along
which the image might be flipped. Integers must be in
|
0
|
flip_probability
|
float
|
Probability that each axis will be flipped
(per-axis coin flip). This is independent of the |
1.0
|
**kwargs
|
Any
|
See |
{}
|
Tip
Specifying the axes as anatomical labels is useful when the image orientation is not known.
Examples:
>>> import torchio as tio
>>> # Flip along the first spatial axis
>>> transform = tio.Flip(axes=0)
>>> # Flip along the lateral axis (anatomical label)
>>> transform = tio.Flip(axes='LR')
>>> # Random per-axis flip with 50% chance each
>>> transform = tio.Flip(axes=(0, 1, 2), flip_probability=0.5)
Source code in src/torchio/transforms/spatial/flip.py
forward(data)
Apply the transform.
The output type always matches the input type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
Input data to transform. |
required |
Source code in src/torchio/transforms/transform.py
to_hydra()
Export as a Hydra-compatible config dict.
Returns a dict with _target_ set to the fully qualified
class name and only non-default field values included.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dict suitable for |