I want to take the discreet FFT of an image and then zero out the high spatial frequency values and then use the inverse FFT to see the result. My problem is that I get an error trying to use SetPixel on the Fourier transform image. How am I supposed to access and change the values in the result of executing the Simple ITK ForwardFFTImageFilter?
Hello @gfunkalea,
To set the pixel value use the bracket operator or the SetPixel
method as shown below (assuming you are working in Python which has support for the bracket operator, otherwise, just the SetPixel
method):
import SimpleITK as sitk
file_name =
image = sitk.ReadImage(file_name, sitk.sitkFloat32)
res = sitk.ForwardFFT(image)
print(res[0,0])
res[0,0] = 0
print(res[0,0])
# or using SetPixel
print(res[0,1])
res.SetPixel([0,1], 0)
print(res[0,0])
1 Like