Repository navigation
COMP: Build the VTK examples against ITK 5.4, ITK 6, and VTK 9 - #62
Merged
hjmjohnson merged 9 commits intoOct 13, 2026
Merged
Conversation
hjmjohnson
marked this pull request as ready for review
October 8, 2026 18:44
hjmjohnson
force-pushed
the
fix-vtk-examples
branch
from
October 8, 2026 18:49
e86e16c to
fb22ab6
Compare
dzenanz
approved these changes
Oct 10, 2026
With LSTK_USE_VTK=ON the examples failed at the first VTK header. The VTK 8 era vtk_module_config() macro built target names from an undefined _target_prefix and nothing called find_package(VTK), so the targets received neither the VTK:: libraries nor their include directories. Use find_package(VTK 9 COMPONENTS ...) for the modules the sources include, link the module library the same way src/ does, and add the module include directory.
VTK 9 registers the rendering and IO object factories of the modules an executable links through vtk_module_autoinit(); without it, creating a render window or an image writer finds no implementation at run time.
ITK 5 renamed SpatialObjectPoint::GetPosition()/SetPosition() to GetPositionInObjectSpace()/SetPositionInObjectSpace(), and GroupSpatialObject::GetNumberOfObjects()/GetObjects() to GetNumberOfChildren()/GetChildren() with ChildrenListType.
LesionSegmentation.cxx returned NULL where an Image::Pointer is expected, which does not convert once NULL is an integer constant, and LesionSurfaceExtraction.cxx used std::cerr without including <iostream>.
The header tested itkLesionSegmentationCommandLineProgressReporter_h but defined itkLesionSegmentatioCommandLineProgressReporter_h, so the guard never took effect and a second inclusion redefined the class.
Both Execute() overloads override itk::Command and trigger -Winconsistent-missing-override on every file that includes the header.
Drop the indentation after # in the preprocessor directives, which the repository .clang-format does not use.
hjmjohnson
force-pushed
the
fix-vtk-examples
branch
from
October 13, 2026 11:51
fb22ab6 to
097cf7f
Compare
…4 jobs v5.4.7 defaults to ITK 5.4.7 and updates the GitHub Actions that emit Node.js 20 deprecation warnings.
…ne filter ProgressAccumulator::SetMiniPipelineFilter() holds a SmartPointer, so a member accumulator pointed at its owner formed a reference cycle and LesionSegmentationMethod and FeatureAggregator were never destroyed. The leaked PoolMultiThreader kept the global ThreadPool alive past the teardown of its globals, so a pool thread that started late read a null ThreadPoolGlobals at exit and crashed intermittently. Create the accumulator in the call that uses it, as the other filters do.
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.
With
LSTK_USE_VTK=ONthe examples and visualization tools have not built since the ITK 5 SpatialObject refactoring, and CI never exercises that option. This replaces the VTK 8 eravtk_module_config()block withfind_package(VTK 9 COMPONENTS ...), updates the examples to the ITK 5 SpatialObject API, and builds all five executables against ITK 6 and VTK 9.6. Closes #42. Rebased ontomainafter #61 merged; the first seven commits are separate by class of change, fixes first and the style change last, and the eighth bumps the ITK 5.4 CI action pin, and the ninth fixes an intermittent exit-time segfault initkLesionSegmentationMethodTest1.Commits
COMP:find VTK 9 and link the module library (top-levelCMakeLists.txtonly).COMP:vtk_module_autoinit()for the five executables (two CMake files, one added line per target).COMP:ITK 5 SpatialObject API in the examples (CLI.h,ViewImageSlicesAndSegmentationContours.cxx).COMP:return nullptrfor anImage::Pointer, and the missing<iostream>.BUG:misspelled include guard#define, one line.COMP:overrideon the twoExecute()methods.STYLE:clang-format of the progress reporter header (whitespace only).COMP:ITKRemoteModuleBuildTestPackageAction@v5.4.6to@v5.4.7in both ITK 5.4 jobs (answers a review question on COMP: Build and test against ITK 5.4 and ITK 6 #61).BUG:LesionSegmentationMethodandFeatureAggregatorkept aProgressAccumulatormember whoseSetMiniPipelineFilter(this)SmartPointer formed a reference cycle, so neither was ever destroyed. The leakedPoolMultiThreaderkept the globalThreadPoolalive past its globals' teardown, and a late-starting pool thread then read a nullThreadPoolGlobals(itkThreadPool.cxx:193). The accumulator is now created in the call that uses it. On Linux with an ASan+UBSan ITK at5d31af3cfdfthe test crashed in 69 of 3000 parallel runs before and in 0 of 6000 after.Nothing outside these classes changed (CI workflow pin aside): the existing CMake text is kept as written and only the required lines are added.
What was wrong
CMakeLists.txtdefined its ownvtk_module_config()that prefixed names with an undefined_target_prefixand never calledfind_package(VTK), soExamples/andUtilities/Visualization/targets received neither the module include directory nor anyVTK::target; the build failed at the first VTK header.Examples/LesionSegmentationCLI.handUtilities/Visualization/ViewImageSlicesAndSegmentationContours.cxxusedSpatialObjectPoint::GetPosition()/SetPosition()andGroupSpatialObject::GetNumberOfObjects()/GetObjects(), all removed in ITK 5 (GetPositionInObjectSpace,SetPositionInObjectSpace,GetNumberOfChildren,GetChildren).Examples/LesionSegmentation.cxxreturnedNULLas anImage::Pointer;LesionSurfaceExtraction.cxxusedstd::cerrwithout<iostream>; the progress-reporter header had a misspelled guard andvirtualoverrides withoutoverride.Test plan
External-module build on macOS arm64 against ITK
main(6.0) and VTK 9.6 with-DLSTK_USE_VTK=ON: configure succeeds,LesionSegmentation,ViewImageAndSegmentationSurface,ViewImageSlicesAndSegmentationContours,LesionSurfaceExtraction, andIsoSurfaceVolumeEstimationall build, andLesionSegmentation -hprints its MetaCommand usage. The default configuration (LSTK_USE_VTK=OFF) configures as before, which is what CI runs; every change is insideif(LSTK_USE_VTK)or in files only that option compiles. Not built against ITK 5.4 with VTK; the API names used exist in 5.4.