Struct dicom_parser::stateful::encode::StatefulEncoder [−][src]
pub struct StatefulEncoder<W, E, T = SpecificCharacterSet> { /* fields omitted */ }Expand description
Also called a printer, this encoder type provides a stateful mid-level
abstraction for writing DICOM content. Unlike Encode,
the stateful encoder knows how to write text values and keeps track
of how many bytes were written.
W is the write target, E is the encoder, and T is the text codec.
Implementations
impl<'s> StatefulEncoder<Box<dyn Write + 'w, Global>, Box<dyn EncodeTo<dyn Write + 'static> + 'w, Global>, SpecificCharacterSet>
impl<'s> StatefulEncoder<Box<dyn Write + 'w, Global>, Box<dyn EncodeTo<dyn Write + 'static> + 'w, Global>, SpecificCharacterSet>
pub fn from_transfer_syntax(
to: Box<dyn Write + 's>,
ts: TransferSyntax,
charset: SpecificCharacterSet
) -> Result<Self>
Encode and write a data element header.
Encode and write an item header,
where len is the specified length of the item
(can be 0xFFFF_FFFF for undefined length).
Encode and write an item delimiter.
Encode and write a sequence delimiter.
Write the given bytes directly to the inner writer.
Note that this method
(unlike write_bytes)
does not perform any additional padding.
Write a primitive DICOM value as a bunch of bytes directly to the inner writer.
This method will perform the necessary padding (always with zeros) to ensure that the encoded value has an even number of bytes.
Retrieve the number of bytes written so far by this printer.
Encode and write the values of a pixel data offset table.
pub fn encode_primitive_element(
&mut self,
de: &DataElementHeader,
value: &PrimitiveValue
) -> Result<()>
pub fn encode_primitive_element(
&mut self,
de: &DataElementHeader,
value: &PrimitiveValue
) -> Result<()>
Encode and write a data element with a primitive value.
This method will perform the necessary padding to ensure that the encoded value is an even number of bytes. Where applicable, this will use the inner text codec for textual values. The length property of the header is ignored, the true byte length of the value in its encoded form is used instead.
pub fn encode_primitive(
&mut self,
de: &DataElementHeader,
value: &PrimitiveValue
) -> Result<()>
👎 Deprecated since 0.5.0: use encode_primitive_element instead
pub fn encode_primitive(
&mut self,
de: &DataElementHeader,
value: &PrimitiveValue
) -> Result<()>
use encode_primitive_element instead
Encode and write a primitive value.
Its use is not recommended because the encoded value’s real length might not match the header’s length, leading to an inconsistent data set.