Skip to main content

Module dicom_part10

Module dicom_part10 

Source
Expand description

DICOM Part-10 metadata parsing, stream traversal, discovery, and overlay specs.

File ingest path — heap allocation is permitted here (not a hot-path evaluator).

Structs§

DicomMetadata
DicomOrganMapFile
DicomOverlaySpec
DicomPixelSlice
Pixel payload location inside a Part 10 file (not copied — Core 3 streams to blob store).
DicomPlacement
DicomSplitPayload
Result of split-ingestion parse: semantic metadata + raw pixel slice bounds.
DicomTagMatcher

Enums§

DicomError

Constants§

DEFAULT_LOCAL_DICOM_DIR
Default relative path for gitignored private DICOM slices (local dev only).
INLINE_TAG_BLOB_POINTER
Inline datatype tag for mmap blob byte-offset pointers (resolver bits 60–62 = 0b100).
TS_EXPLICIT_VR_LITTLE_ENDIAN
TS_IMPLICIT_VR_LITTLE_ENDIAN
TS_JPEG2000
TS_JPEG2000_LOSSLESS
TS_JPEG_BASELINE
TS_RLE_LOSSLESS

Functions§

build_overlay_spec
Assemble a DicomOverlaySpec from parsed metadata — organ inferred when not supplied, placement defaulted per organ.
chat_mentions_imaging
true when text mentions imaging (marker-substring scan over IMAGING_CHAT_MARKERS).
collect_dicom_image_paths_under
Image slices only (Pixel Data present), preferring IM* filenames typical of PACS export.
collect_dicom_paths_under
Collect up to max_files DICOM Part-10 paths under root (cold-path helper; may allocate).
decode_blob_pointer
Decode a blob pointer from an Object field; returns None if tag mismatch.
default_organ_matchers
Built-in token->organ matcher table (heart, lung, liver, brain, kidney, ovary, …) for DICOM text fields.
default_placement_for_organ
Curated 3D torso-overlay placement per organ label (offset/scale/ rotation), with a generic fallback for unlisted organs.
dicom_has_pixel_data
True when the buffer contains extractable Pixel Data for split-ingest.
encode_blob_pointer
Encode a Core-3 blob-store byte offset into an inline Object field pointer.
infer_organ_from_haystack
First-matching-token organ inference over normalized haystack.
infer_organ_from_metadata
Infer the organ from the file’s text fields (body part, series/ study descriptions, protocol name) via matchers.
infer_overlay_spec_from_text
Build a “chat-inferred” overlay spec when text mentions imaging — organ from keyword match, sensible default opacity/placement.
is_dicom_part10
Returns true when the byte slice looks like DICOM Part 10 (preamble + DICM).
metadata_json_from_file
Parsed DicomMetadata from path serialized to JSON.
normalize_dicom_token
Lowercase, alphanumeric-only, whitespace-collapsed form of value — the keyword-matching normal form.
overlay_spec_from_file
Read path, parse its DICOM metadata, and build the overlay spec.
overlay_spec_json_from_file
overlay_spec_from_file serialized to a JSON string (WASM/FFI seam).
pack_volume_metadata
Pack rows/cols/pixel-byte-length into the metadata lane for volume queries.
parse_dicom_file
Parse DICOM metadata from a file path.
parse_dicom_metadata_bytes
Parse DICOM Part 10 metadata from an on-disk byte buffer (pixel data optional).
resolve_local_dicom_dir
Resolve private local DICOM root: QUALIA_DICOM_FIXTURE_DIR env, then workspace-relative default.
split_dicom_payload
Split-ingestion entry: metadata tags + pixel slice bounds (no heap copy of pixels).
unpack_volume_metadata
Inverse of pack_volume_metadata — (rows, cols, pixel byte length).