Dicom.TransferSyntax (Dicom v0.9.1)

Copy Markdown View Source

Transfer Syntax definitions and properties.

A Transfer Syntax specifies how DICOM data is encoded: byte order, whether VR is explicit or implicit, and pixel data compression.

Registers 49 DICOM transfer syntaxes currently tracked by this library (34 active + 15 retired). Unknown transfer syntaxes are rejected by default — use encoding/2 with lenient: true to fall back to Explicit VR Little Endian for unrecognized UIDs.

Reference: DICOM PS3.5 Section 10, PS3.6 Table A-1.

Summary

Functions

Returns only active (non-retired) transfer syntaxes.

Returns all registered transfer syntaxes.

Returns true if the transfer syntax uses compressed pixel data.

Returns the VR encoding and endianness for a given transfer syntax UID.

Extracts the transfer syntax UID from a file meta elements map.

Returns true if the transfer syntax uses fragmentable encapsulation.

Returns the transfer syntax definition for the given UID.

Returns true if the transfer syntax uses implicit VR encoding.

Returns true if the given UID is a known transfer syntax.

Returns true if the transfer syntax is retired.

Types

endianness()

@type endianness() :: :little | :big

t()

@type t() :: %Dicom.TransferSyntax{
  compressed: boolean(),
  endianness: endianness(),
  fragmentable: boolean(),
  name: String.t(),
  retired: boolean(),
  uid: String.t(),
  vr_encoding: vr_encoding()
}

vr_encoding()

@type vr_encoding() :: :implicit | :explicit

Functions

active()

@spec active() :: [t()]

Returns only active (non-retired) transfer syntaxes.

all()

@spec all() :: [t()]

Returns all registered transfer syntaxes.

compressed?(uid)

@spec compressed?(String.t()) :: boolean()

Returns true if the transfer syntax uses compressed pixel data.

encoding(uid, opts \\ [])

@spec encoding(
  String.t(),
  keyword()
) :: {:ok, {vr_encoding(), endianness()}} | {:error, :unknown_transfer_syntax}

Returns the VR encoding and endianness for a given transfer syntax UID.

Returns {:ok, {vr_encoding, endianness}} for known transfer syntaxes, or {:error, :unknown_transfer_syntax} for unknown UIDs.

Options

  • lenient: true — falls back to {:ok, {:explicit, :little}} for unknown UIDs instead of returning an error. Use this only when you need to attempt parsing files with unrecognized private or future transfer syntaxes.

extract_uid(file_meta)

@spec extract_uid(%{required(Dicom.Tag.t()) => Dicom.DataElement.t()}) :: String.t()

Extracts the transfer syntax UID from a file meta elements map.

Falls back to Implicit VR Little Endian if the tag is absent.

fragmentable?(uid)

@spec fragmentable?(String.t()) :: boolean()

Returns true if the transfer syntax uses fragmentable encapsulation.

Fragmentable transfer syntaxes (MPEG, HEVC) may have pixel data fragments that do not correspond one-to-one with frames.

from_uid(uid)

@spec from_uid(String.t()) :: {:ok, t()} | {:error, :unknown_transfer_syntax}

Returns the transfer syntax definition for the given UID.

implicit_vr?(uid)

@spec implicit_vr?(String.t()) :: boolean()

Returns true if the transfer syntax uses implicit VR encoding.

known?(uid)

@spec known?(String.t()) :: boolean()

Returns true if the given UID is a known transfer syntax.

retired?(uid)

@spec retired?(String.t()) :: boolean()

Returns true if the transfer syntax is retired.