Skip to content

Bugfixes - #1

Merged
marcoduering merged 6 commits into
mainfrom
port-miq-1.5.1
Sep 24, 2026
Merged

marcoduering merged 6 commits into
mainfrom
port-miq-1.5.1

Conversation

@marcoduering

Copy link
Copy Markdown
Owner

No description provided.

marcoduering and others added 6 commits September 24, 2026 13:56
Port of MIQ@d6dabd5. The split searched the whole file for \r\n\r\n
before \n\n, so in an LF header (Slicer/ITK) any payload bytes 0D 0A 0D 0A
won - two adjacent int16 LE voxels of 2573 are enough - and the whole
payload was scanned. Walk newline to newline and stop at the first
\n\n or \n\r\n instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port of MIQ@d6dabd5. Sub-1e-6 float windows (SI-unit ADC maps, ~1e-9)
were squashed into one or two grey levels. A degenerate window still
renders black; output is unchanged for every window >= 1e-6.

The interactive W/L drag had the same floor on its reference span, which
would have made one drag widen such a window ~1000x. The span is now
the actual window width, and the drag is inert when it is zero.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port of MIQ@d6dabd5's sanitizedSpacing: a zero spacing renders as 1
(the 1e-6 floor squashed that axis to one pixel) and a NaN/Inf spacing
no longer yields a 1x1 slice. Metadata keeps the raw header values.

Beyond the Swift fix: with spacings below 1e-6 no longer raised to 1e-6,
ResampleTargetSize's own 1e-6 floor on the reference extent started to
shrink slices of volumes whose largest extent is under 1e-6 (256 voxels
at 1e-9 rendered at ~66 px). The floor is gone; non-finite or
non-positive extents fall back to the unscaled size, which also covers
a finite spacing whose extent overflows. The two identical
ResampleTargetSize copies (grey, RGB) are merged into ResampleTarget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port of MIQ@d6dabd5. NIfTI-2 shares its file kinds with NIfTI-1, whose
display name says "NIfTI-1". NiftiParser now takes a `compressed` flag
instead of a label string and names the format once it knows the
header version.

Unlike macOS, the vol-0-first partial loads keep their probe header as
the image's header, so all three call sites pass the flag - otherwise
large 4-D NIfTI-2 files, the ones that take the partial paths, would
still show "NIfTI-1".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ac45bd4's comment blamed only the 1e-6 reference-extent floor, with a
wrong number. The actual invariant is that the slice extent
(ResampleTarget) and maxPhysicalExtent (PrepareSlice) treat spacing
identically. Measured for 256x4x4 at 1e-9, maxDimension 512 (expected
512x8 / 8x8 / 512x8):
- reference term alone:     131x2 / 2x2 / 131x2 (shrunk)
- per-axis floors (w/ or w/o reference term): sagittal 512x512 (blown up)
The code was already floor-free on both sides; comment only. The test
now compares all three plane sizes at once so a failure reports them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@marcoduering
marcoduering merged commit e75da5f into main Sep 24, 2026
1 check passed
@marcoduering
marcoduering deleted the port-miq-1.5.1 branch September 24, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant