[][src]Trait dicom_parser::parser::Parse

pub trait Parse<S: ?Sized> where
    S: Read
{ fn decode_header(&mut self, from: &mut S) -> Result<DataElementHeader>;
fn decode_item_header(&mut self, from: &mut S) -> Result<SequenceItemHeader>;
fn read_value(
        &mut self,
        from: &mut S,
        header: &DataElementHeader
    ) -> Result<PrimitiveValue>;
fn read_value_preserved(
        &mut self,
        from: &mut S,
        header: &DataElementHeader
    ) -> Result<PrimitiveValue>;
fn set_character_set(&mut self, charset: SpecificCharacterSet) -> Result<()>; }

A trait for DICOM data parsers, which abstracts the necessary parts of a full DICOM content reading process.

Required methods

fn decode_header(&mut self, from: &mut S) -> Result<DataElementHeader>

Same as Decode::decode_header over the bound source.

fn decode_item_header(&mut self, from: &mut S) -> Result<SequenceItemHeader>

Same as Decode::decode_item_header over the bound source.

fn read_value(
    &mut self,
    from: &mut S,
    header: &DataElementHeader
) -> Result<PrimitiveValue>

Eagerly read the following data in the source as a primitive data value. When reading values in text form, a conversion to a more maleable type is attempted. Namely, numbers in text form (IS, DS) are converted to the corresponding binary number types, and date/time instances are decoded into binary date/time objects of types defined in the chrono crate. To avoid this conversion, see read_value_preserved.

Errors

Returns an error on I/O problems, or if the header VR describes a sequence, which in that case this method should not be used.

fn read_value_preserved(
    &mut self,
    from: &mut S,
    header: &DataElementHeader
) -> Result<PrimitiveValue>

Eagerly read the following data in the source as a primitive data value. Unlike read_value, this method will preserve the DICOM value's original format: numbers saved as text, as well as dates and times, are read as strings.

Errors

Returns an error on I/O problems, or if the header VR describes a sequence, which in that case this method should not be used.

fn set_character_set(&mut self, charset: SpecificCharacterSet) -> Result<()>

Define the specific character set of subsequent text elements.

Loading content...

Implementors

impl<S: ?Sized, D, BD> Parse<S> for DicomParser<D, BD, S, Box<dyn TextCodec>> where
    D: Decode<Source = S>,
    BD: BasicDecode,
    S: Read
[src]

Loading content...