AlbumentationsExplore
DocumentationExploreAdoptionPricingBlog
GitHub

KSpaceSpikeNoise

Targets:
image
volume
Image Types:uint8, float32

Inject point spikes into the MRI k-space spectrum and reconstruct the image or volume, producing structured stripes typical of acquisition failures.

K-space spike artifacts arise from isolated high-energy points in the Fourier representation of MRI data (e.g. scanner spikes, radio-frequency interference). Each sampled spike adds a real amplitude at its frequency and at the conjugate mirror, keeping the spectrum Hermitian so the reconstruction is real.

Arguments
num_spikes_range
tuple[int, int]
[1, 5]

Inclusive range for the number of spikes sampled per invocation. Zero spikes is an exact identity. Default: (1, 5).

intensity_range
tuple[float, float]
[0.1, 0.5]

Range for the spike amplitude as a fraction of the spectrum maximum magnitude. Zero is an exact identity. Default: (0.1, 0.5).

per_channel
bool
false

If True, sample independent spike locations and amplitudes for each channel. If False, share one set of spikes across all channels. Default: False.

p
float
0.5

Probability of applying the transform. Default: 0.5.

Examples
>>> import numpy as np
>>> import albumentations as A
>>> image = np.random.randint(0, 256, (128, 128, 3), dtype=np.uint8)
>>> transform = A.Compose(
...     [A.KSpaceSpikeNoise(num_spikes_range=(2, 4), intensity_range=(0.1, 0.3), p=1.0)],
...     seed=137,
... )
>>> spiked = transform(image=image)["image"]
Notes
  • The Fourier transform is computed over spatial axes only; batch and channel dimensions are excluded. Spikes are injected into one transform-domain representation and a single inverse transform reconstructs the output.
  • Each spike injects a real amplitude intensity * max|F| at the sampled bin and at its conjugate mirror, so the half-spectrum stays Hermitian and the reconstruction is real without discarding imaginary parts. Self-conjugate bins (DC and the Nyquist bin of even axes) are injected once.
  • Spikes are uniform over the full frequency grid, including DC. A spike at DC shifts the global mean rather than creating stripes; this is intentional and documented.
  • A spike of relative amplitude i turns a flat field of value c into a cosine pattern of amplitude 2 * i * c along the spike's frequency direction.
  • One spike realization is sampled per transform invocation and reused across all channels (shared mode), all images in a batch, and the whole volume as a single 3D transform.
  • uint8 inputs are processed as float32 in [0, 1] and converted back with rounding, so outputs stay within [0, 255]; float32 outputs are clipped to [0, 1].
  • This differs from image-space impulse noise (SaltAndPepper), which replaces individual pixels, and from RingingOvershoot, which convolves in the image domain.
See Also
  • SaltAndPepper: Image-space impulse noise; use when corruption lives in pixel space.
  • RingingOvershoot: Image-domain convolution ringing; use for sharpening artifacts.
  • RicianNoise: MRI magnitude-reconstruction noise with a low-signal floor.
  • GaussNoise: Additive Gaussian noise for general sensor or transmission noise.
References
  • TorchIO RandomSpikehttps://docs.torchio.org/2.0/reference/transforms/spike/
  • TorchIO paperhttps://www.sciencedirect.com/science/article/pii/S0169260721003102