Skip to content

ENH: Ingest ITKRANSAC into Modules/Registration/RANSAC#6275

Open
hjmjohnson wants to merge 92 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:ingest-RANSAC
Open

ENH: Ingest ITKRANSAC into Modules/Registration/RANSAC#6275
hjmjohnson wants to merge 92 commits into
InsightSoftwareConsortium:mainfrom
hjmjohnson:ingest-RANSAC

Conversation

@hjmjohnson
Copy link
Copy Markdown
Member

Ingest the ITKRANSAC remote module into Modules/Registration/RANSAC (group: Registration). Source upstream: InsightSoftwareConsortium/ITKRANSAC. Tracking issue: #6160.

Ingest stats
  • Commits: 79 (including 12 merge commits -- Mode A topology preserved per Utilities/Maintenance/RemoteModuleIngest/INGESTION_STRATEGY.md)
  • Files installed under Modules/Registration/RANSAC/: 25
  • Approx. content size: 411 KiB
  • Tip SHA: c9759665ac99f8a7b8fb52e787d580f63013155f
External-data fixtures

CID / .sha512 content-links present in this ingest:

(none -- module has no external-data fixtures)

If any fixtures resolve via ITKTestingData, that repo must contain the matching content-link before this PR can merge cleanly.

Follow-on commits (on top of the unrelated-histories merge)
  • c975966 ENH: Drop RANSAC remote and enable Module_RANSAC in CI
  • 900aeaa COMP: Missing semicolon after itkNewMacro
  • 7c72a83 COMP: Windows SetSingleMethod error
  • 59f56e6 ENH: Change delta to Euclidean distance
  • 9e80b0a ENH: Add Set/Get for additional corresspondence checks

Comment thread pyproject.toml Outdated
Comment thread Modules/Registration/RANSAC/include/itkRANSAC.hxx
@hjmjohnson
Copy link
Copy Markdown
Member Author

/azp run

@hjmjohnson
Copy link
Copy Markdown
Member Author

@greptileai review

Comment thread pyproject.toml Outdated
Comment thread Modules/Registration/RANSAC/include/itkRANSAC.h Outdated
@PranjalSahu
Copy link
Copy Markdown
Contributor

It looks good to me. We can add code samples from SlicerMorph project to demonstrate how to use it.
Also they might have to tune the delta etc. if they upgrade the Ransac to this version.

@dzenanz
Copy link
Copy Markdown
Member

dzenanz commented May 17, 2026

Brining this to the attention of @muratmaga.

@muratmaga
Copy link
Copy Markdown

Not sure what this means for alpaca. Does it mean we need to install differently?

hjmjohnson and others added 15 commits May 20, 2026 06:17
Brings RANSAC from a configure-time remote fetch into the ITK
source tree at Modules/Registration/RANSAC/ using the v4 ingestion
pipeline (whitelist filter-repo + per-commit clang-format + black +
commit-prefix sanitization).

Upstream repo:  https://github.com/InsightSoftwareConsortium/ITKRANSAC.git
Upstream tip:   0a5b2273b34ee4e94c8ff6a3bda37c6c9e0bd943
Ingest date:    2026-05-14
Whitelist:      default.list

Per-commit transforms applied across all 77 commits:
  - filter-repo --paths-from-file (whitelist)
  - filter-repo --to-subdirectory-filter Modules/Registration/RANSAC
  - 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: 22 -> 11 merge(s).

Primary author: Pranjal Sahu <pranjalsahu5@gmail.com>

Co-authored-by: Matt McCormick <matt.mccormick@kitware.com>
Co-authored-by: Pranjal Sahu <pranjal.sahu@kitware.com>
Co-authored-by: root <root@insight-journal.org>
Remove the Modules/Remote/RANSAC.remote.cmake stub now that the
upstream history has been ingested into Modules/Registration/RANSAC,
and enable -DModule_RANSAC:BOOL=ON in the pixi configure-ci task.
AgreeMultiple was comparing nanoflann squared distance against linear
delta threshold, yielding sqrt(3)x tighter inlier set than Agree().

mat_adaptor was a raw owning pointer never deleted; convert to
std::unique_ptr so SetAgreeData can be safely re-invoked.
SetGlobalDefaultNumberOfThreads mutated process-wide ITK state; use
threader->SetNumberOfWorkUnits() instead.

rand()/srand() share global C library state and produce data races
when numberOfThreads > 1; replace with per-thread std::mt19937.
The shuffled indexArray was built but the subsequent loop ignored
it and iterated by sequential index; remove the dead code.
The if(NOT ITK_SOURCE_DIR) branch (find_package(ITK) +
include(ITKModuleExternal)) only executes when building the module
standalone outside ITK. In-tree builds always take the
itk_module_impl() else branch. Drop the dead branch following the
cleanup pattern from InsightSoftwareConsortium#6272/InsightSoftwareConsortium#6279.
Replace 4 baselines under test/Baseline and 4 baselines under
wrapping/test/Baseline with ExternalData .sha512 content-links.
The wrapping/ copies are byte-identical to the test/ copies
(same sha512), so only 4 unique blobs need upload to
data.kitware.com.

  Modules/Registration/RANSAC/test/Baseline/fixedFeatureMesh.vtk
    sha512: 4ce07d9364490b6b4b194f8596551f757138b86a209f9f89fb40fe2d6ed3381408c59448aceea3afcf8202c2951de465e51af3ed6e14a7e15299ae5767f570c2
    status: needs_upload
  Modules/Registration/RANSAC/test/Baseline/fixedMesh.vtk
    sha512: e9c26e932c9172c8777816c0be1a56043bd9bd752f30f3641783b98bfb6663bdcf08d1e119973fe2241c6a320dc52b0595b11cdd12b87ebfcc03511b2a77cac7
    status: needs_upload
  Modules/Registration/RANSAC/test/Baseline/movingFeatureMesh.vtk
    sha512: f403cb283bb780d8c527bc630c31fe6cd3db52d2d18211f6ca56a28e005b921263863600fd9b1bd10cbe414c4abe01ec886baf9d1c8d5e1311f64cf6d1ee5da2
    status: needs_upload
  Modules/Registration/RANSAC/test/Baseline/movingMesh.vtk
    sha512: 0ac2e44b04f867111c54dc16c55f1dcf5f350d6cd28f276a80091de49013340a8544ab962339718779e4f623fb60a2c0700916acd75b3f5259231bdd9245e6e1
    status: needs_upload
  Modules/Registration/RANSAC/wrapping/test/Baseline/fixedFeatureMesh.vtk
    sha512: 4ce07d9364490b6b4b194f8596551f757138b86a209f9f89fb40fe2d6ed3381408c59448aceea3afcf8202c2951de465e51af3ed6e14a7e15299ae5767f570c2
    status: needs_upload
  Modules/Registration/RANSAC/wrapping/test/Baseline/fixedMesh.vtk
    sha512: e9c26e932c9172c8777816c0be1a56043bd9bd752f30f3641783b98bfb6663bdcf08d1e119973fe2241c6a320dc52b0595b11cdd12b87ebfcc03511b2a77cac7
    status: needs_upload
  Modules/Registration/RANSAC/wrapping/test/Baseline/movingFeatureMesh.vtk
    sha512: f403cb283bb780d8c527bc630c31fe6cd3db52d2d18211f6ca56a28e005b921263863600fd9b1bd10cbe414c4abe01ec886baf9d1c8d5e1311f64cf6d1ee5da2
    status: needs_upload
  Modules/Registration/RANSAC/wrapping/test/Baseline/movingMesh.vtk
    sha512: 0ac2e44b04f867111c54dc16c55f1dcf5f350d6cd28f276a80091de49013340a8544ab962339718779e4f623fb60a2c0700916acd75b3f5259231bdd9245e6e1
    status: needs_upload
…InsightSoftwareConsortium#56)

Convert 8 .sha512 content-links to .cid form now that the blobs are
staged on the ITKTestingData gh-pages mirror via PR InsightSoftwareConsortium#56. Covers
Modules/Registration/RANSAC/{test,wrapping/test}/Baseline/*.vtk.
The ingested module registered as `Ransac` via itk_module(Ransac ...),
yielding a `Module_Ransac` CMake cache variable. The upstream remote
module and existing downstream build scripts use `RANSAC`/`Module_RANSAC`.
On case-sensitive systems `-DModule_RANSAC:BOOL=ON` then silently had no
effect. Canonicalize the module identifier (itk_module, project,
createtestdriver, itk_wrap_module, Doxygen \ingroup) to RANSAC.
Both members were left uninitialized. When every hypothesis produces
zero inliers, the thread callback reads bestRMSE in
`rmse_value < caller->bestRMSE` and maxIteration in its early-exit
check before either is assigned — undefined behavior. Initialize both
at declaration (max sentinels: any real RMSE replaces it; no iteration
cap by default).
@hjmjohnson
Copy link
Copy Markdown
Member Author

Not sure what this means for alpaca. Does it mean we need to install differently?

If you built against ITK with a remote module, it shouldn't change anything for the alpaca build.

@PranjalSahu
Copy link
Copy Markdown
Contributor

They install directly using released pip packages.
https://pypi.org/project/itk-ransac/

@dzenanz
Copy link
Copy Markdown
Member

dzenanz commented May 20, 2026

Once we finish the ingestion, we will need to decide how to group the new modules into python packages. And it might change from pip install itk-ransac into pip install itk-registration-optional (or something similar).

@blowekamp
Copy link
Copy Markdown
Member

Once we finish the ingestion, we will need to decide how to group the new modules into python packages. And it might change from pip install itk-ransac into pip install itk-registration-optional (or something similar).

We should also look into what it would take to make a directory an independent wrapping and python package. Another factor to consider would be the size of a composite package vs the separate packages. The composite group package may only be marginally bigger than an individual module package.

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

Labels

area:Python wrapping Python bindings for a class area:Registration Issues affecting the Registration module area:Remotes Issues affecting the Remote module type:Enhancement Improvement of existing methods or implementation type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants