COMP: Keep GeodesicActiveContour example working on ITK 5.4 and 6.0 - #476
Draft
hjmjohnson wants to merge 2 commits into
Draft
COMP: Keep GeodesicActiveContour example working on ITK 5.4 and 6.0#476hjmjohnson wants to merge 2 commits into
hjmjohnson wants to merge 2 commits into
Conversation
…ists src/External and src/GPU hold no examples yet, but src/CMakeLists.txt calls add_subdirectory() on both, so each needs a CMakeLists.txt. With those files empty, gersemi wrote a lone newline and end-of-file-fixer stripped it back, so `pre-commit run --all-files` never converged. Documenting why the files exist gives both hooks something to agree on. Also applies gersemi's pending reformat of ComputeCurvatureAnisotropicDiffusion/CMakeLists.txt.
ITK 6.0 wraps VectorContainer<IdentifierType, LevelSetNode<...>>; ITK 5.4 wraps VectorContainer<unsigned int, LevelSetNode<...>>. The two mangled template keys are disjoint, so a single spelling cannot run on both. Verified against ITK 5.4.6: the example completes in 171 iterations with RMS change 0.0198.
This was referenced Sep 2, 2026
hjmjohnson
marked this pull request as ready for review
September 2, 2026 14:01
hjmjohnson
marked this pull request as draft
September 2, 2026 16:22
dzenanz
reviewed
Sep 2, 2026
dzenanz
left a comment
Member
There was a problem hiding this comment.
Looks good. Rebase on main before merging.
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.
SegmentWithGeodesicActiveContourLevelSet/Code.pyhard-codesitk.VectorContainer[itk.UI, LevelSetNode], which ITK 6.0 no longer wraps after InsightSoftwareConsortium/ITK#6803. Selecting the index type at runtime keeps the example working on both 5.4 and 6.0.Why a single spelling cannot cover both
ITK#6803 changes
LevelSetTypeDefault::NodeContainerfromVectorContainer<unsigned int, NodeType>to the one-argumentVectorContainer<NodeType>, whose index type isSizeValueType, and updatesITKFastMarchingBase.wrapaccordingly.The wrapping registry is keyed by the mangled name emitted by that one
itk_wrap_templatecall, so the two spellings are strictly disjoint across the version boundary — there is no release where both resolve:itk.VectorContainer[itk.UI, LevelSetNode]itk.VectorContainer[itk.IT, LevelSetNode]TemplateTypeErrorTemplateTypeErrorConfirmed empirically against ITK 5.4.6, and
ITKFastMarchingBase.wrapis byte-identical atv5.4.7,release-5.4andmain-before-#6803.itk.TemplateTypeErrorsubclassesTypeError, which is what the guard catches.Test
Ran the example end to end against ITK 5.4.6 on
BrainProtonDensitySlice.png(theexceptbranch, which ITK's own CI cannot reach): exit 0, 171 iterations, RMS change 0.0198, output written.NodeTypeis also hoisted so the template is spelled once rather than twice.