Skip to content

COMP: Find PyBuffer templates in an installed ITK - #1001

Open
hjmjohnson wants to merge 1 commit into
RTKConsortium:mainfrom
hjmjohnson:comp-pybuffer-template-install-tree
Open

hjmjohnson wants to merge 1 commit into
RTKConsortium:mainfrom
hjmjohnson:comp-pybuffer-template-install-tree

Conversation

@hjmjohnson

Copy link
Copy Markdown
Contributor

Look for ITKBridgeNumPy's PyBuffer.i.init and PyBuffer.i.in under ${WRAP_ITK_CMAKE_DIR}/Modules/ITKBridgeNumPy/ first, falling back to the source-tree <include>/../wrapping path. An installed ITK has no such directory; with InsightSoftwareConsortium/ITK#6891 and ITK_INSTALL_WRAPPING_DEVELOPMENT_FILES=ON it installs each module's SWIG templates under the wrapping package directory instead.

Against an ITK build tree nothing changes: the installed path does not exist there, so the existing lookup is used.

Verification

Linux x86-64, conda gcc 14.3, CUDA 13.3 (CMAKE_CUDA_ARCHITECTURES=89), ITK at InsightSoftwareConsortium/ITK#6891 head 5e059e1 installed to a prefix with Python wrapping (F/D, dims 2/3/4) and ITK_INSTALL_WRAPPING_DEVELOPMENT_FILES=ON; ITKCudaCommon cf8eb2c built and installed into the same prefix.

RTK 6eaffcc with this change, RTK_USE_CUDA=ON, ITK_WRAP_PYTHON=ON: configure, build (915 steps, itkPyBufferRTK wrapped), and install succeed. From the installed package, rtk.CudaFDKConeBeamReconstructionFilter.New() and itk.array_from_image on a 3D image work.

Without this change the same configure fails with File .../include/wrapping/PyBuffer.i.in does not exist, as reported by @axel-grc on the ITK PR.

An installed ITK has no <include>/../wrapping directory. With
ITK_INSTALL_WRAPPING_DEVELOPMENT_FILES=ON it installs each module's
SWIG templates under ${WRAP_ITK_CMAKE_DIR}/Modules/<Module>/, so look
there first and keep the source-tree path as the fallback.
@SimonRit

SimonRit commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

Can you confirm @hjmjohnson it's ready to be merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants