Skip to content

feat(volume-rendering): make non-CT volumes visible in 3D by default - #1039

Open
PaulHax wants to merge 4 commits into
mainfrom
volume-fitted-defaults
Open

PaulHax wants to merge 4 commits into
mainfrom
volume-fitted-defaults

Conversation

@PaulHax

@PaulHax PaulHax commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Replaces #1027, #1028, #1029, #1030 and #1031 with a smaller design.

Problem

The default 3D preset assumes CT. Any volume without a DICOM CT, MR or US tag gets CT-AAA, whose color and opacity are pinned to Hounsfield units, and DICOM MR gets CT-Coronary-Arteries-2, also a Hounsfield preset. MR, PET, NIfTI, normalized floats and similar data mostly fall outside those values, so the 3D view often opens empty or unreadable. The presets that do follow the data (Grayscale and the colormaps) stretch over the full min to max, so a few outlier voxels wash the rest out.

Default preset

Image Before After
DICOM CT CT-AAA unchanged
DICOM US US-Fetal unchanged
DICOM MR CT-Coronary-Arteries-2 MR-Default, fitted
Other, minimum at or below -500 (untagged CT) CT-AAA unchanged
Other CT-AAA Grayscale, fitted

Fitted presets

  • Presets without a fixed Hounsfield range (Grayscale, the colormaps, and now the MR presets) map onto the image's 1st to 99th percentile range instead of its min to max. The percentiles come from the image statistics already computed for window/level. Until they exist, as while a series streams, the data range is used, and the preset is refit when they arrive unless the user has edited color or opacity in the meantime.
  • MR presets are rescaled onto that range, since MR intensities have no standard scale. CT presets keep their Hounsfield values.
  • Grayscale gets an opacity ramp, transparent at the bottom of the fitted range and opaque at and above its top, and moves to a new Generic group.
  • Preset thumbnails use the fitted range.

Smaller fixes in the 3D Rendering panel

  • Reset button. Getting a preset back after editing it meant clicking its thumbnail again in the preset list, while Reset Views only restored Shift and Width. A button beside Shift and Width now reapplies the selected preset (opacity curve, Shift and Width) and keeps palette and lighting.
  • Shift and Width steps. Both sliders now take their step from the preset's color range. Width previously had a minimum of 1, so data spanning less than 1 could not be narrowed.
  • Opacity editor. The curve is drawn flat beyond its first and last points, matching what the 3D view renders.

State files

The state file format is unchanged. The fitted range is recomputed from the image when a session loads, not saved. State files saved with an MR preset keep their color range, but their opacity curve now follows the image's fitted range rather than fixed units.

@netlify

netlify Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for volview-dev ready!

Name Link
🔨 Latest commit 99ec7d8
🔍 Latest deploy log https://app.netlify.com/projects/volview-dev/deploys/6b025f0df7dbd16916374d26
😎 Deploy Preview https://deploy-preview-1039--volview-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

… percentiles

Volumes without a fitting declared modality now default to a visible 3D
rendering instead of the CT-AAA Hounsfield preset.

- DICOM MR defaults to MR-Default. Other images default to CT-AAA when their
  minimum is at or below -500 (untagged CT), otherwise to Grayscale.
- Presets without an absolute range map onto the image's 1st to 99th
  percentile range from the image statistics, falling back to the data range
  until those are computed. A preset applied on the fallback is refit once
  they arrive, unless its color or opacity was edited meanwhile.
- MR presets map their effective range onto that fitted range, since MR
  intensities have no standard scale. Hounsfield presets are unchanged.
- Grayscale ramps from transparent at the bottom of the fitted range to
  opaque at and above its top, and is listed in a Generic group.
- The opacity editor keeps the data range as its axis for every preset and
  holds the end values past the end points, matching the 3D rendering.
- Preset thumbnails use the fitted range and rerender once it is known.
@PaulHax
PaulHax force-pushed the volume-fitted-defaults branch from 5589385 to 3a663cf Compare November 21, 2026 22:30
Adds a reset button beside the Shift and Width sliders in the 3D Rendering
panel. It reapplies the selected preset, restoring the opacity curve, Shift,
and Width for the current image while keeping the palette and lighting
settings.
…range

The Shift and Width sliders took their step from the image data range and
Width had a fixed minimum of 1. For data narrower than 1, such as normalized
floats, Width was pinned and could not narrow the range, and Shift showed a
nonzero value when unshifted.

Step and bounds now come from the preset's color range: the step is at most
1/256 of it, Width starts at one step, and Shift bounds are whole steps
either side of zero. Ranges 256 or wider keep a step of 1.
@PaulHax
PaulHax force-pushed the volume-fitted-defaults branch from 3a663cf to ce0be3c Compare November 22, 2026 03:06

This branch has not been deployed

No deployments
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