Skip to main content
Version: v0.0.4

Class: Item

One sequence item. Inherits fileMeta (always undefined for nested items), warnings, and the protected element map from Dataset.

Phase 3 surfaces Item.get(...) / Item.has(...) / etc. via the Dataset superclass extension per D-42.

Example

import { Item } from "@cosyte/dicom";
// Producers (parser plan 02-04) construct items as follows:
// const item = new Item({ index: 0, warnings: [], elements: new Map() });

Extends

Constructors

Constructor

new Item(init): Item

Internal

Construct a new structural Item. Producers are the SQ / FFFE marker parsers in plan 02-04.

Parameters

init

ItemInit

Returns

Item

Overrides

Dataset.constructor

Properties

_elements

protected readonly _elements: ReadonlyMap<string, Element>

Internal

Element map, keyed by uppercase 8-hex tag. Phase 3 promotes to public navigation surface; Phase 2 keeps it protected so only subclasses (Item, future Phase-3 extensions) can introspect.

Inherited from

Dataset._elements


fileMeta

readonly fileMeta: FileMeta | undefined

Inherited from

Dataset.fileMeta


index

readonly index: number


warnings

readonly warnings: readonly DicomParseWarning[]

Inherited from

Dataset.warnings

Accessors

image

Get Signature

get image(): ImageView

Pixel-interpretation + geometry view (§4.2–§4.5). Surfaces exactly what a renderer needs without guessing: rescaleSlope/signed/ photometricInterpretation stay absent rather than defaulted, and the three pixel-spacing tags are distinct. Memoised on first read.

Example
import { parseDicom } from "@cosyte/dicom";
const img = parseDicom(buf).image;
img.rescaleSlope; // undefined ⇒ MUST NOT assume 1
Returns

ImageView

Inherited from

Dataset.image


patient

Get Signature

get patient(): PatientView

Patient-identity view (§4.1). Fail-safe typed-absent fields; id is not globally unique - match on the {id, issuerOfId, ...} tuple plus otherIds, never on a bare (0010,0020). Memoised on first read.

Example
import { parseDicom } from "@cosyte/dicom";
const p = parseDicom(buf).patient;
p.name?.alphabetic.familyName; // structured PN, never flattened
Returns

PatientView

Inherited from

Dataset.patient


series

Get Signature

get series(): SeriesView

Series-identity & co-registration view (§4.1, §4.3). A shared frameOfReferenceUid means images are spatially co-registered. Memoised on first read.

Example
import { parseDicom } from "@cosyte/dicom";
const s = parseDicom(buf).series;
s.modality; // "CT"
Returns

SeriesView

Inherited from

Dataset.series


study

Get Signature

get study(): StudyView

Study-identity view (§4.1). instanceUid is the cross-system study key; accessionNumber ties it to the order. Memoised on first read.

Example
import { parseDicom } from "@cosyte/dicom";
const s = parseDicom(buf).study;
s.instanceUid; // "1.2.840.113619..."
Returns

StudyView

Inherited from

Dataset.study

Methods

elements()

elements(): readonly Element[]

All elements in this dataset, in parse (insertion) order.

Returns

readonly Element[]

Example

import { parseDicom } from "@cosyte/dicom";
const ds = parseDicom(buf);
for (const el of ds.elements()) console.log(el.tag, el.vr);

Inherited from

Dataset.elements


get()

get(tag): Element | undefined

Look up a single element by tag. Tags are normalised to 8-char uppercase hex, so "7fe00010" and "7FE00010" resolve to the same element. Returns undefined when the tag is absent.

Parameters

tag

string

Returns

Element | undefined

Example

import { parseDicom } from "@cosyte/dicom";
const ds = parseDicom(buf);
const rows = ds.get("00280010"); // Rows
if (rows?.value.kind === "numbers") console.log(rows.value.values[0]);

Inherited from

Dataset.get


getAll()

getAll(tag): readonly Element[]

All elements matching a tag as an array (never undefined). A dataset holds at most one element per tag, so this returns a 0- or 1-length array - the convenience complement of Dataset.get for callers that prefer an always-array shape.

Parameters

tag

string

Returns

readonly Element[]

Example

import { parseDicom } from "@cosyte/dicom";
const ds = parseDicom(buf);
for (const el of ds.getAll("00080060")) console.log(el.value);

Inherited from

Dataset.getAll


has()

has(tag): boolean

true when an element with the given tag is present (case-insensitive).

Parameters

tag

string

Returns

boolean

Example

import { parseDicom } from "@cosyte/dicom";
const ds = parseDicom(buf);
if (ds.has("00100010")) console.log("has Patient's Name");

Inherited from

Dataset.has