Align container algorithm output grid to input (header-only fix, configurable)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start with the output paths in infer_single and infer_batch, then read the algorithm constructor and scripts/_shared.py::validate_output to understand how outputs and affine mismatches are handled. Add unit tests for orientation-only mismatches, already matching affines, other grid mismatches, and disabled alignment; done means the output data stays unchanged and only qualifying headers are aligned by default, with a per-call and constructor opt-out.
Written by the indexing model from the issue text.
Description
Problem
Some containerized algorithms write an output whose header affine does not match the input even though the output volume is on the input voxel grid. Observed with metastases.BraTS23_2 (Siwei Yang) via the verification suite:
- input
t1caffine is LPS, output mask affine is RAS abs(output.affine)equalsabs(input.affine)and shapes match- mask data is index-aligned with the input (98.6% of mask voxels fall inside the input brain at identical indices)
Because the header is wrong, any consumer that honors the affine (nibabel, resampling, overlays) will place the mask at the wrong world position.
Decision
Add an opt-out output-grid alignment to the package that only triggers on a detected mismatch:
- Trigger: only when
abs(output.affine) == abs(reference.affine)(within tolerance) and shapes match. - Action: copy the reference/input affine onto the output (
header-only fix), leaving the data array unchanged. - Do NOT reorient/flip the data:
as_reorientedchanges the array and, for the observed case, the index-overlap drops from 0.986 to 0.880, i.e. it would physically rotate the mask (producing a wrong output). - Any other mismatch (scale/shear/translation) is left untouched.
Behavior & configuration
- Default ON (align only on mismatch), opt-out.
- Configurable per call (
infer_single/infer_batch) and on the algorithm constructor. - When disabled, output is written exactly as produced by the algorithm.
Risks
- Critical change: it touches every algorithm's output path. Must be covered by unit tests (mismatch aligned, matching output unchanged, non-header mismatch untouched, flag disables) and called out in the release notes.
- The assumption "mismatch implies index alignment" holds for the observed case; for a genuinely world-correct output with a different grid this must not auto-fix (guarded by the abs-affine + shape condition).
Detection
The verification suite's -m integration run flags this class of mismatch today (orientation-only warning); see scripts/verify/validation.py and scripts/_shared.py::validate_output.
- Dominant language
- Python
- Stars
- 89
- Forks
- 19
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 4
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from BrainLesion/BraTS
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 74/100
BrainLesion/BraTS#200 ·
-
[FEATURE] 2024 challenge proceedings are released and need to be referenced correctlyPossibly taken @MarcelRosier claimed this 10 days ago. Openenhancement
Difficulty 1/5 Under an hour Newbie friendliness 55/100
BrainLesion/BraTS#198 ·
-
BraTS-GoAT 2025 container images (BraTS25_1A-1D) are not published on Docker HubPossibly taken @PaulaTBz claimed this 24 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 38/100
BrainLesion/BraTS#189 · 4 comments · 1 assignee ·
-
[FEATURE] Integration smoke-test suite for containerized algorithmsPossibly taken @MarcelRosier claimed this 39 days ago. Openenhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
BrainLesion/BraTS#185 ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 55/100
BrainLesion/BraTS#162 ·
All issues in BrainLesion/BraTS
Similar issues
-
[Bug]: reme CLI crashes when the running server used a relative config pathPossibly taken @nurlanmnn claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
agentscope-ai/ReMe#770 ·
Maintainers usually reply within 1 day
-
Pi: paused model calls are reported as "not signed in" when the model's provider comes from an extensionPossibly taken @balcsida claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
microsoft/TokenEconomizer#288 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 67/100
sickn33/agentic-awesome-skills#2437 ·
Maintainers usually reply within 1 day
-
site-bug triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ethereum/consensus-specs#5846 ·
Maintainers usually reply within 1 day