Anisotropy
Bases: Transform
Simulate an anisotropic acquisition.
Downsample along a randomly chosen axis and then upsample back to the original shape, emulating the through-plane blur seen in clinical MRI when one axis has coarser resolution.
This is useful as a data augmentation for super-resolution training.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axes
|
tuple[int, ...]
|
Spatial axes eligible for downsampling. One is chosen at random per application. |
(0, 1, 2)
|
downsampling
|
float | tuple[float, float]
|
Downsampling factor \(m \geq 1\). A scalar is
deterministic; a 2-tuple \((a, b)\) samples
\(m \sim \mathcal{U}(a, b)\). The default |
1.0
|
image_interpolation
|
str
|
Interpolation mode used when upsampling scalar images back to the original shape. |
'linear'
|
**kwargs
|
Any
|
See |
{}
|
Examples:
>>> import torchio as tio
>>> transform = tio.Anisotropy(downsampling=4)
>>> transform = tio.Anisotropy(
... axes=(2,),
... downsampling=(1.5, 5),
... )
Source code in src/torchio/transforms/spatial/anisotropy.py
invertible
property
Whether this transform can be inverted.
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
inverse(params)
Return a transform that undoes this one.
Override in invertible subclasses. The returned transform, when applied, reverses the effect of the forward pass with the given parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
dict[str, Any]
|
The parameters recorded in the forward pass. |
required |
Returns:
| Type | Description |
|---|---|
Transform
|
A new |
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 |
Source code in src/torchio/transforms/transform.py
make_params(batch)
Sample axis and downsampling factor.
Source code in src/torchio/transforms/spatial/anisotropy.py
apply_transform(batch, params)
Downsample then upsample along the chosen axis.