Ghosting
Bases: IntensityTransform
Add random MRI ghosting artifacts.
Discrete "ghost" replicas of the imaged anatomy appear along the phase-encode direction when signal intensity varies periodically during acquisition. Common causes include pulsatile blood flow, cardiac motion, and respiratory motion. (See mriquestions.com.)
The artifact is simulated by zeroing periodic planes in k-space along a randomly chosen axis, then restoring a fraction of the central k-space to avoid extreme artifacts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_ghosts
|
int | tuple[int, int]
|
Number of ghost replicas. A scalar \(n\) is deterministic; a 2-tuple \((a, b)\) samples \(n \sim \mathcal{U}(a, b) \cap \mathbb{N}\). |
4
|
axes
|
tuple[int, ...]
|
Spatial axes along which ghosts may appear. One is chosen at random per application. |
(0, 1, 2)
|
intensity
|
float | tuple[float, float]
|
Artifact strength relative to the k-space maximum.
A scalar is deterministic; a 2-tuple \((a, b)\) means
\(s \sim \mathcal{U}(a, b)\).
The default |
0.0
|
restore
|
float | None
|
Fraction of central k-space to restore after
zeroing. |
None
|
**kwargs
|
Any
|
See |
{}
|
Note
Execution time does not depend on the number of ghosts.
Examples:
>>> import torchio as tio
>>> transform = tio.Ghosting(intensity=0.8)
>>> transform = tio.Ghosting(num_ghosts=6, intensity=0.8)
Source code in src/torchio/transforms/intensity/ghosting.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 ghosting parameters.
Source code in src/torchio/transforms/intensity/ghosting.py
apply_transform(batch, params)
Add ghosting artifacts to each selected image.