Skip to content

ENH: Restore the static LevelSetsv4 examples without VTK rendering - #485

Draft
hjmjohnson wants to merge 2 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:enh-modernize-static-levelsetsv4
Draft

hjmjohnson wants to merge 2 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:enh-modernize-static-levelsetsv4

Conversation

@hjmjohnson

Copy link
Copy Markdown
Member

Restore five LevelSetsv4 examples excluded since ITK 5 by writing their output
instead of rendering through VTK classes ITK no longer has. They move to
Segmentation/LevelSetsv4.

Why these examples, and why they move

These are the only examples of the LevelSetsv4 framework — LevelSetDenseImage,
the Whitaker, Shi, and Malcolm sparse level sets, and
BinaryImageToLevelSetImageAdaptor appear in no other example. They were built
only under if(ITK_VERSION_MAJOR LESS 5) because their visualization classes
moved out of ITK in 2019 (LevelSetsv4Visualization, now in the separate
ITKVtkGlue repository). The level-set code itself is unchanged ITK 6 API.

Once they no longer render, nothing ties them to VTK, so they move from
Bridge/VtkGlue to Segmentation/LevelSetsv4, matching the ITK module.

What each example now writes

The two dense examples used to differ only in how they rendered, so each now
writes what its name describes:

example output
VisualizeStaticDense2DLevelSetAsElevationMap dense level-set values
VisualizeStaticDense2DLevelSetZeroSet zero set, via ZeroCrossingImageFilter
VisualizeStatic{Whitaker,Shi,Malcolm}2DLevelSetLayers sparse layers, sampled on the image grid

All five also fix a latent bug: the Otsu mask pipeline was never updated before
the level set was initialized, so the level set started from an empty mask and
every pixel landed outside it.

The rendered screenshot (levelsets.png) is removed from each page, since it
showed a renderer that no longer exists.

Verification

Built against ITK main: 0 build failures, and all 5 new tests pass. Each
output was inspected, not just checked for existence:

example output
Dense ElevationMap values −10.2 to 42.3, 2147 pixels inside
Dense ZeroSet 1914-pixel contour
Whitaker layers −3, −2, −1, 0, 1, 2, 3
Shi layers −3, −1, 1, 3
Malcolm layers −1, 0, 1

Commit 1 is a pure move (25 renames at 100% similarity), so history follows the
files. pre-commit run --all-files passes.

The tests check that each example runs; they do not compare against a baseline
image, which would first need new test data published.

These examples demonstrate the LevelSetsv4 framework, not the VTK
bridge. They have been excluded from the build since ITK 5 because their
VTK visualization classes left ITK, so they are unbuilt on both sides of
this move.
The examples rendered through VTK visualization classes that ITK no
longer contains. Each now writes what it demonstrates: the dense
level-set values, the zero set via ZeroCrossingImageFilter, or the
sparse layers sampled on the image grid. A run test covers each one.

The Otsu mask pipeline was never updated before the level set was
initialized, so the level set started from an empty mask; update it
first.
@github-actions github-actions Bot added type:Enhancement Improvement of existing methods or implementation area:Documentation Issues affecting the Documentation module area:Segmentation Issues affecting the Segmentation module type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots area:Bridge Issues affecting the Bridge module type:Data Changes to example data (usually displayed images) language:C++ Changes to C++ examples labels Sep 14, 2026

@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.

@dzenanz

dzenanz commented Sep 14, 2026

Copy link
Copy Markdown
Member

Some of Kitware's services are currently under DDoS attack. cmake.org timeout is real, but temporary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Bridge Issues affecting the Bridge module area:Documentation Issues affecting the Documentation module area:Segmentation Issues affecting the Segmentation module language:C++ Changes to C++ examples type:Data Changes to example data (usually displayed images) type:Enhancement Improvement of existing methods or implementation type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants