Skip to content

COMP: Build and wrap against an installed ITK 6 - #58

Merged
hjmjohnson merged 3 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:itk6-compat
Sep 24, 2026
Merged

hjmjohnson merged 3 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:itk6-compat

Conversation

@hjmjohnson

Copy link
Copy Markdown
Member

Make LesionSizingToolkit build and wrap against an installed ITK 6 tree. Two commits: build and wrapping fixes, and a missing GetInput() definition that kept the Python module from loading.

Build and wrapping fixes (COMP)
  • The src/ examples include the module's own headers, which only reach the compiler inside an ITK source tree; name the include directory.
  • The examples enable ITK's IO factory register manager, so they link ITK_LIBRARIES.
  • itkSatoVesselnessFeatureGenerator.wrap wrapped the derived Sigmoid class, so the base was never instantiated; base classes now come first in WRAPPER_SUBMODULE_ORDER.
  • DescoteauxSheetness, FrangiTubularness, and LocalStructure index their input pixel, so they wrap over covariant-vector images with a real output, as VectorMagnitudeImageFilter does in ITK.
  • The Sato generators and LesionSegmentationImageFilter8 embed VesselEnhancingDiffusion3DImageFilter, so they wrap in three dimensions only; the lesion filter's output is real, matching the segmentation modules.
  • RegionCompetitionImageFilter indexes an array with its output pixel, so it wraps integer outputs only.
GetInput definitions (BUG)

FeatureGenerator and thirteen subclasses declared GetInput() const; only SegmentationModule defined it. C++ never called it, but SWIG wraps every declared method, so the Python module failed to load with undefined symbols. It is now defined once in FeatureGenerator (and in IsotropicResampler) and inherited.

Verification

Configured with ITK_DIR pointing at an installed ITK 6 tree (upstream main as of 2026-09-22, ITK_WRAP_PYTHON=ON), built the module and its Python wrapping, and imported the wrapped module from Python. The module still builds against ITK 5.4.

The src/ executables include the module's own headers, which only reach the
compiler when the module is built inside an ITK source tree. Name the include
directory so they also build against an installed ITK.

The example programs enable ITK's IO factory register manager, which
references every IO module the ITK build enables, so they must link
ITK_LIBRARIES rather than only the module's own dependencies.

The wrapping instantiated VesselEnhancingDiffusion3DImageFilter as an image
filter with two image types; the template takes a pixel type and a dimension.
Wrap it over the scalar pixel types in three dimensions.

SWIG runs with -Werror, so a filter whose superclass is not wrapped fails
with warning 401. DescoteauxSheetness and FrangiTubularness derive from
UnaryFunctorImageFilter; wrap them POINTER_WITH_SUPERCLASS like
LocalStructureImageFilter and ITK's own UnaryFunctor subclasses.

itkSatoVesselnessFeatureGenerator.wrap wrapped the derived Sigmoid class
instead of SatoVesselnessFeatureGenerator, so no interface existed for the
base. Wrap the right class, and list base classes first in
WRAPPER_SUBMODULE_ORDER so each derived interface imports a wrapped base.

The sheetness, tubularness, and local-structure functors index their input
pixel, so wrap them over covariant-vector images (the eigenvalue image
type ITK wraps) instead of scalar images. RegionCompetitionImageFilter
indexes an array with its output pixel, so wrap integer outputs only.
The Sato vesselness generators and LesionSegmentationImageFilter8 embed
VesselEnhancingDiffusion3DImageFilter, so wrap them in three dimensions
only; the segmentation modules produce float images, so the lesion
filter's output is real.
FeatureGenerator and thirteen subclasses declared GetInput() const, but
only SegmentationModule defined it. C++ callers never used it, so the
missing definitions went unnoticed; SWIG wraps every declared method,
so the Python module failed to load with undefined symbols. Define it in
FeatureGenerator and IsotropicResampler, and let the feature generators
inherit it.
@hjmjohnson
hjmjohnson marked this pull request as ready for review September 22, 2026 16:05

@dzenanz dzenanz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good on a glance.

@v5.4.6 no longer resolves to a tag; every job failed identically after a
~9-minute build, in a second, flag-less CMake reconfigure of the same
binary directory that could not find ITK::LesionSizingToolkitModule, which
is not present at v5.4.4 or on the workflow's current main branch. Most
likely v5.4.6 was itself a since-reverted release. Pin to v5.4.4, the
latest tag confirmed to exist.
@hjmjohnson
hjmjohnson merged commit 94a3834 into InsightSoftwareConsortium:main Sep 24, 2026
3 of 22 checks passed
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