Repository navigation
BUG: Compute curvature whenever the reinitialization term needs it - #6606
Conversation
|
| Filename | Overview |
|---|---|
| Modules/Nonunit/Review/include/itkRegionBasedLevelSetFunction.hxx | Computes curvature for both term consumers while preserving each term's activation guard. |
| Modules/Nonunit/Review/test/CMakeLists.txt | Registers the new region-based level set GoogleTest source. |
| Modules/Nonunit/Review/test/itkRegionBasedLevelSetFunctionGTest.cxx | Adds regression tests for the reinitialization-only curvature subtraction cases. |
Reviews (1): Last reviewed commit: "BUG: Compute curvature whenever the rein..." | Re-trigger Greptile
b614a70 to
f1b786a
Compare
|
First force-push = plain rebase on main; second = review fix only — the new GTest's helper classes are renamed ( |
f1b786a to
f356c41
Compare
The reinitialization term is Laplacian(phi) minus curvature, but curvature was only computed when the curvature-length term was active (dh != 0 and CurvatureWeight != 0). Either condition alone made the reinitialization term silently collapse to a bare Laplacian, coupling two independent regularization weights. Addresses item B30 of InsightSoftwareConsortium#6575.
f356c41 to
47d1a01
Compare
|
Force-push = plain rebase onto current main, folding the new GTest source into the |
The reinitialization term in
RegionBasedLevelSetFunction::ComputeUpdate()subtracts a curvature that was only computed when the curvature-length term was active, so it silently degenerated to a bare Laplacian. Addresses B30 of #6575.Root cause
itkRegionBasedLevelSetFunction.hxx:255-269—curvatureis populated inside the curvature-length guard, then read by the reinitialization term, which has its own independent activation condition:Whenever
CurvatureWeight == 0, ordh == 0at a pixel,curvaturestays at its zero initializer and the term collapses toLaplacian(phi)alone — coupling two regularization weights that the class documents (itkRegionBasedLevelSetFunction.h:445-448) as independent, and dropping thediv(grad(phi)/|grad(phi)|)half ofLaplacian(phi) - div(grad(phi)/|grad(phi)|). Thedhfactor belongs to the curvature-length term only; the reinitialization term has nodhin its formula.ComputeCurvature()is now called once when either consumer needs it, and the two guards are separate.Local validation
New GoogleTest
itkRegionBasedLevelSetFunctionGTest.cxx, registered inITKReviewGTests.phi = x^2 + y^2gives curvature 1 and Laplacian 4 at the probed pixel, so the correct reinitialization contribution is 3.0 and the buggy one is 4.0. One test per half of the guard:ReinitializationTermSubtractsCurvatureWhenCurvatureWeightIsZero— fail-before 4.0, pass-after 3.0.ReinitializationTermSubtractsCurvatureWhenDerivativeIsZero— fail-before 4.0, pass-after 3.0.No ExternalData baseline changes. All six
ScalarChanAndVese*LevelSetImageFilterregression tests were run with baselines downloaded, before and after the fix:ImageError = 0in every case. Test2_2 (CurvatureWeight=0,ReinitializationSmoothingWeight=1) is the one configuration that exercises the bug at every pixel, yet its output is unchanged —MultiphaseDenseFiniteDifferenceImageFilter::ApplyUpdate()re-runs a fullSignedMaurerDistanceMapreinitialization every iteration (m_ReinitializeCounterdefaults to 1), which rebuilds the level set from the sign of phi and discards the magnitude of the per-pixel correction.AI assistance