Unable to compile simpleRTK

Hello, I want to use simpleRTK in Python. I saw on the official website that I need to compile the ITK library first, then the RTK library, and check the BUILD_SIMPLERTK option; but now the RTK library doesn’t support separate compilation, right? Isn’t it only possible to check the Module_RTK option when compiling ITK and then compile ITK and RTK together? Then how should I compile simpleRTK and use it in Python?
Thanks!

@simon.rit might want to comment.

I did comment on the issue. SimpleRTK has been removed a while ago in favor of making RTK a remote module, see Enable build with shared libraries · RTKConsortium/RTK@f23cef7 · GitHub. The doc must be and will be (eventually and finally) updated but you should be able to do what’s in this example with the pypi package.

1 Like

Thank you for your reply. I still have one more question to consult.
I used the itk.itkRealToHalfHermitianForwardFFTImageFilterPython.itkRealToHalfHermitianForwardFFTImageFilterID3ICD3_New() function to perform FFT transformation on the image, obtaining an image of type <class 'itk.itkImagePython.itkImageCD3'> .
Then, I wanted to apply Hanning window filtering to this image using the function RTKPython.rtkFFTRampImageFilterID3ID3D_New() , but an error occurred at the step filter.SetInput(RealToHalf_image) . Can’t this function accept an image of type <class 'itk.itkImagePython.itkImageCD3'> ? Or did I use the wrong function? How should I perform Hanning window filtering on the <class 'itk.itkImagePython.itkImageCD3'> type?
Appreciate for any reply.Thanks!

rtk::FFTRampImageFilter takes as input an image of scalar, takes its FFT, multiply it by the ramp (+a potential window) and computes its inverse FFT. So no, I don’t think you can pass an itk.itkImagePython.itkImageCD3.

Thanks!
However, after performing FFT using the function itk.itkRealToHalfHermitianForwardFFTImageFilterPython.itkRealToHalfHermitianForwardFFTImageFilterID3ICD3_New() , aren’t the data transformed to the frequency domain all of complex type (as shown in the following figure, for example, <class ‘itk.itkImagePython.itkImageCD3’>)? Do I need to convert the data of complex type to the data of <class ‘itk.itkImageRTKPython.itkImageD3’> type separately and then input it to the function RTKPython.rtkFFTRampImageFilterID3ID3D_New() for filtering? During the conversion, do I still need to retain the imaginary part of the complex number, or only retain the real part of the complex number?
ps: I have studied the corresponding operations in the C++ source code of our RTK(as shown in the following figure). In the source code, the same itk::RealToHalfHermitianForwardFFTImageFilter function as in Python is used to transform the data to the frequency domain, and then it is multiplied by m_KernelFFT . Isn’t the resulting frequency domain data of complex type? Or did I choose the incorrect function in Python?


Yes, RealToHalfHermitianForwardFFTImageFilter transforms the data to the frequency domain. But FFTRampImageFilter already does the itk::RealToHalfHermitianForwardFFTImageFilter so no need to do it yourself before using it. The intermediate complex image is not exposed. I have never used complex type input to FFTRampImageFilter, only scalar float images in the image domain.

1 Like

Thanks for you helps!

Excuse me,sorry to bother.
I have one frame of image (as shown in the following figure), the image format is <class ‘itk.itkImageRTKPython.itkImageD3’>, and GetLargestPossibleRegion().GetSize()) is [768, 729, 1]. I want to apply the rtkFFTRampImageFilter() function for Hanning window filtering on this frame of image. I have used three methods: way1, way2, and way3 (as shown in the code), but why are the resulting images I obtained all incorrect? Is my usage of the function incorrect or is the function library I used incorrect?
Thanks for you help!