ENH: Ingest ITKMorphologicalContourInterpolation (stacked on #6208)#6209
ENH: Ingest ITKMorphologicalContourInterpolation (stacked on #6208)#6209hjmjohnson merged 223 commits intoInsightSoftwareConsortium:mainfrom
Conversation
Issue #1.
ENH: Add module skeleton.
ENH: adding test data
ENH: adding the rest of test data from Paul
Started implementation
…ement the 3 cases, implement alignment
ENH: Add wasm configuration
Remove unused variable and commented code block: getting the largest
possible region of the superclass (`ImageToImageFilter`) is most likely
being exercised in ITK proper.
Fixes:
```
test/itkMorphologicalContourInterpolationTest.cxx:37:34:
warning: unused variable 'reg' [-Wunused-variable]
37 | typename ImageType::RegionType reg = test->GetLargestPossibleRegion();
| ^~~
```
raised for example in:
https://open.cdash.org/viewBuildError.php?type=1&buildid=10154304
When preparing for the future with ITK by setting ITK_FUTURE_LEGACY_REMOVE:BOOL=ON ITK_LEGACY_REMOVEBOOL=ON The future preferred macro should be used │ - itkTypeMacro │ + itkOverrideGetNameOfClassMacro
…/update-cid-tags ENH: Convert ExternalData .md5 tags to .cid (IPFS content IDs)
|
Closing temporarily — this PR is stacked on #6208 (RLEImage ingest) and will be reopened (or re-submitted) once #6208 lands on main. MCI's tests use The 11 missing CIDs are now published (ITKTestingData PR #47, merged), and the rerun of "Populate shared ExternalData cache" went green at |
|
PR generally looks good. |
|
Rebased on |
Brings MorphologicalContourInterpolation from a configure-time remote fetch into the ITK source tree at Modules/Filtering/MorphologicalContourInterpolation/ using the v4 ingestion pipeline (whitelist filter-repo + per-commit clang-format + black + commit-prefix sanitization). Upstream repo: https://github.com/KitwareMedical/ITKMorphologicalContourInterpolation.git Upstream tip: a0ed9f7fa58fc09270bb8f2c49a68243acfedd46 Ingest date: 2026-05-04 Whitelist: MorphologicalContourInterpolation.list Per-commit transforms applied across all 217 commits: - filter-repo --paths-from-file (whitelist) - filter-repo --to-subdirectory-filter Modules/Filtering/MorphologicalContourInterpolation - clang-format -style=file (ITK main's .clang-format) for *.cxx/.h/.hxx/... - black for *.py - heuristic ITK prefix added to commit subjects without one Merge topology preserved: 77 -> 46 merge(s). Primary author: Dženan Zukić <dzenan.zukic@kitware.com> Co-authored-by: Adrien Boucaud <adrien.bk@free.fr> Co-authored-by: Dzenan Zukic <dzenan.zukic@kitware.com> Co-authored-by: Dženan Zukić <dzenanz@gmail.com> Co-authored-by: Hans J. Johnson <hans-johnson@uiowa.edu> Co-authored-by: Hans Johnson <hans-johnson@uiowa.edu> Co-authored-by: Hans Johnson <hans.j.johnson@gmail.com> Co-authored-by: Jon Haitz Legarreta <jhlegarreta@vicomtech.org> Co-authored-by: Jon Haitz Legarreta Gorroño <jon.haitz.legarreta@gmail.com> Co-authored-by: Mathew J. Seng <mathewseng@gmail.com> Co-authored-by: Mathew Seng <mathewseng@gmail.com> Co-authored-by: Matt McCormick <matt.mccormick@kitware.com> Co-authored-by: Matt McCormick <matt@mmmccormick.com> Co-authored-by: Stephen Aylward <stephen.aylward@kitware.com> Co-authored-by: Tom Birdsong <tom.birdsong@kitware.com> Co-authored-by: vicory <jared.vicory@kitware.com>
…akeLists Removes cmake_minimum_required, CXX_STANDARD policing, and the standalone-build wrapper that the in-tree module never uses.
|
Too many files changed for review. ( |
thread_local ITK SmartPointers in template functions crash on MSVC at program shutdown: ITK thread-pool workers destroy their thread_local objects after ITK's reference-count infrastructure is partially torn down. The per-thread caching is unnecessary given ITKv5's threading model; local variables are correct and the allocation overhead is negligible relative to the filter computations.
bf2088d
into
InsightSoftwareConsortium:main
Ingests
MorphologicalContourInterpolationfrom the standalone remote module KitwareMedical/ITKMorphologicalContourInterpolation into ITK atModules/Filtering/MorphologicalContourInterpolation/. Stacked on PR #6208 (RLEImage ingest) — that PR provides MCI'sTEST_DEPENDS RLEImageand the CTAD deduction guides that MCI's RLE-flavored test exercises.Local validation:
pre-commit run --all-filesclean;MorphologicalContourInterpolationTestDriverbuilds; 368/368 MCI tests pass locally (plain + RLE-flavored, all algorithms B/C/T, all axis/label combinations).BUG fix: thread_local SmartPointers removed (latest commit)
The upstream module used
thread_localITK SmartPointers in template functions as a per-thread filter cache. On MSVC,thread_localobjects in template functions are destroyed when ITK's thread-pool workers exit at program shutdown — after ITK's reference-count infrastructure is partially torn down — causing SEGFAULTs. This manifested as 26 test failures onwindows-2022CI (GridSeg, GridSeg2, AccidentalMiddleSliceSeg, SevenLabels, FullEnd, ThreeAxisFourLabelConflict images). The fix replaces all 8thread_localSmartPointer declarations with ordinary local variables; the per-thread caching is unnecessary under ITKv5's threading model and the allocation overhead is negligible.What this provides
MorphologicalContourInterpolationprovides filters that interpolate manually-segmented anatomical contours through volumetric label data using morphological reconstruction. Given a sparse set of 2D contours on arbitrary slices, the filter reconstructs a complete 3D label mask. The flagship class isitk::MorphologicalContourInterpolator.Path:
Modules/Filtering/MorphologicalContourInterpolation/(alongside the existingModules/Filtering/RLEImage/from the stacked PR #6208).Pipeline metrics
The relatively high commit count comes from MCI's long history (327 upstream commits since 2016) — reflects the maturity of this module.
Dependencies
DEPENDS(library):ITKBinaryMathematicalMorphology,ITKDistanceMap— both ITK core (always available)TEST_DEPENDS:ITKTestKernel(core),RLEImage(provided by stacked PR ENH: Ingest ITKRLEImage into Modules/Filtering #6208)EXCLUDE_FROM_DEFAULTis set on the module so it does not auto-build unlessModule_MorphologicalContourInterpolation:BOOL=ONis passed.Stack relationship to PR #6208
This PR stacks on PR #6208 (RLEImage ingest) for two reasons:
TEST_DEPENDS RLEImage— MCI'sitkMorphologicalContourInterpolationTestWithRLEImage.cxxinstantiates the morphological filter againstRLEImagetypes. Without RLEImage as an in-tree module, the test directory is not configured.CTAD deduction guides — when MCI's test code includes
itkImageFileWriter.h(which transitively pulls initkImageAlgorithm.hxx) and instantiates the writer's templates against anRLEImage, ITK core's CTAD-using calls (e.g.ImageRegionConstIterator it(inImage, inRegion);) need explicit deduction guides on theImageRegionConstIterator<RLEImage<...>>partial specialization. Those guides were added in8dcb1e8fe3on PR ENH: Ingest ITKRLEImage into Modules/Filtering #6208. Without them, MCI's RLEImage-flavored test fails to compile.If reviewers prefer to land MCI without the RLEImage dependency in this cycle, the alternative is to disable the
itkMorphologicalContourInterpolationTestWithRLEImage.cxxsource fromtest/CMakeLists.txtuntil RLEImage lands. The plain (non-RLE) MCI test suite does not need PR #6208.Follow-up commits in this PR
After the merge commit (
ENH: Ingest ITKMorphologicalContourInterpolation into Modules/Filtering):DOC:AddModules/Filtering/MorphologicalContourInterpolation/README.mdpointing at the archived upstream.COMP:RemoveModules/Remote/MorphologicalContourInterpolation.remote.cmake(now in-tree).ENH:EnableModule_MorphologicalContourInterpolation:BOOL=ONinpyproject.tomlconfigure-ci.BUG:Replacethread_localSmartPointers with local variables (fixes 26 Windows CI SEGFAULTs).Phase B (upstream archival) — deferred
Per the v4 design (PR #6204), the upstream archival step is intentionally separated. After this PR merges into ITK
main, run:Note the upstream is
KitwareMedical/ITKMorphologicalContourInterpolation(not the InsightSoftwareConsortium org); confirm push permission before flippingarchived=true.AI assistance
thread_localfixthread_localITK SmartPointers in template functions crash on MSVC at thread-pool shutdown by inspecting CI logs, tracing thethread_localintroduction through git history to commit017a693c5d(ITKv5 threading model switch), and confirming the fix compiles and all 368 MCI tests pass locally