Struct dicom_object::mem::InMemDicomObject
source · pub struct InMemDicomObject<D = StandardDataDictionary> { /* private fields */ }
Expand description
A DICOM object that is fully contained in memory.
Implementations§
source§impl InMemDicomObject<StandardDataDictionary>
impl InMemDicomObject<StandardDataDictionary>
sourcepub fn create_empty() -> Self
👎Deprecated since 0.5.0: Use new_empty
instead
pub fn create_empty() -> Self
new_empty
insteadCreate a new empty DICOM object.
sourcepub fn from_element_source<I>(iter: I) -> Result<Self>where
I: IntoIterator<Item = Result<InMemElement<StandardDataDictionary>>>,
pub fn from_element_source<I>(iter: I) -> Result<Self>where
I: IntoIterator<Item = Result<InMemElement<StandardDataDictionary>>>,
Construct a DICOM object from a fallible source of structured elements.
sourcepub fn from_element_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = InMemElement<StandardDataDictionary>>,
pub fn from_element_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = InMemElement<StandardDataDictionary>>,
Construct a DICOM object from a non-fallible source of structured elements.
sourcepub fn read_dataset<S>(decoder: S) -> Result<Self>where
S: StatefulDecode,
pub fn read_dataset<S>(decoder: S) -> Result<Self>where
S: StatefulDecode,
Read an object from a source using the given decoder.
Note: read_dataset_with_ts
and read_dataset_with_ts_cs
may be easier to use.
sourcepub fn read_dataset_with_ts_cs<S>(
from: S,
ts: &TransferSyntax,
cs: SpecificCharacterSet
) -> Result<Self>where
S: Read,
pub fn read_dataset_with_ts_cs<S>(
from: S,
ts: &TransferSyntax,
cs: SpecificCharacterSet
) -> Result<Self>where
S: Read,
Read an object from a source, using the given transfer syntax and default character set.
If the attribute Specific Character Set is found in the encoded data, this will override the given character set.
sourcepub fn read_dataset_with_ts<S>(from: S, ts: &TransferSyntax) -> Result<Self>where
S: Read,
pub fn read_dataset_with_ts<S>(from: S, ts: &TransferSyntax) -> Result<Self>where
S: Read,
Read an object from a source, using the given transfer syntax.
The default character set is assumed until Specific Character Set is found in the encoded data, after which the text decoder will be overriden accordingly.
source§impl<D> InMemDicomObject<D>where
D: DataDictionary + Clone,
impl<D> InMemDicomObject<D>where
D: DataDictionary + Clone,
sourcepub fn new_empty_with_dict(dict: D) -> Self
pub fn new_empty_with_dict(dict: D) -> Self
Create a new empty object, using the given dictionary for name lookup.
sourcepub fn from_element_source_with_dict<I>(iter: I, dict: D) -> Result<Self>where
I: IntoIterator<Item = Result<InMemElement<D>>>,
pub fn from_element_source_with_dict<I>(iter: I, dict: D) -> Result<Self>where
I: IntoIterator<Item = Result<InMemElement<D>>>,
Construct a DICOM object from an iterator of structured elements.
sourcepub fn from_iter_with_dict<I>(iter: I, dict: D) -> Selfwhere
I: IntoIterator<Item = InMemElement<D>>,
pub fn from_iter_with_dict<I>(iter: I, dict: D) -> Selfwhere
I: IntoIterator<Item = InMemElement<D>>,
Construct a DICOM object from a non-fallible iterator of structured elements.
sourcepub fn read_dataset_with_dict<S>(decoder: S, dict: D) -> Result<Self>where
S: StatefulDecode,
D: DataDictionary,
pub fn read_dataset_with_dict<S>(decoder: S, dict: D) -> Result<Self>where
S: StatefulDecode,
D: DataDictionary,
Read an object from a source, using the given decoder and the given dictionary for name lookup.
sourcepub fn read_dataset_with_dict_ts<S>(
from: S,
dict: D,
ts: &TransferSyntax
) -> Result<Self>where
S: Read,
D: DataDictionary,
pub fn read_dataset_with_dict_ts<S>(
from: S,
dict: D,
ts: &TransferSyntax
) -> Result<Self>where
S: Read,
D: DataDictionary,
Read an object from a source, using the given data dictionary and transfer syntax.
sourcepub fn read_dataset_with_dict_ts_cs<S>(
from: S,
dict: D,
ts: &TransferSyntax,
cs: SpecificCharacterSet
) -> Result<Self>where
S: Read,
D: DataDictionary,
pub fn read_dataset_with_dict_ts_cs<S>(
from: S,
dict: D,
ts: &TransferSyntax,
cs: SpecificCharacterSet
) -> Result<Self>where
S: Read,
D: DataDictionary,
Read an object from a source, using the given data dictionary, transfer syntax, and the given character set to assume by default.
If the attribute Specific Character Set is found in the encoded data, this will override the given character set.
sourcepub fn meta(&self) -> Option<&FileMetaTable>
👎Deprecated since 0.5.3: Always returns None, see FileDicomObject::meta
instead
pub fn meta(&self) -> Option<&FileMetaTable>
FileDicomObject::meta
insteadRetrieve the object’s meta table if available.
At the moment, this is sure to return None
, because the meta
table is kept in a separate wrapper value.
sourcepub fn element(&self, tag: Tag) -> Result<&InMemElement<D>>
pub fn element(&self, tag: Tag) -> Result<&InMemElement<D>>
Retrieve a particular DICOM element by its tag.
An error is returned if the element does not exist.
For an alternative to this behavior,
see element_opt
.
sourcepub fn element_by_name(&self, name: &str) -> Result<&InMemElement<D>>
pub fn element_by_name(&self, name: &str) -> Result<&InMemElement<D>>
Retrieve a particular DICOM element by its name.
This method translates the given attribute name into its tag
before retrieving the element.
If the attribute is known in advance,
using element
with a tag constant is preferred.
An error is returned if the element does not exist.
For an alternative to this behavior,
see element_by_name_opt
.
sourcepub fn element_opt(&self, tag: Tag) -> Result<Option<&InMemElement<D>>>
pub fn element_opt(&self, tag: Tag) -> Result<Option<&InMemElement<D>>>
Retrieve a particular DICOM element that might not exist by its tag.
If the element does not exist,
None
is returned.
sourcepub fn element_by_name_opt(&self, name: &str) -> Result<Option<&InMemElement<D>>>
pub fn element_by_name_opt(&self, name: &str) -> Result<Option<&InMemElement<D>>>
Retrieve a particular DICOM element that might not exist by its name.
If the element does not exist,
None
is returned.
This method translates the given attribute name into its tag
before retrieving the element.
If the attribute is known in advance,
using element_opt
with a tag constant is preferred.
sourcepub fn put(&mut self, elt: InMemElement<D>) -> Option<InMemElement<D>>
pub fn put(&mut self, elt: InMemElement<D>) -> Option<InMemElement<D>>
Insert a data element to the object, replacing (and returning) any previous element of the same attribute.
sourcepub fn put_element(&mut self, elt: InMemElement<D>) -> Option<InMemElement<D>>
pub fn put_element(&mut self, elt: InMemElement<D>) -> Option<InMemElement<D>>
Insert a data element to the object, replacing (and returning) any previous element of the same attribute.
sourcepub fn remove_element(&mut self, tag: Tag) -> bool
pub fn remove_element(&mut self, tag: Tag) -> bool
Remove a DICOM element by its tag, reporting whether it was present.
sourcepub fn remove_element_by_name(&mut self, name: &str) -> Result<bool>
pub fn remove_element_by_name(&mut self, name: &str) -> Result<bool>
Remove a DICOM element by its keyword, reporting whether it was present.
sourcepub fn take_element(&mut self, tag: Tag) -> Result<InMemElement<D>>
pub fn take_element(&mut self, tag: Tag) -> Result<InMemElement<D>>
Remove and return a particular DICOM element by its tag.
sourcepub fn take_element_by_name(&mut self, name: &str) -> Result<InMemElement<D>>
pub fn take_element_by_name(&mut self, name: &str) -> Result<InMemElement<D>>
Remove and return a particular DICOM element by its name.
sourcepub fn retain(&mut self, f: impl FnMut(&InMemElement<D>) -> bool)
pub fn retain(&mut self, f: impl FnMut(&InMemElement<D>) -> bool)
Modify the object by retaining only the DICOM data elements specified by the predicate.
The elements are visited in ascending tag order,
and those for which f(&element)
returns false
are removed.
sourcepub fn write_dataset<W, E>(&self, to: W, encoder: E) -> Result<()>where
W: Write,
E: EncodeTo<W>,
pub fn write_dataset<W, E>(&self, to: W, encoder: E) -> Result<()>where
W: Write,
E: EncodeTo<W>,
Write this object’s data set into the given writer, with the given encoder specifications, without preamble, magic code, nor file meta group.
The text encoding to use will be the default character set until Specific Character Set is found in the data set, in which then that character set will be used.
Note: write_dataset_with_ts
and write_dataset_with_ts_cs
may be easier to use.
sourcepub fn write_dataset_with_ts_cs<W>(
&self,
to: W,
ts: &TransferSyntax,
cs: SpecificCharacterSet
) -> Result<()>where
W: Write,
pub fn write_dataset_with_ts_cs<W>(
&self,
to: W,
ts: &TransferSyntax,
cs: SpecificCharacterSet
) -> Result<()>where
W: Write,
Write this object’s data set into the given printer, with the specified transfer syntax and character set, without preamble, magic code, nor file meta group.
If the attribute Specific Character Set is found in the data set, the last parameter is overridden accordingly.
sourcepub fn write_dataset_with_ts<W>(&self, to: W, ts: &TransferSyntax) -> Result<()>where
W: Write,
pub fn write_dataset_with_ts<W>(&self, to: W, ts: &TransferSyntax) -> Result<()>where
W: Write,
Write this object’s data set into the given writer, with the specified transfer syntax, without preamble, magic code, nor file meta group.
The default character set is assumed until the Specific Character Set is found in the data set, after which the text encoder is overridden accordingly.
sourcepub fn with_exact_meta(self, meta: FileMetaTable) -> FileDicomObject<Self>
pub fn with_exact_meta(self, meta: FileMetaTable) -> FileDicomObject<Self>
Encapsulate this object to contain a file meta group as described exactly by the given table.
Note: this method will not adjust the file meta group to be semantically valid for the object.
sourcepub fn with_meta(
self,
meta: FileMetaTableBuilder
) -> Result<FileDicomObject<Self>>
pub fn with_meta(
self,
meta: FileMetaTableBuilder
) -> Result<FileDicomObject<Self>>
Encapsulate this object to contain a file meta group, created through the given file meta table builder.
The attribute Media Storage SOP Instance UID will be filled in with the contents of the object, if the attribute SOP Instance UID is present. A complete file meta group should still provide the media storage SOP class UID and transfer syntax.
sourcepub fn iter(&self) -> impl Iterator<Item = &InMemElement<D>> + '_
pub fn iter(&self) -> impl Iterator<Item = &InMemElement<D>> + '_
Obtain an iterator over the elements of this object.
Obtain an iteartor over the tags of the object’s elements.
Trait Implementations§
source§impl<D: Clone> Clone for InMemDicomObject<D>
impl<D: Clone> Clone for InMemDicomObject<D>
source§fn clone(&self) -> InMemDicomObject<D>
fn clone(&self) -> InMemDicomObject<D>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<D: Debug> Debug for InMemDicomObject<D>
impl<D: Debug> Debug for InMemDicomObject<D>
source§impl<'s, D> DicomObject for &'s InMemDicomObject<D>where
D: DataDictionary + Clone + 's,
impl<'s, D> DicomObject for &'s InMemDicomObject<D>where
D: DataDictionary + Clone + 's,
source§impl<D> Extend<DataElement<InMemDicomObject<D>, Vec<u8, Global>>> for InMemDicomObject<D>
impl<D> Extend<DataElement<InMemDicomObject<D>, Vec<u8, Global>>> for InMemDicomObject<D>
source§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = InMemElement<D>>,
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = InMemElement<D>>,
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)