Skip to content

MRI viewer: PACS-style window presets and an Invert toggle - #358

Merged
aperson30 merged 1 commit into
mainfrom
feat/mri-pacs-window-presets
Nov 13, 2026
Merged

aperson30 merged 1 commit into
mainfrom
feat/mri-pacs-window-presets

Conversation

@aperson30

Copy link
Copy Markdown
Collaborator

What

MRI window presets. MRI has no fixed units, so its windows come from the scan's own intensity distribution. The list is now Auto, Low contrast, Medium contrast, High contrast and Full range. Low, Medium and High follow the usual PACS automatic presets: they drop 1%, 5% and 10% of the foreground voxels from each end of the range, so a larger trim gives a narrower window and more contrast. This replaces the old "High contrast" window, which only raised the lower bound. ScanAnalysis gains the extra foreground percentiles these need. CT presets are unchanged.

Invert. The View menu gets an Invert toggle (state shown in place like Hover identify and Reference lines; no controls moved). It flips the grayscale of every pane through Cornerstone's invert property and is re-applied when the viewports are rebuilt. It is not saved between visits and applies to CT as well as MRI.

Tests

  • scanModality.test.ts: preset names, trim edges and ordering.
  • viewer.smoke.test.tsx: the Invert menu item toggles and shows its state.
  • Ablations: changing the High contrast trim fails the preset tests; making the Invert click a no-op fails the smoke test.
  • Checked in a real browser (Edge, local dev server) with a synthetic MRI NIfTI: detected as MRI, the five presets are listed, and Invert flips all three panes.
  • Locally: typecheck, ESLint (0 errors) and the affected vitest files pass. Full CI not run locally.

Not verified / not changed

  • Not checked on a real clinical MRI or a DICOM MRI series, only the synthetic scan.
  • The compare viewer does not get Invert in this PR.
  • No "use the window stored in the file" preset and no user-saved presets yet.
  • No access-policy or backend change.

MRI scans get windows from the scan's own intensity distribution, since
MRI has no fixed units. The preset list is now Auto, Low contrast,
Medium contrast, High contrast and Full range. Low, Medium and High
follow the usual PACS automatic presets and drop 1%, 5% and 10% of the
foreground voxels from each end of the range (narrower window, more
contrast). The old "High contrast" window, which only raised the lower
bound, is replaced. ScanAnalysis gains the extra foreground percentiles
these need.

The View menu gets an Invert toggle (state shown in place, like Hover
identify and Reference lines). It flips the grayscale of every pane
through Cornerstone's invert property and is re-applied when the
viewports are rebuilt. It is not saved between visits.

Tests: preset names, trim edges and ordering in scanModality.test.ts;
a viewer smoke test for the Invert menu item. Ablations: changing the
High contrast trim fails the preset tests; making the Invert click a
no-op fails the smoke test. Checked in a real browser with a synthetic
MRI NIfTI: the scan is detected as MRI, the five presets are listed, and
Invert flips all three panes.
@aperson30
aperson30 merged commit 3d9f84b into main Nov 13, 2026
8 checks passed
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