pub struct InMemDicomObject { /* private fields */ }Expand description
An in-memory DICOM data set: a flat, tag-ordered list of elements, each of which may itself
contain a nested list (for SQ values).
Implementations§
Source§impl InMemDicomObject
impl InMemDicomObject
Sourcepub fn from_element_iter<T>(iter: T) -> Selfwhere
T: IntoIterator<Item = InMemElement>,
pub fn from_element_iter<T>(iter: T) -> Selfwhere
T: IntoIterator<Item = InMemElement>,
Build an object directly from a list of elements, sorting them into tag order.
Matches dicom_object::InMemDicomObject::from_element_iter.
Sourcepub fn command_from_element_iter<T>(iter: T) -> Selfwhere
T: IntoIterator<Item = InMemElement>,
pub fn command_from_element_iter<T>(iter: T) -> Selfwhere
T: IntoIterator<Item = InMemElement>,
Build a DIMSE command data set from a list of elements. DIMSE command sets have the
same shape as a regular data set (a flat list of primitive elements, always Implicit VR
Little Endian on the wire per PS3.7) - this is an alias for Self::from_element_iter
kept for call-site clarity in dimse.rs/scp.rs.
Sourcepub fn get(&self, tag: Tag) -> Option<&InMemElement>
pub fn get(&self, tag: Tag) -> Option<&InMemElement>
Look up an element by tag. Returns None if absent.
Sourcepub fn get_mut(&mut self, tag: Tag) -> Option<&mut InMemElement>
pub fn get_mut(&mut self, tag: Tag) -> Option<&mut InMemElement>
Look up a mutable element by tag. Returns None if absent.
Sourcepub fn element(&self, tag: Tag) -> Result<&InMemElement, MissingElementError>
pub fn element(&self, tag: Tag) -> Result<&InMemElement, MissingElementError>
Look up an element by tag, returning a Result (an Err with a descriptive message on
absence) rather than Option - for call sites that want to ?-propagate a hard failure
on a required element.
Sourcepub fn put_str(&mut self, tag: Tag, vr: VR, value: impl Into<String>)
pub fn put_str(&mut self, tag: Tag, vr: VR, value: impl Into<String>)
Insert or replace a text element by tag and VR, creating it if absent. A thin
convenience wrapper around Self::put for CLI-style attribute edits
(--set KEY=VALUE) and DIMSE command/identifier construction that only ever deal in
string values.
Sourcepub fn put(&mut self, element: InMemElement)
pub fn put(&mut self, element: InMemElement)
Insert or replace an element, keeping the element list in tag order.
Sourcepub fn remove_element(&mut self, tag: Tag) -> bool
pub fn remove_element(&mut self, tag: Tag) -> bool
Remove an element by tag. Returns whether an element was actually present.
Sourcepub fn iter(&self) -> impl Iterator<Item = &InMemElement>
pub fn iter(&self) -> impl Iterator<Item = &InMemElement>
Iterate over all elements, in tag order.
pub fn is_empty(&self) -> bool
Sourcepub fn apply(&mut self, op: AttributeOp) -> Result<(), ApplyOpError>
pub fn apply(&mut self, op: AttributeOp) -> Result<(), ApplyOpError>
Apply an attribute mutation, as returned by a pixel data encoder after transcoding (e.g. a Photometric Interpretation or Planar Configuration adjustment required by the new transfer syntax).
§Errors
Returns ApplyOpError::UnsupportedSelector if op’s selector is not a single
top-level tag. dcmnorm only ever applies single-step, top-level selectors today
(confirmed by its own usage in io.rs - pixel data codec post-transcode attribute
patches never target nested sequences), so a full attribute-selector-path walk isn’t
implemented here - but a caller that does build one of those selectors should get a
clear error, not have the operation silently do nothing.
Sourcepub fn with_meta(
self,
builder: FileMetaTableBuilder,
) -> Result<FileDicomObject<Self>, WithMetaError>
pub fn with_meta( self, builder: FileMetaTableBuilder, ) -> Result<FileDicomObject<Self>, WithMetaError>
Attach a [FileMetaTable] built from a crate::FileMetaTableBuilder, producing a
crate::FileDicomObject.
Sourcepub fn read_dataset_with_ts<'r, R: Read + 'r>(
source: R,
ts: &TransferSyntax,
) -> Result<Self, ReadError>
pub fn read_dataset_with_ts<'r, R: Read + 'r>( source: R, ts: &TransferSyntax, ) -> Result<Self, ReadError>
Read a bare data set (no Part 10 preamble/meta group) from source, using the given
transfer syntax.
A dataset-level transfer syntax (currently just Deflated Explicit VR Little Endian) needs
its own byte-stream transform applied before element decoding even starts - unlike a
pixel-data codec, which only ever touches one element’s value. source is always boxed
(not just when a codec applies) so this function has one concrete reader type to build a
DataSetReader over regardless of transfer syntax.
Sourcepub fn read_dataset_with_ts_options<'r, R: Read + 'r>(
source: R,
ts: &TransferSyntax,
options: DataSetReaderOptions,
) -> Result<Self, ReadError>
pub fn read_dataset_with_ts_options<'r, R: Read + 'r>( source: R, ts: &TransferSyntax, options: DataSetReaderOptions, ) -> Result<Self, ReadError>
Self::read_dataset_with_ts with explicit reader options, e.g.
DataSetReaderOptions::flexible_decoding.
Sourcepub fn read_dataset_with_ts_cs<'r, R: Read + 'r>(
source: R,
ts: &TransferSyntax,
cs: SpecificCharacterSet,
) -> Result<Self, ReadError>
pub fn read_dataset_with_ts_cs<'r, R: Read + 'r>( source: R, ts: &TransferSyntax, cs: SpecificCharacterSet, ) -> Result<Self, ReadError>
Like Self::read_dataset_with_ts, seeded with an initial [SpecificCharacterSet]
(e.g. when resuming a stream to read trailing elements after PixelData).
Sourcepub fn specific_character_set(&self) -> SpecificCharacterSet
pub fn specific_character_set(&self) -> SpecificCharacterSet
Returns the [SpecificCharacterSet] declared by (0008,0005) in this object, or the
default character set if absent or unrecognized.
Sourcepub fn write_dataset_with_ts<'w, W: Write + 'w>(
&self,
to: W,
ts: &TransferSyntax,
) -> Result<(), WriteError>
pub fn write_dataset_with_ts<'w, W: Write + 'w>( &self, to: W, ts: &TransferSyntax, ) -> Result<(), WriteError>
Write this object as a bare data set (no Part 10 preamble/meta group) using the given
transfer syntax. See Self::read_dataset_with_ts for why to is always boxed.
Sourcepub fn write_dataset_with_ts_and_pixel_data<'w, W, E, F>(
&self,
to: W,
ts: &TransferSyntax,
write_pixel_data: F,
) -> Result<(), E>where
W: Write + 'w,
E: From<WriteError>,
F: FnOnce(&mut DataSetWriter<Box<dyn Write + 'w>, DynEncoder<'w, Box<dyn Write + 'w>>>) -> Result<(), E>,
pub fn write_dataset_with_ts_and_pixel_data<'w, W, E, F>(
&self,
to: W,
ts: &TransferSyntax,
write_pixel_data: F,
) -> Result<(), E>where
W: Write + 'w,
E: From<WriteError>,
F: FnOnce(&mut DataSetWriter<Box<dyn Write + 'w>, DynEncoder<'w, Box<dyn Write + 'w>>>) -> Result<(), E>,
Write this object as a bare data set, splitting top-level elements around (7FE0,0010)
and invoking write_pixel_data at the exact tag-order position of PixelData (skipping
any PixelData stored in self).
Sourcepub fn write_elements_to_writer<'w, W: Write>(
&self,
writer: &mut DataSetWriter<W, DynEncoder<'w, W>>,
) -> Result<(), WriteError>
pub fn write_elements_to_writer<'w, W: Write>( &self, writer: &mut DataSetWriter<W, DynEncoder<'w, W>>, ) -> Result<(), WriteError>
Write all elements in this object into an already-constructed DataSetWriter (e.g.
trailing elements after streaming PixelData in a single-pass wire receiver).
Sourcepub fn read_dataset_until_pixel_data<R: Read>(
source: R,
ts: &TransferSyntax,
) -> Result<(Self, PixelDataStreamStop), ReadError>
pub fn read_dataset_until_pixel_data<R: Read>( source: R, ts: &TransferSyntax, ) -> Result<(Self, PixelDataStreamStop), ReadError>
Read a bare data set from a forward-only stream up to (not including) top-level
(7FE0,0010) PixelData’s value, returning all elements read so far and where the stream
stopped. Because DataSetReader performs no read-ahead past the element header in hand,
source is left positioned at byte 0 of PixelData’s value (or at the Basic Offset Table
item header for encapsulated pixel data).
Does not apply dataset-level codecs (deflate) — callers must check ts.codec() first.
Trait Implementations§
Source§impl Clone for InMemDicomObject
impl Clone for InMemDicomObject
Source§impl Debug for InMemDicomObject
impl Debug for InMemDicomObject
Source§impl Default for InMemDicomObject
impl Default for InMemDicomObject
Source§impl HasLength for InMemDicomObject
impl HasLength for InMemDicomObject
Source§impl PartialEq for InMemDicomObject
impl PartialEq for InMemDicomObject
impl StructuralPartialEq for InMemDicomObject
Auto Trait Implementations§
impl Forget for InMemDicomObject
impl Freeze for InMemDicomObject
impl Move for InMemDicomObject
impl RefUnwindSafe for InMemDicomObject
impl Send for InMemDicomObject
impl Sync for InMemDicomObject
impl Unpin for InMemDicomObject
impl UnsafeUnpin for InMemDicomObject
impl UnwindSafe for InMemDicomObject
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