ITK/RTK config and build to use CudaBackProjectionImageFilter python wrapper

Hello,
I’m new to ITK/RTK and currently working on a project where we want to use RTK’s reconstruction functionality, specifically CudaFDKBackProjectionImageFilter.
However, due to my limited experience with ITK/RTK, I’ve encountered some challenges and difficulties, and I’m seeking guidance and support.

In short, after some trial and error, I was finally able to complete a successful ITK build using the following configuration:
cmake ../ITK -G “Visual Studio 17 2022” -A x64 ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_INSTALL_PREFIX=“C:/ITKRTK/ITK-install” ^
-DBUILD_EXAMPLES=OFF ^
-DBUILD_TESTING=OFF ^
-DBUILD_SHARED_LIBS=OFF ^
-DITK_WRAP_PYTHON=ON ^
-DITK_BUILD_DEFAULT_MODULES=OFF ^
-DModule_ITKCommon=ON ^
-DModule_ITKIOImageBase=ON ^
-DModule_ITKIONIFTI=ON ^
-DModule_ITKIOPNG=ON ^
-DModule_ITKIOGDCM=ON ^
-DModule_RTK=ON ^
-DModule_CudaCommon=ON ^
-DRTK_USE_CUDA=ON ^
-DITK_WRAP_unsigned_short:BOOL=ON ^
-DITK_WRAP_double:BOOL=ON ^
-DITK_WRAP_complex_double:BOOL=ON ^
-DITK_WRAP_IMAGE_DIMS:STRING=“2;3;4” ^
-DPython3_EXECUTABLE=“c:/Python/Python311/python.exe” ^
-DPython3_INCLUDE_DIR=“c:/Python/Python311/include” ^
-DPython3_LIBRARY=“c:/Python/Python311/libs/python311.lib” ^
-DPY_SITE_PACKAGES_PATH=“C:/Python/Python311/Lib/site-packages” ^
-DModule_ITKHDF5:BOOL=OFF ^
-DModule_ITKIOHDF5:BOOL=OFF ^
-DModule_ITKIOTransformHDF5:BOOL=OFF ^
-DModule_ITKIOTransformBase:BOOL=OFF ^
-DModule_ITKIOTransformMatlab:BOOL=OFF
The build completed successfully, but when I tried the following Python commands (We need to use this CudaFDKBackProjectionImageFilter instead of CudaBackProjectionImageFilter), I received an error indicating that the function was not found:
from itk import RTK
from itk import RTK as rtk
aa = rtk.CudaFDKBackProjectionImageFilter.New()
Any suggestions on how to resolve this will be highly appreciated.

Thank you

James

Sorry to hear your trouble. An easier solution is to download the Cuda compiled by GitHub actions, e.g. here for the latest one (available as artifacts when you log in to GitHub).

For fixing your build, when you do not indicate a specific value to Module_RTK_GIT_TAG, it uses the value in RTK.remote.cmake. Currently, this is 1fb003a0e052fd9fec94520c9fa39ff4339828e0 which is prior to 1f8574496e2c29ef74159ff69018a6b40daa35ec, the commit which wraps this filter. So the solution is to indicate a more recent hash as a CMake option, -DModule_RTK_GIT_TAG=“main”. You can check after the CMake configuration that RTK git HEAD is where you’d like in ../ITK/Modules/Remote/RTK.

1 Like

Thanks, Simon, for the suggestion. I added the option DModule_RTK_GIT_TAG="main", and it seems the rtkCudaFDKBackProjectionImageFilter module was successfully fetched and compiled. However, I’m now encountering other errors. Without this option, the build and installation complete successfully. Do you have any suggestions or insights on how to resolve these new errors? Here are some of them: C:\ITKRTK\ITK\Modules\Remote\RTK\include\rtkWarpSequenceImageFilter.hxx(85,5): error C2679: binary ‘=’: no operator found w

hich takes a right-hand operand of type ‘rtk::CudaForwardWarpImageFilter::Pointer’ (or there is no acceptable conversion) [

C:\ITKRTK\ITK-Build\Wrapping\Modules\RTK\RTKPython.vcxproj]

(compiling source file ‘../RTK/rtkFourDROOSTERConeBeamReconstructionFilterPython.cpp’)

C:\ITKRTK\ITK\Modules\Remote\RTK\include\rtkWarpSequenceImageFilter.hxx(87,5): error C2679: binary ‘=’: no operator found w

hich takes a right-hand operand of type ‘rtk::CudaWarpImageFilter::Pointer’ (or there is no acceptable conversion) [C:\ITKR

TK\ITK-Build\Wrapping\Modules\RTK\RTKPython.vcxproj]

(compiling source file ‘../RTK/rtkFourDROOSTERConeBeamReconstructionFilterPython.cpp’)

C:\ITKRTK\ITK\Modules\Remote\RTK\include\rtkWarpSequenceImageFilter.hxx(92,5): error C2679: binary ‘=’: no operator found w

hich takes a right-hand operand of type ‘rtk::CudaCyclicDeformationImageFilter::Pointer’ (or there is no acceptable convers

ion) [C:\ITKRTK\ITK-Build\Wrapping\Modules\RTK\RTKPython.vcxproj]

(compiling source file ‘../RTK/rtkFourDROOSTERConeBeamReconstructionFilterPython.cpp’)

C:\ITKRTK\ITK\Modules\Remote\RTK\include\rtkMechlemOneStepSpectralReconstructionFilter.hxx(438,23): error C2664: 'void rtk:

:WeidingerForwardModelImageFilter<TMaterialProjections,TPhotonCounts,TSpectrum,TProjections>::SetInputProjectionsOfOnes(con

st TProjections *)': cannot convert argument 1 from ‘itk::Image<float,3> *’ to ‘const TProjections *’ [C:\ITKRTK\ITK-Build\

Wrapping\Modules\RTK\RTKPython.vcxproj]

C:\ITKRTK\ITK\Modules\Remote\RTK\include\rtkMechlemOneStepSpectralReconstructionFilter.hxx(438,23): error C2664: wi

th [C:\ITKRTK\ITK-Build\Wrapping\Modules\RTK\RTKPython.vcxproj]

C:\ITKRTK\ITK\Modules\Remote\RTK\include\rtkMechlemOneStepSpectralReconstructionFilter.hxx(438,23): error C2664: [

[C:\ITKRTK\ITK-Build\Wrapping\Modules\RTK\RTKPython.vcxproj]

C:\ITKRTK\ITK\Modules\Remote\RTK\include\rtkMechlemOneStepSpectralReconstructionFilter.hxx(438,23): error C2664:

TMaterialProjections=itk::CudaImage<itk::Vector<float,2>,3>, [C:\ITKRTK\ITK-Build\Wrapping\Modules\RTK\RTKPython.vcxproj]

C:\ITKRTK\ITK\Modules\Remote\RTK\include\rtkMechlemOneStepSpectralReconstructionFilter.hxx(438,23): error C2664:

TPhotonCounts=itk::CudaImage<itk::Vector<float,2>,3>, [C:\ITKRTK\ITK-Build\Wrapping\Modules\RTK\RTKPython.vcxproj]

C:\ITKRTK\ITK\Modules\Remote\RTK\include\rtkMechlemOneStepSpectralReconstructionFilter.hxx(438,23): error C2664:

TSpectrum=itk::CudaImage<float,3>, [C:\ITKRTK\ITK-Build\Wrapping\Modules\RTK\RTKPython.vcxproj]

C:\ITKRTK\ITK\Modules\Remote\RTK\include\rtkMechlemOneStepSpectralReconstructionFilter.hxx(438,23): error C2664:

TProjections=itk::CudaImage<float,3> [C:\ITKRTK\ITK-Build\Wrapping\Modules\RTK\RTKPython.vcxproj]

C:\ITKRTK\ITK\Modules\Remote\RTK\include\rtkMechlemOneStepSpectralReconstructionFilter.hxx(438,23): error C2664: ]

[C:\ITKRTK\ITK-Build\Wrapping\Modules\RTK\RTKPython.vcxproj]

C:\ITKRTK\ITK\Modules\Remote\RTK\include\rtkMechlemOneStepSpectralReconstructionFilter.hxx(438,23): error C2664: an

d [C:\ITKRTK\ITK-Build\Wrapping\Modules\RTK\RTKPython.vcxproj]

C:\ITKRTK\ITK\Modules\Remote\RTK\include\rtkMechlemOneStepSpectralReconstructionFilter.hxx(438,23): error C2664: [

[C:\ITKRTK\ITK-Build\Wrapping\Modules\RTK\RTKPython.vcxproj]

C:\ITKRTK\ITK\Modules\Remote\RTK\include\rtkMechlemOneStepSpectralReconstructionFilter.hxx(438,23): error C2664:

TProjections=itk::CudaImage<float,3> [C:\ITKRTK\ITK-Build\Wrapping\Modules\RTK\RTKPython.vcxproj]

C:\ITKRTK\ITK\Modules\Remote\RTK\include\rtkMechlemOneStepSpectralReconstructionFilter.hxx(438,23): error C2664: ]

[C:\ITKRTK\ITK-Build\Wrapping\Modules\RTK\RTKPython.vcxproj]

(compiling source file ‘../RTK/rtkMechlemOneStepSpectralReconstructionFilterPython.cpp’)