Skip to content

COMP: Stop requiring ITKGPUCommon for ELASTIX_USE_OPENCL (ITK 6) - #1503

Open
hjmjohnson wants to merge 1 commit into
SuperElastix:mainfrom
hjmjohnson:remove-itkgpucommon-dependency
Open

hjmjohnson wants to merge 1 commit into
SuperElastix:mainfrom
hjmjohnson:remove-itkgpucommon-dependency

Conversation

@hjmjohnson

@hjmjohnson hjmjohnson commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

WIP, for discussion. ITK 6 plans to remove its in-tree OpenCL GPU modules (InsightSoftwareConsortium/ITK#7284, issue InsightSoftwareConsortium/ITK#6075). With ELASTIX_USE_OPENCL=ON, elastix still requests ITKGPUCommon and so would fail at find_package(ITK). This PR drops that request.
Merge danger: two-way door; blast radius: ELASTIX_USE_OPENCL=ON builds only (off by default).

@N-Dekker, can you confirm this is OK for elastix? On #6107 you reported that elastix builds without ITK's GPU modules. The two lines naming ITKGPUCommon appear to be the only remaining tie, and the module turns out to be required but unused.

Why ITKGPUCommon is required but unused
  • elastix stops at configure unless ITK was built with ITK_USE_GPU=OFF, because it overrides ITK's GPU classes. With ITK_USE_GPU=OFF, ITK's ITKGPUCommon builds no library and adds no link libraries (Modules/Core/GPUCommon/src/CMakeLists.txt and ITKGPUCommon_LIBRARIES are both inside if(ITK_USE_GPU)). Its only contribution is an include directory.
  • elastix includes 15 headers whose names match ITK GPU-module headers (itkGPUImage.h, itkGPUDataManager.h, itkOpenCLUtil.h, itkGPUCastImageFilter.h, and others). elastix carries its own copy of every one, in Common/OpenCL/ITKimprovements and Common/OpenCL/Filters. It includes no ITK GPU header that it lacks a copy of.
  • The itkGPUKernelClassMacro that elastix's kernels use is in ITK's itkMacro.h (ITKCommon), which #7284 keeps.
Shape of the change
COMP: Stop requiring ITKGPUCommon for ELASTIX_USE_OPENCL
  CMakeLists.txt                 - _GPU_depends (ITKGPUCommon) from find_package(ITK COMPONENTS)
  Common/OpenCL/CMakeLists.txt   - ITKGPUCommon from elastix_link_itk(elxOpenCL ...)

The if(${ITK_USE_GPU}) message(FATAL_ERROR ...) guard stays: it still protects builds against ITK 5.4 configured with ITK_USE_GPU=ON. ITK 6 sets ITK_USE_GPU to OFF in ITKConfig.cmake.

Evidence

Local, macOS arm64, conda clang, ELASTIX_USE_OPENCL=ON, against an ITK build of #7284 (no GPU modules), with the Apple OpenCL framework:

AI assistance

Prepared with Claude Code (Opus 5.5) under Hans Johnson's direction; reviewed by Hans Johnson.

elastix builds its OpenCL support from its own copies of the ITK GPU
classes (Common/OpenCL/ITKimprovements) and requires ITK_USE_GPU=OFF,
in which case ITK's ITKGPUCommon module builds no library and adds only
an include directory whose headers elastix does not use. ITK 6 removes
the module (InsightSoftwareConsortium/ITK#7284), so requesting it makes
find_package(ITK) fail. Drop it from the ITK components and from the
elxOpenCL module list.
@hjmjohnson
hjmjohnson force-pushed the remove-itkgpucommon-dependency branch from 632290b to 95dce59 Compare December 1, 2026 18:11
@hjmjohnson hjmjohnson changed the title WIP: COMP: Stop requiring ITKGPUCommon for ELASTIX_USE_OPENCL (ITK 6) COMP: Stop requiring ITKGPUCommon for ELASTIX_USE_OPENCL (ITK 6) Dec 1, 2026
@hjmjohnson
hjmjohnson marked this pull request as ready for review December 1, 2026 22:29
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.

1 participant