Off-by-one in vtkImageFourierCenter
The purpose of vtkImageFourierCenter is to "shift the zero frequency to the center of the image." However, it miscalculates the shift. The Spectrum.py test demonstrates this: the zero frequency of the spectrum this test produces is at pixel (129, 129) instead of at the expected pixel (128, 128). The regression image for this test has the wrong shift, so the test passes even though the results are incorrect.
Let's say we have the following frequencies: [0 1 2 3 4 5 6 7]
after centering, the result should be this: [4 5 6 7 0 1 2 3]
but vtkImageFourierCenter produces this: [3 4 5 6 7 0 1 2]
.
For odd-sized inputs, if the input is this: [0 1 2 3 4 5 6]
after centering, the result should be this: [4 5 6 0 1 2 3]
but vtkImageFourierCenter produces this: [3 4 5 6 0 1 2]
.
Essentially, we would expect vtkImageFourierCenter to do the same thing as numpy (or matlab) fftshift().
Also note that numpy and matlab have an ifftshift() function to shift the zero frequency from the center back to the edge. VTK does not provide this functionality.