vol_stretch — 3D gray op

Data kinds: voxelvoxel

Call: import fullseye as fs; fs.ledger.vol_stretch(vol, p_low=1.0, p_high=99.0) (to call the implementation directly, import volgray; volgray.vol_stretch(vol, p_low=1.0, p_high=99.0); from the registry, ops3d.get("vol_stretch"))

Usage

Percentile contrast stretch to `[0, 1] (robust scale_image_max`).

Computes the *p_low*-th and *p_high*-th intensity percentiles and maps

`[P(p_low), P(p_high)] linearly onto [0, 1]`, clipping outside — so a

handful of hot/cold outlier voxels (a metal artefact, a dead detector

element) no longer dictates the display range, unlike a plain min/max

normalisation. The defaults (1 % / 99 %) are the usual display-stretch

choice.

If the two percentile values coincide (a constant — or near-constant —

volume), the input is returned unchanged rather than divided by zero

(see the module docstring's flat-volume note).

Parameters

----------

vol : array_like, shape (D, H, W)

Input volume (coerced to float64; NaN/Inf rejected).

p_low, p_high : float

Percentiles in `[0, 100] with p_low < p_high` (fail-closed).

Returns

-------

ndarray, shape (D, H, W), float64

The stretched volume in `[0, 1]` (degenerate percentiles: the input

itself).

Raises

------

ValueError

Non-3-D / non-finite input, percentiles out of `[0, 100]`, or

`p_low >= p_high`.

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

Runnable examples (verified samples that actually call this op)

gray_window_levelpy -3.11 examples_3d/gray_window_level.py

Ops the type connects to (they accept voxel as input)

voxel_to_mips · voxel_to_mesh · signed_distance_field · to_points · sobel3d · hessian3d · curvature_maps · edt_jfa

Same category (gray)

vol_window_level · vol_equalize · vol_gamma


*Provenance: volgray.py — 3D operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.