Skip to content

feat(image-info): add an Info dialog for loaded images - #1052

Open
PaulHax wants to merge 34 commits into
dicom-loadingfrom
volume-info-dialog
Open

PaulHax wants to merge 34 commits into
dicom-loadingfrom
volume-info-dialog

Conversation

@PaulHax

@PaulHax PaulHax commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Adds an Info dialog for any loaded image. It opens from a data card menu or from the info icon in a view, and shows:

  • Patient, study and series details for DICOM volumes
  • Geometry: dimensions, origin and direction vectors
  • Spacing steps per axis, marking single-sample axes
  • The first DICOM instance's tags in a filterable table with labeled columns

It replaces the earlier DICOM quick info button. The view button is renamed to VolumeInfoButton, and every ProgressiveImage now exposes getInstances() so the dialog can read tags without checking the image type. Non-DICOM images show geometry and spacing only.

Spacing shows the plain step per axis, since this branch's loader keeps only the displayed spacing triple (0851a51).

Stacked on #1046.

DICOM files and URLs share one metadata-first pipeline that loads
volumes frame by frame. Collections are planned the same way for batch
and incremental imports, splitting incompatible acquisitions and pixel
geometries while keeping stable identities, reconstruction details and
session provenance.

The loader lives in packages/dicom. Core reads instances from byte
sources with an AbortSignal, plans collections with a pure registry
reducer, and fills a Volume buffer it owns. The vtk entry point wraps
that buffer in vtkImageData and widens its scalar range as slices
arrive. VolView keeps its stores and UI; each series commits in one
synchronous step, so a failed series changes nothing.

The viewed slice loads first, then the rest coarse to fine, on a pool
of GDCM decode workers. Uncompressed pixel data is decoded per frame
without GDCM. Volumes use Float32 buffers where integer or fractional
rescale allows, which vtk.js renders without conversion.
Remove the standalone package build. packages/dicom is a plain directory,
callers import each name from the file that defines it, and the browser
test pages build straight from source.

Load every unit of pixels one way. Native frames and GDCM are both pixel
decoders that plan units from a header, the decoder table lists candidates
per transfer syntax in preference order, and loadVolume has one read,
decode and write path. A decoder's units must cover every frame exactly
once. Pixels are written when a decode completes and a slice is marked
loaded when its update is yielded.

Let the plan say what a collection is. Registry updates carry whether a
collection is an image or a segmentation and whether it is new, unchanged
or changed, so allocateVolume returns a Volume and importInstances plans
and commits synchronously.

Decide cine from the header. A clip is built from its instance, reads its
pixel bytes when loading starts, and cuts encapsulated frames with
splitEncapsulatedFrames, so dicom-parser is no longer a dependency. A clip
whose pixel data cannot be read now fails as a clip at load instead of
falling back to a volume import, and malformed encapsulated streams throw.

Keep only DICOM in the module. The URI fetcher returns to
src/core/streaming, itk-wasm loads when GDCM first decodes so core
imports in Node, and core may import only relative paths, comlink, dcmjs
and itk-wasm.
A SEG whose bytes could not be read or parsed left its thumbnail pending,
so the patient browser showed a spinner indefinitely. The thumbnail now
resolves to none once the load fails, and a retry clears the failure.
One unreadable file in a downloaded series marked the whole download as
failed, even though the rest of the series loaded as a volume. The loaded
volume is now shown and each failed file is reported, warning that the
volume may be incomplete. A download that loads no volume still fails.
Report failures where they happen. A read or decode failure names the
file, and the frame when it lost one, and keeps the thrown value as its
cause. A failed load raises one notification per attempt, titled with
the series name. An uncompressed file cut short loads the frames it still
holds and fails the rest instead of showing zeros. GDCM declines an
instance whose frames differ in modality rescale from its header, before
any pixel bytes are read. An HTTP failure reports its status.

Fix what the registry tells the store. A collection's change is decided
from its members, orientation and reconstruction, so a relabel no longer
reallocates its volume, and an update is emitted when a sibling changes
its label or warnings. A positionless image is named and warned about
only beside a positioned volume of its series. Patient, study and series
text is trimmed, a series with no identifying tags is named "Unnamed
series", a thumbnail settles again after a retry, and an import no
longer reports a volume it brought no file for.

Load faster and release what is done. A Blob range is one slice, so a
local frame is one read. Decodes that return at once run for a few
milliseconds and then hand the thread back. A pooled request is released
once its body is read. The header scan steps over defined-length
sequences, and private elements are dropped in the metadata worker.

Remove what nothing needs: the resume path of CachedStreamFetcher, the
GDCM-shaped tag projection in readDicomTags, the archive target handler,
the DICOM series worker pool, the partial import error classes, the
planner's dedupe and self-check, Reconstruction.slots, the irregular
geometry option, and test cases that restated others or pinned internal
structure. The corpus manifests print number arrays on one line, and a
pydicom script checks the volume corpus.
The module carries no complexity debt, so lint now fails on any function
in packages/dicom that exceeds the complexity, depth, parameter or line
limits, where src only warns and relies on the per-commit ratchet. Both
read the limits from scripts/checks/config.mjs.

The duplication ratchet covers the module's source as well as tests, so
a new 60-token clone there fails the commit.
Shorten code that said in many lines what a few say clearly, drop
exports, parameters, casts and annotations nothing needs, and give the
repeated shapes in pixel formats and validation one name each. The HTTP
status constants live where they are used, and the Content-Range parser
no longer models a range the only caller rejects.

The test DICOM writers share one element encoder, one Part 10 assembler
and the sequence, decimal and long helpers; every generated byte is
unchanged. Specs share their repeated setup through helpers, and cases
that restated another case are gone.

restoreState takes the reports it shows the user as one object, which
brings it within the parameter limit.
Read the modality rescale from the Pixel Value Transformation functional
group only for the IODs that define it there, as GDCM does. Other SOP
classes, such as multi-frame secondary capture and ophthalmic tomography,
use the top-level Rescale, so a native and a compressed copy of the same
file now load with the same values and buffer type.

Reject what a header gets wrong before it costs time or memory. A lone
native instance that declares more frames than its Pixel Data holds fails
at allocation, per-frame reads stop at the functional groups present, a
Number of Frames that is not a positive integer counts as one, an element
value cut short ends the header read with an error instead of a clipped
value, and a Transfer Syntax UID padded with a space is still recognised.
Frames split by a Basic Offset Table no longer take quadratic time.

Release a pooled request when its URL read fails, not only when it ends.

Restore no saved state onto a volume that two saved images now share, and
name those images in the restore notice instead of placing their masks on
the merged grid. Plan a series within its study, so a Series Instance UID
reused in another study no longer joins its images.

Export the types the public signatures name, correct two README claims,
and add tests for behaviour no test protected: writes after abort,
values the buffer cannot hold, retrying only failed frames, duplicate
decoder units, disposal of running and idle GDCM workers, and the copy
made before handing bytes to the metadata worker.
Showing image information is a separate feature from the loader.
The loader still reports how each axis spacing was established.
A later import can regroup a series and remove a volume after an
earlier import commits it but before that import picks what to show.
The primary selection now comes only from volumes that still exist.
The processing and reference lines index modules, the io index, the
index-based feature boundary and the strict e2e timeout rule are not part
of DICOM loading, so they return to their main form. The dimension
mismatch spec goes back on the timeout debt list it was on, and the
segmentation helper waits with the default limit as on main.
Decode runs no longer yield the thread on a timer. The unit coverage
check, readAhead, requestConcurrency, metadataWorkerFactory, the fromUrl
init, ByteSource.size and the complete-header import policy go, since
nothing outside tests used them.
Express the core and vtk import boundaries as eslint denylists, including
relative paths that leave the module, and drop the boundaries spec.
Module source follows the src policy: warn-level limits in eslint, the
complexity ratchet per commit, and duplication checks for tests only.
Drop the vtk page, the core metadata case and the build guard that kept
app code and UI frameworks out of page bundles. ESLint enforces the
module boundaries, and the corpus pages cover reads and geometry.
The DICOM core cannot import application code, so the app imports these
helpers from the core and its own copies go.
The store reads a SEG collection from its first member's Modality, as it
does for cine, and a collection update says only whether its volume stands.
Instance no longer carries a derived ultrasoundRegions field; spacing and
occupied depth read the regions from the header when the modality is US.
Tags hold GGGGEEEE keys, so dataset lookups compare them directly and the
gggg|eeee spelling no longer needs translating.
Volumes and cine images carry only the spacing triple they display; the
per-axis provenance record, notes and calibration fields had no reader.
The module is VolView source with no build of its own, so it lives under
src and drops the path entries that existed only for its separate
directory.
Enhanced OCT exports often declare only PixelSpacing and SliceThickness in
the shared Pixel Measures, with no frame positions or SpacingBetweenSlices.
Their frames were spaced 1 mm apart, stretching the en face and 3D views.
SpacingBetweenSlices still wins when present, and the unsound-volume
warning still reports that frame geometry could not be established.
Corpus entries now record facts about each file, derived by a highdicom
based reference tool, apart from what the loading module is expected to
produce. Files highdicom cannot read cite the tags their geometry comes
from, and the tool checks those values.

An extended manifest covers RT, ultrasound, palette and YBR colour, SEG,
non-image objects, large radiographs and files without a preamble. It
runs with DICOM_CORPUS=extended or the manual workflow, skips sources it
cannot reach and fails on changed files. Generated files cover OCT
geometry patterns and an encapsulated PDF.
Each data card menu and the view info icon open a dialog with the
image's patient and study details, geometry, spacing steps and the
first DICOM instance's tags in a filterable table. It replaces the
DICOM quick info button; every ProgressiveImage exposes getInstances()
so the dialog reads tags without checking the image type.
@PaulHax PaulHax changed the title feat(data): add a volume Info dialog feat(image-info): add an Info dialog for loaded images Nov 25, 2026
@PaulHax
PaulHax force-pushed the dicom-loading branch 3 times, most recently from 365d69f to dabac4f Compare November 29, 2026 03:14

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