Measure the slice extent along the slice axis, not along patient z - #209
Merged
Conversation
`ruff format --check` reported twelve files as unformatted, so any change touching one of them dragged unrelated reflow into its diff. Run the formatter once, on its own, so subsequent changes show only what they actually change. Formatting only: no behaviour changes, and `ruff check` is clean before and after. The suite is unchanged at 2140 passed, 12 skipped. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017SNrm3jFhpTPShP8xGkePC
The extent recipe built its third component from abs(VisuCorePosition[1,2] - VisuCorePosition[0,2]) -- the patient-z component of the step between two slice centres -- and multiplied it by the number of positions plus one. Spec 7.2 makes VisuCorePosition a 3-vector in patient coordinates, and spec 5.4/12 let the slice normal point anywhere: ACQ_slice_orient ranges over sagittal, coronal and Arbitrary_Oblique, and the normal is the third row of VisuCoreOrientation. Projecting onto z alone therefore reports exactly zero for every coronal, sagittal or oblique stack, and the +1 overstates the axial ones by one slice. Across the pv5, pv6, pv7 and new-orientation corpora all 77 multi-slice 2-D reconstructions were wrong: 14 reported 0.0, the other 63 were long by one slice thickness. Both now report n * step, the length of the whole difference -- which is what the sibling resolution recipe and Dataset.slice_distance already use, and which keeps extent = size * resolution as it is in plane. The corpus property references move with it, 54 extent values in four files. Closes isi-nmr#194 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017SNrm3jFhpTPShP8xGkePC
gdevenyi
force-pushed
the
fix/extent-slice-axis
branch
from
August 8, 2026 20:51
6da2e4c to
dbec286
Compare
Contributor
Author
|
Rebased onto #213 ( Integration check across all eleven conformance PRs merged together: 2164 passed, 12 skipped; corpus load test 3202 → 3207 of 3478 with zero newly broken datasets. |
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.
Fixes #194.
Two errors in one expression: only the z component of the slice step is used, and the step is counted
N + 1times.Spec 7.2 makes
VisuCorePositiona 3-vector in patient coordinates; spec 5.4/12 let the slice normal point anywhere (ACQ_slice_orientranges over sagittal, coronal andArbitrary_Oblique, and the normal is the third row ofVisuCoreOrientation). Projecting onto z alone is zero whenever the stack is not axial.Before / after
Corpus sweep over
pv5,pv6,pv7,new-orientation:Change
np.shape(#VisuCorePosition)[0] * np.linalg.norm(#VisuCorePosition[1,:] - #VisuCorePosition[0,:])— the length of the whole difference, which is what the siblingresolutionrecipe andDataset.slice_distancealready use, times the number of slices, which keepsextent = size × resolutionas it is in plane.The corpus property references move with it: 54
extentvalues across the fourtest/config/properties_*.json, regenerated in place so key order and layout are unchanged.Test
test_extent_spans_the_slice_axis_whatever_direction_it_pointsbuilds a synthetic 5-slice stack for an axial, coronal, sagittal and oblique normal and assertsextent[2] == n × step, agreeing withresolution[2]andslice_distance. Three of the four parameters fail on master.Suite: 2140 passed, 12 skipped.