# Unable to compile simpleRTK

**URL:** <https://discourse.itk.org/t/unable-to-compile-simplertk/6723>\
**Category:** Beginner Questions\
**Tags:** python\
**Created:** [June 27, 2024, 5:58am UTC](https://discourse.itk.org/t/unable-to-compile-simplertk/6723 "2024-06-27T05:58:33Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![xem123](https://discourse.itk.org/user_avatar/discourse.itk.org/xem123/32/4080_2.png) [@xem123](https://discourse.itk.org/u/xem123)\
**Post date:** [June 27, 2024, 5:58am UTC](https://discourse.itk.org/t/unable-to-compile-simplertk/6723/1 "2024-06-27T05:58:33Z")

</div>

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！

 ![image](https://discourse.itk.org/uploads/default/original/2X/a/aea98fa8069d9ead0b4d09bf7a60d97084b69d96.png)

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [June 27, 2024, 1:22pm UTC](https://discourse.itk.org/t/unable-to-compile-simplertk/6723/2 "2024-06-27T13:22:23Z")

</div>

@simon.rit might want to comment.

---

<div class="post-metadata">

**Author:** ![simon.rit](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/f08c70/32.png) [@simon.rit](https://discourse.itk.org/u/simon.rit)\
**Post date:** [June 27, 2024, 1:51pm UTC](https://discourse.itk.org/t/unable-to-compile-simplertk/6723/3 "2024-06-27T13:51:12Z")

</div>

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](https://github.com/RTKConsortium/RTK/commit/f23cef7ce1e635136f922174ae7b6e616993828d). 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](https://pypi.org/project/itk-rtk/).

---

<div class="post-metadata">

**Author:** ![xem123](https://discourse.itk.org/user_avatar/discourse.itk.org/xem123/32/4080_2.png) [@xem123](https://discourse.itk.org/u/xem123)\
**Post date:** [July 1, 2024, 8:18am UTC](https://discourse.itk.org/t/unable-to-compile-simplertk/6723/5 "2024-07-01T08:18:17Z")

</div>

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!

 ![image](https://discourse.itk.org/uploads/default/original/2X/8/81d5fdbbeac1eb913f536c368d2ebc59fc121db2.png)

---

<div class="post-metadata">

**Author:** ![simon.rit](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/f08c70/32.png) [@simon.rit](https://discourse.itk.org/u/simon.rit)\
**Post date:** [July 1, 2024, 3:38pm UTC](https://discourse.itk.org/t/unable-to-compile-simplertk/6723/6 "2024-07-01T15:38:56Z")

</div>

`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`.

---

<div class="post-metadata">

**Author:** ![xem123](https://discourse.itk.org/user_avatar/discourse.itk.org/xem123/32/4080_2.png) [@xem123](https://discourse.itk.org/u/xem123)\
**Post date:** [July 2, 2024, 1:41am UTC](https://discourse.itk.org/t/unable-to-compile-simplertk/6723/7 "2024-07-02T01:41:03Z")

</div>

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?

 ![image](https://discourse.itk.org/uploads/default/original/2X/6/6b03af0350ea04062c512ff9ac2d2912206c0384.png)  
 ![image](https://discourse.itk.org/uploads/default/original/2X/9/981e156b235a2605087ab6bce26051b7c9c79e01.png)

---

<div class="post-metadata">

**Author:** ![simon.rit](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/f08c70/32.png) [@simon.rit](https://discourse.itk.org/u/simon.rit)\
**Post date:** [July 2, 2024, 7:58am UTC](https://discourse.itk.org/t/unable-to-compile-simplertk/6723/8 "2024-07-02T07:58:08Z")

</div>

Yes, `RealToHalfHermitianForwardFFTImageFilter` transforms the data to the frequency domain. But FFTRampImageFilter already does the [itk::RealToHalfHermitianForwardFFTImageFilter](https://github.com/RTKConsortium/RTK/blob/0f7f84b7c4abaeb3f0e6a7ece955eefbc4039c51/include/rtkFFTProjectionsConvolutionImageFilter.hxx#L130-L199) 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.

---

<div class="post-metadata">

**Author:** ![xem123](https://discourse.itk.org/user_avatar/discourse.itk.org/xem123/32/4080_2.png) [@xem123](https://discourse.itk.org/u/xem123)\
**Post date:** [July 4, 2024, 2:11am UTC](https://discourse.itk.org/t/unable-to-compile-simplertk/6723/9 "2024-07-04T02:11:37Z")

</div>

Thanks for you helps!

---

<div class="post-metadata">

**Author:** ![xem123](https://discourse.itk.org/user_avatar/discourse.itk.org/xem123/32/4080_2.png) [@xem123](https://discourse.itk.org/u/xem123)\
**Post date:** [July 6, 2024, 11:22am UTC](https://discourse.itk.org/t/unable-to-compile-simplertk/6723/10 "2024-07-06T11:22:09Z")

</div>

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!

 ![image](https://discourse.itk.org/uploads/default/original/2X/e/eb737d40de80e7b3512356eb7530b5cedc024d78.png)  
 ![image](https://discourse.itk.org/uploads/default/original/2X/0/0871584ca17f0e55616549f9e3414054a6b297ea.jpeg)  
 ![image](https://discourse.itk.org/uploads/default/original/2X/e/ebb97c4e1d06fb6f9581ceeb71a3adf6f0a4a7bd.jpeg)
