# FDK Reconstruction error

**URL:** <https://discourse.itk.org/t/fdk-reconstruction-error/6680>\
**Category:** Beginner Questions\
**Created:** [June 10, 2024, 5:51am UTC](https://discourse.itk.org/t/fdk-reconstruction-error/6680 "2024-06-10T05:51:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![akshara](https://discourse.itk.org/letter_avatar_proxy/v4/letter/a/3d9bf3/32.png) [@akshara](https://discourse.itk.org/u/akshara)\
**Post date:** [June 10, 2024, 5:51am UTC](https://discourse.itk.org/t/fdk-reconstruction-error/6680/1 "2024-06-10T05:51:54Z")

</div>

We’re currently engaged in CBCT reconstruction and have successfully developed a Python-based code for the task, which functions without issue. However, encountering an error during the conversion process to C++, specifically at the stage of FDK reconstruction filter implementation, has prompted our inquiry. The error message reads as follows:

itk::ExceptionObject (000000EBA52FDC68)  
Location: “unknown”  
File: C:\ITK\src\Modules\Filtering\FFT\include\itkRealToHalfHermitianForwardFFTImageFilter.h  
Line: 85  
Description: ITK ERROR: Object factory failed to instantiate class itk::RealToHalfHermitianForwardFFTImageFilter\<class itk::Image\<float,3\>,class itk::Image\<class std::complex,3\> \>

Our FDK implementation in C++ is as follows:

```cpp
using FDKGPUType = rtk::CudaFDKConeBeamReconstructionFilter;

// Creating the FDK reconstruction filter
FDKGPUType::Pointer feldkamp = FDKGPUType::New();

// Setting input images for the FDK reconstruction filter
feldkamp->SetInput(0, constantImageSource2->GetOutput());
feldkamp->SetInput(1, ParkerFilter->GetOutput()); // This is the projection stack from rtkProjectionsReader

// Setting geometry for the FDK reconstruction filter
feldkamp->SetGeometry(geometry);

// Setting ramp filter parameters
feldkamp->GetRampFilter()->SetTruncationCorrection(0.0);
feldkamp->GetRampFilter()->SetHannCutFrequency(0.0);

// Executing the reconstruction filter
try {
feldkamp->Update();
}

```

We’re employing ITK version 5.3 for this implementation. Any insights into the cause of this error would be greatly appreciated.

---

<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 10, 2024, 12:54pm UTC](https://discourse.itk.org/t/fdk-reconstruction-error/6680/2 "2024-06-10T12:54:45Z")

</div>

FDK is a composite filter and you should try to isolate the root issue. As suggested on the [RTK mailing list](https://www.creatis.insa-lyon.fr/pipermail/rtk-users/2024-June/002134.html), can you try the following code alone

```c++
using FFTType = itk::RealToHalfHermitianForwardFFTImageFilter<class
itk::Image<float,3>>;
typename FFTType::Pointer fft = FFTType::New();

```

If it doesn’t work, it’s not an RTK issue but an issue with FFT in ITK.

---

<div class="post-metadata">

**Author:** ![akshara](https://discourse.itk.org/letter_avatar_proxy/v4/letter/a/3d9bf3/32.png) [@akshara](https://discourse.itk.org/u/akshara)\
**Post date:** [June 11, 2024, 5:59am UTC](https://discourse.itk.org/t/fdk-reconstruction-error/6680/3 "2024-06-11T05:59:57Z")

</div>

I tried the suggestion as below:  
// Create the FFT filter  
using FFTType = itk::RealToHalfHermitianForwardFFTImageFilter\<class itk::Image\<float, 3\>\>;  
typename FFTType::Pointer fft = FFTType::New();  
fft-\>SetInput(constantImageSource2-\>GetOutput());  
fft-\>Update(); // Perform the FFT

It still throws the same error.
