[ITK-users] Metadata Information in FFT images can be misleading.
Pablo Hernández
pablo.hernandez.cerdan at outlook.com
Tue Mar 14 04:54:12 EDT 2017
Hey there,
I am contributing with the IsotropicWavelet external module<https://github.com/phcerdan/ITKIsotropicWavelets>, and I am facing some doubts about the meaning of image metadata in frequency-domain images.
Current behavior performing a FFTforward is to copy the input image metadata: spacing,origin, and direction to the output, even though the output is in the frequency domain or dual space. I guess it is better copy it than to lose it, but doesn't mean that the metadata is meaningful in the frequency domain. Spacing information can led the user to think that between each pixel holding a frequency value, that spacing is like a frequency resolution, but it is not.
Some refresh of the lingo to help:
dual space: f ~ 1/T (where T can represent time or space)
Units of frequency are: Hertz = 1 / [ T ], or Radians (Rad = 2pi Hz)
Spacing (or Sampling in the lingo of digital signaling processing) in a spatial domain image is associated with the resolution of the image, and represents the pixel width in physical units.
The Origin is an array holding some relative units to world coordinates that are meaningful for the experimenter.
What does spacing mean in a frequency domain image? The frequency resolution after an FFT is related to the size of the FFT (the size of the image) and the sampling rate of the original image (more here<http://electronics.stackexchange.com/questions/12407/what-is-the-relation-between-fft-length-and-frequency-resolution>).
Freq_bin_resolution = Freq_sampling / N. Where N is the size of the image, and Freq_sampling = 1 / Spacing. All these variables are arrays, with size equal to the dimension of the image.
And the origin, in the case of the output of an FFT, depends on the layout of that particular FFT algorithm. VNL and FFTW share the same layout, where, for example, the zero frequency bin is stored the first index {{0}} , (also note that the physical units of that first index is always 0.0 Hz, regardless of origin, or spacing of the original image).
If we set the Freq_sampling to {{1.0}} (corresponding to a Spacing of {{1.0}}, then the freq resolution will be {{1/N}} (depending on the size!), and the range of frequencies will always be: (-0.5, 0.5] Hz, or (-pi, pi] rads (independent of the size).
So right now, in the wavelet module that works in the frequency domain, and does some shrinkage in this domain, I have chosen to ignore all this metadata, and let the user recover it if he/she needs it, but it might be worth to think about this.
For example, in a shrinkage by a factor of 2, the width of a pixel representing a frequency, doubles. F_bin_resolution =1/(N/2) = 2/N, and the range of allowed frequencies keeps the same: (-Freq_sampling/2.0, Freq_sampling/2.0] or (-0.5, 0.5] or (-pi,pi] if Freq_sampling =1.0
This is all good, but hard to grasp when the metadata can be misleading. If you have any thoughts on how to improve this or be clearer to the user, happy to hear, meanwhile I think I will keep ignoring any metadata associated with the spatial domain when dealing with frequency domain images.
Cheers,
Pablo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20170314/6b4541b6/attachment.html>
More information about the Insight-users
mailing list