dicom_viewer 0.6.0
dicom_viewer: ^0.6.0 copied to clipboard
A pure-Dart DICOM viewer for Flutter. Parses uncompressed, RLE, and JPEG DICOM files, applies VOI windowing and PALETTE LUTs, and renders images across Web, Desktop, and Mobile.
Changelog #
0.6.0 (Unreleased) #
- Real Uncompressed Multi-Frame Validation:
- Added and permanently validated real 10-frame uncompressed Explicit VR Little Endian MR clinical fixture (
emri_small.dcm). - Validated native frame slice extraction, deterministic extraction, pairwise adjacent frame differences, 10-frame RGBA and Flutter
ui.Imagerendering, quantitative ROI statistics, and Pixel Probe across multiple frames. - Established cross-Transfer-Syntax pixel and rendered RGBA bit-for-bit equivalence against RLE Lossless fixture (
emri_small_RLE.dcm).
- Added and permanently validated real 10-frame uncompressed Explicit VR Little Endian MR clinical fixture (
- Real RLE Multi-Frame Validation:
- Validated all 10 frames of real RLE Lossless MR fixture (
emri_small_RLE.dcm) and 2 frames of real Ultrasound fixture (OBXXXX1A_rle_2frame.dcm). - Verified frame-aware payload extraction, deterministic segment decompression, and multi-frame tool isolation.
- Validated all 10 frames of real RLE Lossless MR fixture (
- Real PlanarConfiguration=1 (Color By Plane) Validation:
- Added and permanently validated real uncompressed Ultrasound fixture (
color-pl.dcm). - Validated raw planar sample extraction, 3-plane sample contiguous separation (Red, Green, Blue), RGBA color conversion,
ui.Imagerasterization, andDicomImageWidgettree integration. - Scope boundary: PlanarConfiguration=1 rendering is validated for single-frame 8-bit uncompressed RGB Ultrasound; ROI and Pixel Probe remain unvalidated for planar-separated RGB data.
- Added and permanently validated real uncompressed Ultrasound fixture (
- Real MONOCHROME1 Polarity Inversion Validation:
- Added and permanently validated real Computed Radiography fixture (
CR1_6154.dcm). - Validated 16-bit allocated / 12-bit stored unsigned pixel extraction, polarity inversion (
255 - intensity), linear windowing, full RGBA rendering, quantitative ROI statistics, and Pixel Probe. - Scope boundary: Validated for single-frame CR uncompressed; compressed MONOCHROME1 and other modalities/bit depths remain unverified.
- Added and permanently validated real Computed Radiography fixture (
- P0 DICOM Compatibility Hardening & Error Handling:
- Added explicit rejection guard for Deflated Explicit VR Little Endian (
1.2.840.10008.1.2.1.99) throwing descriptiveUnsupportedError. - Hardened encapsulated pixel data extraction against empty fragment sequences.
- Added explicit rejection guard for Deflated Explicit VR Little Endian (
- Authoritative Compatibility Matrix & Documentation Consolidation:
- Reconciled Transfer Syntax Support Matrix: qualified Explicit VR Big Endian (
1.2.840.10008.1.2.2) as retired and unverified against clinical fixtures (synthetic stream test only); qualified JPEG Lossless SV1 (1.2.840.10008.1.2.4.70) as real-fixture validated for single-frame only (no suitable multi-frame fixture identified in investigated sources). - Documented
YBR_PARTIAL_422as synthetic-only (no suitable fixture with sufficiently clear redistribution rights was identified in the investigated sources).
- Reconciled Transfer Syntax Support Matrix: qualified Explicit VR Big Endian (
0.5.0 #
- Pure-Dart JPEG Baseline Decompressor (
1.2.840.10008.1.2.4.50):- Pure-Dart ISO/IEC 10918-1 / ITU-T T.81 8-bit baseline sequential DCT decompressor without FFI or external libraries.
- Decodes grayscale (
MONOCHROME1,MONOCHROME2),RGB, and subsampledYBR_FULL_422clinical color images. - Baseline Huffman table decoding (
DHT), quantization table processing (DQT), fast integer IDCT, and restart marker tracking (RST0–RST7andDRI). - Bit-exact and reference oracle validation against DCMTK and pydicom/Pillow reference decoders.
- Pure-Dart JPEG Lossless SV1 Decompressor (
1.2.840.10008.1.2.4.70):- Pure-Dart ISO/IEC 10918-1 / ITU-T T.81 first-order prediction (Process 14, Selection Value 1) lossless decompressor.
- Native support for 8-bit, 12-bit, and 16-bit sample precision.
- Validated on official clinical CT/MR datasets (
JPEG-LL.dcm,JPGLosslessP14SV1_1s_1f_8b.dcm) with bit-exact parity against reference decoders.
- Internal Modular Codec Registry & Framing Architecture:
- Introduced
CodecRegistryandDicomFrameCodecarchitecture decoupling pixel data decompression from the UI and rendering pipelines. - Pluggable framing strategies (
JpegFramingStrategy,RleFramingStrategy) for encapsulated fragment parsing. - Unified
extractEffectivePixelBytesauthoritative pathway supporting both uncompressed native frame slices and compressed payloads.
- Introduced
- Color Pipeline Support & ITU-R BT.601 Conversion:
- Full support for
YBR_FULL_422subsampled JPEG Baseline frames. - Authoritative ITU-R BT.601 color space transformation (
Y,Cb,CrtoR,G,B). - Validated against multi-frame clinical ultrasound color fixtures (
examples_ybr_color.dcm).
- Full support for
- Multi-Frame JPEG Navigation & Frame Isolation:
- Frame slice extraction and dynamic navigation for encapsulated JPEG datasets (
numberOfFrames,frameIndex). - Full Basic Offset Table (BOT) parsing, 1:1 fragment-to-frame empty-BOT fallback, and sequential JPEG marker scanning (
0xFFD8SOI to0xFFD9EOI) across multi-fragment single-frame and multi-frame datasets. - Frame isolation preserved during interactive scrub slider and Cine playback.
- Frame slice extraction and dynamic navigation for encapsulated JPEG datasets (
- Quantitative ROI Statistics & Pixel Probe Validation on JPEG Datasets:
- Verified ROI measurement engine and Pixel Probe across both JPEG Lossless and JPEG Baseline datasets.
- Accurate Hounsfield Unit ($HU$) statistics on JPEG Lossless CT datasets with valid rescale slope and intercept.
- Stored scalar and RGB color inspection on JPEG frames via Pixel Probe without full-image re-decoding.
- Parser Interoperability & Error Modernization:
- Dynamic dataset VR auto-detection fallback for non-conformant DICOM datasets declaring Explicit VR in file meta while dataset body elements are encoded in Implicit VR. Properly encoded Explicit VR datasets retain Explicit VR parsing because the first dataset element exposes a valid two-byte uppercase VR code.
- Modernized, version-neutral
UnsupportedErrormessaging for unsupported or deferred transfer syntaxes.
- Public API Documentation & Release Readiness:
- All public-member documentation lint checks pass with
public_member_api_docs: trueenabled. - Added comprehensive Authoritative Transfer Syntax Support Matrix distinguishing supported, unsupported, and deferred transfer syntaxes with exact UIDs.
- Modernized error messages across palette color LUTs and codec registries to be completely version-neutral.
- All public-member documentation lint checks pass with
- Authoritative Scope & Limitations:
- Supported compressed transfer syntaxes: RLE Lossless (
1.2.840.10008.1.2.5), JPEG Baseline (1.2.840.10008.1.2.4.50), and JPEG Lossless SV1 (1.2.840.10008.1.2.4.70). - Supported uncompressed transfer syntaxes: Implicit VR Little Endian (
1.2.840.10008.1.2), Explicit VR Little Endian (1.2.840.10008.1.2.1), Explicit VR Big Endian (1.2.840.10008.1.2.2). - Unsupported or deferred transfer syntaxes throw explicit
UnsupportedError: JPEG Extended 12-bit (1.2.840.10008.1.2.4.51), JPEG Lossless Process 14 (1.2.840.10008.1.2.4.57), JPEG-LS (1.2.840.10008.1.2.4.80,1.2.840.10008.1.2.4.81), and JPEG 2000 (1.2.840.10008.1.2.4.90,1.2.840.10008.1.2.4.91).
- Supported compressed transfer syntaxes: RLE Lossless (
0.4.0 #
- 2D Distance Measurement Caliper Tool (
DicomTool.measure):- Interactive distance caliper measurement on the 2D DICOM image plane.
- Computes Euclidean physical distance in millimeters ($mm$) when
Pixel Spacing (0028,0030)is present. - Safe fallback to pixel distance ($px$) when physical spacing is absent or invalid.
- Interactive endpoint adjustment, endpoint hit-testing, zoom/pan invariance, and screen-reader accessibility semantics.
- 2D Rectangle Region of Interest (ROI) (
DicomTool.rectangleRoi):- Interactive rectangular ROI creation with automatic corner normalization.
- Reports physical dimensions ($W \times H$ in $mm$, Area in $mm^2$) or pixel fallback ($W \times H$ in $px$, Area in $px^2$).
- Strict image boundary validation without silent clamping.
- Quantitative ROI Pixel Statistics & Hounsfield Units (HU):
- Quantitative statistics engine evaluating discrete pixels enclosed by ROI boundaries.
- Calculates Mean, Population Standard Deviation ($\sigma_N$, denominator $N$), Min, Max, Median, and Pixel Count.
- Verified Hounsfield Unit ($HU$) statistics on CT datasets with explicit valid Rescale Slope ($>0$) and Intercept.
- Unitless intensity statistics on non-CT modalities (MR, CR, DX, US) with zero invented units or false
pxintensity suffixes. - Pre-rescale Pixel Padding Value (
0028,0120) and Range Limit (0028,0121) exclusion in stored pixel space. - Per-frame statistics caching computed strictly on pointer release without background rendering overhead.
- Pixel Probe Tool (
DicomTool.probe):- Real-time hover inspection overlay showing discrete pixel coordinate $(c, r)$, stored scalar intensity, and modality/HU rescaled values.
- Multi-channel RGB triplet and palette index inspection for PALETTE COLOR and RGB datasets.
- Ephemeral current-frame buffer caching ($O(1)$ lookup per hover event) without full-image re-decoding.
- Internal 2D Image Geometry & Safe Fallback Architecture:
- Canonical
DicomImageGeometryandImageCoordinateTransformmodels. - Strict geometry fallback classification: Verified Physical Spacing $\to$ Display-Only Pixel Aspect Ratio (
0028,0034) $\to$ Native Matrix Fallback. - Enforces that Pixel Aspect Ratio corrects display aspect ratio only and is strictly prohibited from inventing physical distance scales.
- Canonical
- Frame-Aware Measurement State & Isolation:
- Strict per-frame isolation across Distance Measurements, ROIs, Statistics, and Probe buffers.
- Frame navigation and tool switching preserve per-frame state without cross-frame leakage.
- Dataset changes cleanly invalidate and reset all measurement and probe caches.
- Public API DartDoc Documentation:
- All public-member documentation lint checks pass with
public_member_api_docs: trueenabled, providing comprehensive documentation with standard citations and mathematical formulas across all public symbols.
- All public-member documentation lint checks pass with
- Important Semantics & Limitations:
- Physical measurements ($mm, mm^2$) strictly require verified, finite, positive
Pixel Spacing (0028,0030). Pixel Aspect Ratio (0028,0034)provides display aspect ratio correction only and never establishes physical scale.- Native matrix fallback operates in pure pixel space ($px, px^2$).
- Hounsfield Units ($HU$) require valid explicit CT rescale metadata; missing or non-positive rescale slopes cleanly fall back to stored unitless scalar values.
- Pixel Padding is excluded in stored-pixel space before modality rescale calculation.
- Intensity statistics for MR, CR, DX, and other non-CT modalities remain unitless without invented units or $px$ suffixes.
- 3D spatial geometry (Image Position / Image Orientation Patient slice reconstruction), MPR, 3D volume rendering, DICOM Structured Reporting (SR), and Grayscale Softcopy Presentation State (GSPS) are out of scope.
- Physical measurements ($mm, mm^2$) strictly require verified, finite, positive
0.3.0 #
- Real-World DICOM RLE Lossless Fixture Validation:
- Full support for encapsulated DICOM RLE Lossless (
1.2.840.10008.1.2.5) streams with Basic Offset Tables (BOT) and fragmented frames. - Validated against real clinical DICOM fixtures (
OBXXXX1A_rle.dcm,emri_small_RLE.dcm,OBXXXX1A_rle_2frame.dcm).
- Full support for encapsulated DICOM RLE Lossless (
- Multi-Frame Navigation & Cine Playback:
- Added
DicomDataset.numberOfFramesgetter and 0-indexedframeIndexparameter acrossDicomRenderer.renderToImageandDicomImageWidget. - Added multi-frame scrub slider and play/pause Cine playback in example application.
- Added
- Physical Pixel Spacing (
0028,0030) Display Aspect-Ratio Correction:- Automatic geometric display aspect-ratio correction preserving non-square physical pixels:
(columns * columnSpacing) / (rows * rowSpacing). - Graceful fallback to native matrix aspect ratio when Pixel Spacing is absent or invalid.
- Automatic geometric display aspect-ratio correction preserving non-square physical pixels:
- PALETTE COLOR Direct LUT Rendering:
- Support for direct Palette Color Lookup Tables (Red
0028,1201, Green0028,1202, Blue0028,1203) and Descriptors (0028,1101–1103). - Supports 8-bit and 16-bit high-byte downsampling, signed/unsigned
firstMappedValue, and $O(1)$ clamping. - Descriptive
UnsupportedErroron Segmented LUTs (0028,1221-1223) and Enhanced Sequences (0028,140B). - Palette color HUD overlay (
Color: Palette LUT,Color: RGB) with windowing drag disabled on color images.
- Support for direct Palette Color Lookup Tables (Red
- Comprehensive DICOM Metadata Accessors API:
- Added 25+ strongly-typed convenience getters for Patient, Study, Series, Equipment, Instance, Acquisition, and Image header attributes.
- Medical Use Disclaimer:
- Added formal medical device and regulatory non-certification disclaimer to package documentation and example UI.
- Interactive Tool Switching Improvements:
- Fixed coordinate origin consistency when switching between Pan & Zoom and Windowing tools in
InteractiveViewer.
- Fixed coordinate origin consistency when switching between Pan & Zoom and Windowing tools in
0.2.0 #
- Pure-Dart RLE Lossless decompressor (
1.2.840.10008.1.2.5) supporting 8-bit, 16-bit MSB/LSB, and 24-bit RGB segment unpacking. RLE Lossless is implemented and unit-tested, but real-world DICOM RLE compatibility has not yet been validated against a real RLE DICOM fixture. - Pixel Padding Value (
0028, 0120) & Range Limit (0028, 0121) filtering in auto-windowing calculation. - Multi-valued clinical window presets support (
windowCenterPresets,windowWidthPresets). - Multi-frame groundwork with 0-indexed
frameIndexparameter inDicomRendererandDicomImageWidget. - Interactive pan & pinch-to-zoom support (
enableZoom), double-tap gesture reset, andonViewChangedcallback inDicomImageWidget.
0.1.0 #
- Initial release
- Parse single-frame uncompressed DICOM files (Explicit VR Little Endian)
- Support for Implicit VR Little Endian parsing
- Pixel data decoding: 8-bit and 16-bit (signed/unsigned)
- Windowing: rescale slope/intercept, window center/width
- Photometric interpretation: MONOCHROME1, MONOCHROME2
- Interactive windowing widget with drag gestures
- Cross-platform: Android, iOS, macOS, Windows, Linux, Web
- No native/FFI dependencies — 100% pure Dart