Conversation
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.
Summary
Adds
impact-reg-konfai, a standalone CLI app bundle (apps/impact_reg/) that orchestrates IMPACT-Reg multimodal registration presets through thekonfai-appsruntime. Each preset is a self-contained KonfAI app (default repoVBoussot/ImpactReg) whose model emits, on the fixed grid, the resampled moving image and a displacement field. This wrapper adds the registration-specific glue that does not fit the generickonfai-appspipeline — multi-preset DVF ensembling, modality-aware evaluation, and ensemble-spread uncertainty — as three composable sub-commands so a UI or CLI can drive each step independently. It mirrors theimpact-seg-konfaibundle from the base PR, giving registration the same thin-wrapper packaging.What changed
New app package (
apps/impact_reg/impact_reg_konfai/)impact_reg.py—ImpactRegKonfAIAppwith three operations mirroringkonfai-appsinfer/eval/uncertainty:register()runs each selected preset via a separatekonfai-apps infersubprocess (isolating konfai's process-globalConfigsingleton andKONFAI_*env), averages the per-preset DVFs through_ensemble(), and writesMoved.mha,DVF.mha, andTransform.h5per case (P%03d). Masks are optional and restrict the metric region; a whole-image mask is auto-filled via_full_mask()so every preset receives its four declared inputs.keep_dvfpersists per-preset fields underEnsemble/for later uncertainty.evaluate()scores any subset of modalities — image MAE (Evaluation_with_images.yml), segmentation Dice with nearest-neighbor resampling (Evaluation_with_seg.yml), and landmark TRE (Evaluation_with_fid.yml) — delegating toKonfAIApp.evaluate. Landmarks warp the fixed fiducials forward through the fixed→moving transform and compare against the moving fiducials (no field inversion).uncertainty()stacks ≥2 ensemble DVFs into one multi-component volume (samples as vector components, real fixed-grid geometry preserved on the trailing axes) and runs the preset's genericUncertainty.yml(NormthenStandardDeviation) viakonfai-apps uncertainty.get_available_presets()/_app_id()resolve presets from a local directory (folders whoseapp.jsondeclarestask == "registration") or the HF repo, overridable viaKONFAI_IMPACTREG_REPO(defaultVBoussot/ImpactReg).cli.py—impact-reg-konfaiargparse front end withregister/eval/uncertaintysub-commands: a shared_add_device()(mutually exclusive--gpu/--cpu,-q/--quiet,--download,--force_update), a_default_preset()fallback with an actionable error when none resolve (used byeval/uncertainty),registertaking positionalpresetsto ensemble plus--fixed-mask/--moving-mask,--tta, and--uncertainty(keep per-preset DVFs), and anevalguard requiring at least one complete modality (image/seg/fid).read_landmarks,write_landmarks,apply_to_data_transform(konfai),KonfAIApp,get_available_apps_on_hf_repo(konfai_apps).Packaging & docs
pyproject.tomldeclaresimpact-reg-konfaiwith a dynamic setuptools-scm version and theimpact-reg-konfai = impact_reg_konfai.cli:mainentry point;setup.pypinskonfai==<version>andkonfai-apps==<version>to the same release.LICENSE(Apache-2.0),README.md,Logo.png, and.gitignore; the orchestrator, CLI, and test modules carry the Apache-2.0 SPDX header.Testing
tests/test_evaluate_landmark_direction.py, a regression test locking the landmark transform direction inImpactRegKonfAIApp.evaluate. With a known translationT: fixed → movingandm_i = T(f_i), it monkeypatchesKonfAIApp.__init__/evaluateand asserts the metric's reference is the moving fiducial set while the scored points are the fixed fiducials warped byT, so a perfect transform yields TRE ≈ 0 (not doubled). It uses synthetic data and does not exercise real inference.konfaipackage orkonfai-apps; the PR only adds files underapps/impact_reg/.Review notes
pr/seg. The diff is fully additive — 10 new files, no existing file modified — so there is no core orkonfai-appsbehavior change and no backward-compatibility risk. Review after the base merges.VBoussot/ImpactReg(or a local dir viaKONFAI_IMPACTREG_REPO) and shells out to thekonfai-appsCLI (subprocess.run(..., check=True), annotated# nosec B603). Per the app trust model, resolving a preset copies/imports its.pyand installs itsrequirements.txt.setup.pyassumekonfai,konfai-apps, and this package are released in lockstep.