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
impl FileMetaTable
Sourcepub fn transfer_syntax(&self) -> &str
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).
pub fn media_storage_sop_class_uid(&self) -> &str
pub fn media_storage_sop_instance_uid(&self) -> &str
pub fn implementation_class_uid(&self) -> &str
Sourcepub fn set_transfer_syntax(&mut self, ts: &TransferSyntax)
pub fn set_transfer_syntax(&mut self, ts: &TransferSyntax)
Set the declared transfer syntax to the given TransferSyntax’s UID.
Sourcepub fn transfer_syntax_ts(&self) -> Option<&'static TransferSyntax>
pub fn transfer_syntax_ts(&self) -> Option<&'static TransferSyntax>
Resolve this table’s declared transfer syntax against the registry.
Sourcepub fn to_element_iter(&self) -> impl Iterator<Item = InMemElement> + '_
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).
Sourcepub fn write_to<W: Write>(&self, to: W) -> Result<(), WriteError>
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.
Sourcepub fn read_from<R: Read>(from: R) -> Result<Option<Self>, ReadError>
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.
Sourcepub fn read_meta_group<R: Read>(from: R) -> Result<Self, ReadError>
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
impl Clone for FileMetaTable
Source§impl Debug for FileMetaTable
impl Debug for FileMetaTable
Source§impl Default for FileMetaTable
impl Default for FileMetaTable
Source§impl PartialEq for FileMetaTable
impl PartialEq for FileMetaTable
impl StructuralPartialEq for FileMetaTable
Auto Trait Implementations§
impl Forget for FileMetaTable
impl Freeze for FileMetaTable
impl Move for FileMetaTable
impl RefUnwindSafe for FileMetaTable
impl Send for FileMetaTable
impl Sync for FileMetaTable
impl Unpin for FileMetaTable
impl UnsafeUnpin for FileMetaTable
impl UnwindSafe for FileMetaTable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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