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.
num_spikes_rangeInclusive range for the number of spikes sampled per invocation. Zero spikes is an exact identity. Default: (1, 5).
intensity_rangeRange for the spike amplitude as a fraction of the spectrum maximum magnitude. Zero is an exact identity. Default: (0.1, 0.5).
per_channelIf True, sample independent spike locations and amplitudes for each channel. If False, share one set of spikes across all channels. Default: False.
pProbability of applying the transform. Default: 0.5.
>>> 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"]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.i turns a flat field of value c into a cosine
pattern of amplitude 2 * i * c along the spike's frequency direction.