WIP: Require ITK 6 and request modules as find_package COMPONENTS - #481
Draft
hjmjohnson wants to merge 13 commits into
Draft
WIP: Require ITK 6 and request modules as find_package COMPONENTS#481hjmjohnson wants to merge 13 commits into
hjmjohnson wants to merge 13 commits into
Conversation
hjmjohnson
force-pushed
the
comp-require-itk6
branch
from
September 12, 2026 18:36
2bac5c9 to
18403e0
Compare
Python 3.12 removed distutils, so every example guarding its minimum ITK
version with distutils.version.StrictVersion fails at import:
ModuleNotFoundError: No module named 'distutils'
Compare the dotted version components as a tuple instead, which needs no
import at all and keeps each example's existing minimum.
SegmentBloodVessels and
SegmentBloodVesselsWithMultiScaleHessianBasedMeasure called sys.exit()
in that guard without importing sys; add the import.
Every example links ITK::...Module interface targets, which ITK 5.x does not export, so against ITK 5.4 configure fails with one missing-target error per example (346 in all). Requiring ITK 6 stops at the first find_package with a single version error instead. Examples for ITK 5.x now live on the release-5.4 branch.
Request the modules the example uses as find_package(ITK COMPONENTS)
and link ${ITK_INTERFACE_LIBRARIES}, the form the ITK 6 migration guide
recommends. The ITKImageIO factory meta-module is both requested and
linked, since linking it is what enables the generated registration.
Component names are module names (ITKAnisotropicSmoothing), not the
ITK::...Module target names.
Supersedes InsightSoftwareConsortium#470.
Co-Authored-By: Bradley Lowekamp <blowekamp@mail.nih.gov>
Move each ITK::<Name>Module link target into find_package(ITK
COMPONENTS <Name>) and link ${ITK_INTERFACE_LIBRARIES}. Factory
meta-modules such as ITKImageIO are requested and still linked, since
linking one enables its registration. ITKVtkGlue and
ITKVideoBridgeOpenCV stay explicit links because they are conditional.
Co-Authored-By: Bradley Lowekamp <blowekamp@mail.nih.gov>
Move each ITK::<Name>Module link target into find_package(ITK
COMPONENTS <Name>) and link ${ITK_INTERFACE_LIBRARIES}. Factory
meta-modules such as ITKImageIO are requested and still linked, since
linking one enables its registration. ITKVtkGlue and
ITKVideoBridgeOpenCV stay explicit links because they are conditional.
Co-Authored-By: Bradley Lowekamp <blowekamp@mail.nih.gov>
hjmjohnson
force-pushed
the
comp-require-itk6
branch
from
September 12, 2026 18:38
18403e0 to
c76bf1d
Compare
hjmjohnson
commented
Sep 12, 2026
hjmjohnson
commented
Sep 12, 2026
Move each ITK::<Name>Module link target into find_package(ITK
COMPONENTS <Name>) and link ${ITK_INTERFACE_LIBRARIES}. Factory
meta-modules such as ITKImageIO are requested and still linked, since
linking one enables its registration. ITKVtkGlue and
ITKVideoBridgeOpenCV stay explicit links because they are conditional.
Co-Authored-By: Bradley Lowekamp <blowekamp@mail.nih.gov>
Move each ITK::<Name>Module link target into find_package(ITK
COMPONENTS <Name>) and link ${ITK_INTERFACE_LIBRARIES}. Factory
meta-modules such as ITKImageIO are requested and still linked, since
linking one enables its registration. ITKVtkGlue and
ITKVideoBridgeOpenCV stay explicit links because they are conditional.
Co-Authored-By: Bradley Lowekamp <blowekamp@mail.nih.gov>
Move each ITK::<Name>Module link target into find_package(ITK
COMPONENTS <Name>) and link ${ITK_INTERFACE_LIBRARIES}. Factory
meta-modules such as ITKImageIO are requested and still linked, since
linking one enables its registration. ITKVtkGlue and
ITKVideoBridgeOpenCV stay explicit links because they are conditional.
Co-Authored-By: Bradley Lowekamp <blowekamp@mail.nih.gov>
Move each ITK::<Name>Module link target into find_package(ITK
COMPONENTS <Name>) and link ${ITK_INTERFACE_LIBRARIES}. Factory
meta-modules such as ITKImageIO are requested and still linked, since
linking one enables its registration. ITKVtkGlue and
ITKVideoBridgeOpenCV stay explicit links because they are conditional.
Co-Authored-By: Bradley Lowekamp <blowekamp@mail.nih.gov>
Move each ITK::<Name>Module link target into find_package(ITK
COMPONENTS <Name>) and link ${ITK_INTERFACE_LIBRARIES}. Factory
meta-modules such as ITKImageIO are requested and still linked, since
linking one enables its registration. ITKVtkGlue and
ITKVideoBridgeOpenCV stay explicit links because they are conditional.
Co-Authored-By: Bradley Lowekamp <blowekamp@mail.nih.gov>
Move each ITK::<Name>Module link target into find_package(ITK
COMPONENTS <Name>) and link ${ITK_INTERFACE_LIBRARIES}. Factory
meta-modules such as ITKImageIO are requested and still linked, since
linking one enables its registration. ITKVtkGlue and
ITKVideoBridgeOpenCV stay explicit links because they are conditional.
Co-Authored-By: Bradley Lowekamp <blowekamp@mail.nih.gov>
Move each ITK::<Name>Module link target into find_package(ITK
COMPONENTS <Name>) and link ${ITK_INTERFACE_LIBRARIES}. Factory
meta-modules such as ITKImageIO are requested and still linked, since
linking one enables its registration. ITKVtkGlue and
ITKVideoBridgeOpenCV stay explicit links because they are conditional.
Co-Authored-By: Bradley Lowekamp <blowekamp@mail.nih.gov>
Move each ITK::<Name>Module link target into find_package(ITK
COMPONENTS <Name>) and link ${ITK_INTERFACE_LIBRARIES}. Factory
meta-modules such as ITKImageIO are requested and still linked, since
linking one enables its registration. ITKVtkGlue and
ITKVideoBridgeOpenCV stay explicit links because they are conditional.
Co-Authored-By: Bradley Lowekamp <blowekamp@mail.nih.gov>
hjmjohnson
force-pushed
the
comp-require-itk6
branch
from
September 12, 2026 18:43
c76bf1d to
153b8ef
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Require ITK 6 and request each example's modules as
find_packageCOMPONENTS,linking
${ITK_INTERFACE_LIBRARIES}. Supersedes #470.Stacked on #479 — review the 12 commits from
COMP: Require ITK 6onward.Why require ITK 6
Every example already links
ITK::<Name>Moduleinterface targets, which ITK 5.x does not export. Against ITK 5.4 the build fails with one missing-target error per example (346 in all); requiring ITK 6 stops at the firstfind_packagewith a single version error instead.Examples for ITK 5.x live on the
release-5.4branch, created atb0679d89, the last commit that still builds with ITK 5.x (verified against ITK 5.4.7: 0 failed targets, 346 executables, 370/370 tests).What the conversion does, and the two rules it follows
Each example's
ITK::<Name>Modulelink targets becomefind_packagecomponents, and the link list becomes${ITK_INTERFACE_LIBRARIES}:Two rules the script applies, both load-bearing:
ITKAnisotropicSmoothing, notITK::ITKAnisotropicSmoothingModule. Naming a target here stops the configure withNo such module.ITKImageIO,ITKMeshIO,ITKTransformIO,ITKFFTImageFilterInit), because linking the meta-module is what enables the generated registration code.ITKVtkGlueandITKVideoBridgeOpenCVstay explicit links and are deliberately not components: they are conditional, so requiring them would break every VTK-less or OpenCV-less build.Commits are one per top-level
src/directory, from 12 files inBridgeto 183 inFiltering.Verification
Built against ITK
mainwithModule_ITKVtkGlue=ONand Python wrapping enabled, then run through the project's own ctest suite:0 new failures, 0 newly passing. The conversion is behavior-neutral, which is the intent: it changes how modules are requested, not what gets linked. Spot-checked on one example that the executable links the same 52 ITK libraries, registers the same 24 ImageIO factories, and produces byte-identical output.
pre-commit run --all-filespasses, gersemi included.