Initially developed for the external ITKIsotropicWavelets module, I submitted a patch to integrate them into ITK 5 with the aim of re-using them in other modules. Any comment about the implementation is welcome, please join the review process here.
The frequency iterators are ImageRegionIterators
with GetFrequency
and GetFrequencyBins
functions to abstract and ease development of filters in the frequency domain.
Images in the frequency domain have layouts that depend on the algorithm that generates them, for example after a Fast Fourier Transform (FFT), the zero frequency is at origin, max positive frequency is at index size/2 - 1
. The min negative frequencies at size/2
, and the least negative frequency is at index: size - 1
. This layout change slightly if image is even or odd in size (Nyquist bands appear).
The best example is itkFrequencyFFTLayoutImageRegionConstIteratorWithIndex that contains the layout after applying the standard Fast Fourier Transform to an image.
Also the Shifted version, that covers the common case of shifting the zero frequency to the center of the image.
These iterators try to abstract this complexity from the developer, for them to only manipulate frequency values. A good example is the FrequencyBandImageFilter, that acts as BandPass or BandStop filter given two boundary frequencies. The filter consists in just setting zeros depending on frequency values, and all the layout complexity is abstracted in the frequency iterator.
The iterators handle the case where images are taken in frequency space (scattering experiments for example), and they are just regular ImageRegionIterator
with the GetFrequency
functions.
Note: The frequency iterator for Hermitian images is not included yet (FFT of real images can be chopped by half because they contain redundant information)
Also at the time of developing I triggered this conversation in the mail-list about the meaning of image metadata after performing a FFT.
The associated Insight Journal article of the module also contains a description of these iterators.
Some pictures of the capabilities of the FrequencyBandIterators generated in the test file:
Acting as a pass or stop band of frequencies on an image with a standard FFT layout.
The boundaries of the frequency band can be tweaked.
Using a stop band in an image with a FFTShifted Layout (zero frequency is at the center). The user or developer only has to provide the appropriate frequency iterator to the filter.