BiasField
Bases: IntensityTransform
Corrupt an image with a smooth multiplicative bias field.
The bias field is generated by:
- Sampling a small 3D tensor from \(\mathcal{N}(0, \sigma)\).
- Trilinearly upsampling it to the image spatial shape.
- Taking the voxel-wise exponential to make it strictly positive.
- Multiplying the image by the resulting field.
This follows the approach used in SynthSeg: Segmentation of brain MRI scans of any contrast and resolution without retraining.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
std
|
float | tuple[float, float] | Distribution
|
Standard deviation \(\sigma\) of the normal distribution
used to sample the coarse bias field. Larger values produce
stronger inhomogeneity. If two values \((a, b)\) are provided,
\(\sigma \sim \mathcal{U}(a, b)\). A
|
0.5
|
scale
|
float
|
Ratio between the coarse field size and the image spatial shape. Smaller values produce smoother fields. |
0.025
|
**kwargs
|
Any
|
See |
{}
|
Examples:
>>> import torchio as tio
>>> transform = tio.BiasField()
>>> transform = tio.BiasField(std=0.8)
>>> transform = tio.BiasField(std=(0.0, 1.0))
Source code in src/torchio/transforms/intensity/bias_field.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
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 the bias field standard deviation and a random seed.
Source code in src/torchio/transforms/intensity/bias_field.py
apply_transform(batch, params)
Multiply each selected image by a smooth random bias field.
Source code in src/torchio/transforms/intensity/bias_field.py
inverse(params)
Build the inverse by dividing by the same bias field.