Skip to main content

FileMetaTable

Struct FileMetaTable 

Source
pub struct FileMetaTable {
    pub information_version: [u8; 2],
    pub media_storage_sop_class_uid: String,
    pub media_storage_sop_instance_uid: String,
    pub transfer_syntax: String,
    pub implementation_class_uid: String,
    pub implementation_version_name: Option<String>,
    pub source_application_entity_title: Option<String>,
    pub sending_application_entity_title: Option<String>,
    pub receiving_application_entity_title: Option<String>,
    pub private_information_creator_uid: Option<String>,
    pub private_information: Option<Vec<u8>>,
}
Expand description

The File Meta Information (group 0002) of a DICOM Part 10 file.

The three “mandatory” fields (media_storage_sop_class_uid, media_storage_sop_instance_uid, implementation_class_uid) are plain Strings with no “absent” state, matching how dcmnorm’s --remove/--set CLI semantics for group-0002 attributes already distinguish “clear to empty string” from “was never set” - see dicom_edit.rs. Everything else is Option<String> and uses .take() to represent removal.

Unlike dicom-object’s equivalent, information_group_length is not a field that can go stale: it’s always computed fresh in FileMetaTable::write_to from whatever meta elements are actually about to be written, so there’s nothing to “refresh” before a write.

Fields§

§information_version: [u8; 2]§media_storage_sop_class_uid: String§media_storage_sop_instance_uid: String§transfer_syntax: String§implementation_class_uid: String§implementation_version_name: Option<String>§source_application_entity_title: Option<String>§sending_application_entity_title: Option<String>§receiving_application_entity_title: Option<String>§private_information_creator_uid: Option<String>§private_information: Option<Vec<u8>>

Implementations§

Source§

impl FileMetaTable

Source

pub fn transfer_syntax(&self) -> &str

The transfer syntax UID declared in this meta table (trailing NUL/whitespace not trimmed here - callers that need a normalized comparison already trim, see io.rs::normalize_transfer_syntax_uid).

Source

pub fn media_storage_sop_class_uid(&self) -> &str

Source

pub fn media_storage_sop_instance_uid(&self) -> &str

Source

pub fn implementation_class_uid(&self) -> &str

Source

pub fn set_transfer_syntax(&mut self, ts: &TransferSyntax)

Set the declared transfer syntax to the given TransferSyntax’s UID.

Source

pub fn transfer_syntax_ts(&self) -> Option<&'static TransferSyntax>

Resolve this table’s declared transfer syntax against the registry.

Source

pub fn to_element_iter(&self) -> impl Iterator<Item = InMemElement> + '_

Iterate this meta table’s elements in the same shape they’d be written to a file, including the group length element itself. Used for JSON export (standard_json.rs/flat_json.rs).

Source

pub fn write_to<W: Write>(&self, to: W) -> Result<(), WriteError>

Write the 128-byte preamble, “DICM” magic, and this meta group (Explicit VR Little Endian, per PS3.10 §7.1) to to.

Source

pub fn read_from<R: Read>(from: R) -> Result<Option<Self>, ReadError>

Try to read the 128-byte preamble + “DICM” magic + group-0002 meta elements from from. Returns Ok(None) (not an error) if the preamble/magic aren’t present, so callers can fall back to treating the stream as a bare (meta-less) data set - matching the permissive trial-parse behavior dcmnorm already relies on for raw dumps.

Source

pub fn read_meta_group<R: Read>(from: R) -> Result<Self, ReadError>

Read the group-0002 meta elements only, assuming the reader is already positioned right after the “DICM” magic (i.e. the preamble has already been consumed/verified).

The meta group’s own length - the value of its first element, (0002,0000) - is read first and used to read exactly that many further bytes into a bounded buffer, which is then parsed as a self-contained data set. This is deliberate: a token-stream reader has no way to “un-read” bytes once it has peeked at the next element’s header, so detecting the end of group 0002 by peeking at the first element outside it (rather than by the declared length) would consume and discard the first several bytes of the main data set that follows - byte-desyncing everything read after it.

Trait Implementations§

Source§

impl Clone for FileMetaTable

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FileMetaTable

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FileMetaTable

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for FileMetaTable

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FileMetaTable

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more