pub struct StatefulDecoder<D, S, BD = BasicDecoder, TC = SpecificCharacterSet> { /* private fields */ }
Expand description
A stateful abstraction for the full DICOM content reading process.
This type encapsulates the necessary codecs in order
to be as autonomous as possible in the DICOM content reading
process.
S
is the generic parameter type for the original source,
D
is the parameter type that the decoder interprets as,
whereas DB
is the parameter type for the basic decoder.
TC
defines the text codec used underneath.
Implementations§
Source§impl<S> StatefulDecoder<DynDecoder<S>, S>
impl<S> StatefulDecoder<DynDecoder<S>, S>
Sourcepub fn new_with(
from: S,
ts: &TransferSyntax,
charset: SpecificCharacterSet,
position: u64,
) -> Result<Self>where
S: Read,
pub fn new_with(
from: S,
ts: &TransferSyntax,
charset: SpecificCharacterSet,
position: u64,
) -> Result<Self>where
S: Read,
Create a new DICOM parser for the given transfer syntax, character set, and assumed position of the reader source.
Sourcepub fn new_with_ts(from: S, ts: &TransferSyntax, position: u64) -> Result<Self>where
S: Read,
pub fn new_with_ts(from: S, ts: &TransferSyntax, position: u64) -> Result<Self>where
S: Read,
Create a new DICOM parser for the given transfer syntax and assumed position of the reader source.
The default character set is assumed until a Specific Character Set attribute is found.
Source§impl<S> StatefulDecoder<ExplicitVRLittleEndianDecoder, S, LittleEndianBasicDecoder, DefaultCharacterSetCodec>where
S: Read,
impl<S> StatefulDecoder<ExplicitVRLittleEndianDecoder, S, LittleEndianBasicDecoder, DefaultCharacterSetCodec>where
S: Read,
Sourcepub fn file_header_parser(from: S) -> Self
pub fn file_header_parser(from: S) -> Self
Create a new DICOM stateful decoder for reading the file meta header, which is always in Explicit VR Little Endian.
Source§impl<D, S, BD, TC> StatefulDecoder<D, S, BD, TC>where
BD: BasicDecode,
TC: TextCodec,
impl<D, S, BD, TC> StatefulDecoder<D, S, BD, TC>where
BD: BasicDecode,
TC: TextCodec,
Sourcepub fn new(
from: S,
decoder: D,
basic: BD,
text: TC,
) -> StatefulDecoder<D, S, BD, TC>
pub fn new( from: S, decoder: D, basic: BD, text: TC, ) -> StatefulDecoder<D, S, BD, TC>
Create a new DICOM stateful decoder from its parts.
Sourcepub fn new_with_position(
from: S,
decoder: D,
basic: BD,
text: TC,
position: u64,
) -> Self
pub fn new_with_position( from: S, decoder: D, basic: BD, text: TC, position: u64, ) -> Self
Create a new DICOM stateful decoder from its parts, while assuming a base reading position.
position
should be calculated with care.
Decoding or parsing errors may occur
if this position does not match the real position of the reader.
Source§impl<D, S, BD, TC> StatefulDecoder<D, S, BD, TC>
impl<D, S, BD, TC> StatefulDecoder<D, S, BD, TC>
Sourcepub fn new_positioned(
from: S,
decoder: D,
basic: BD,
text: TC,
) -> Result<Self, Error>
pub fn new_positioned( from: S, decoder: D, basic: BD, text: TC, ) -> Result<Self, Error>
Create a new DICOM stateful decoder from its parts,
while determining the data source’s current position via seek
.
Trait Implementations§
Source§impl<D, S, BD> StatefulDecode for StatefulDecoder<D, S, BD>
impl<D, S, BD> StatefulDecode for StatefulDecoder<D, S, BD>
type Reader = S
Source§fn decode_header(&mut self) -> Result<DataElementHeader>
fn decode_header(&mut self) -> Result<DataElementHeader>
Decode::decode_header
over the bound source.Source§fn decode_item_header(&mut self) -> Result<SequenceItemHeader>
fn decode_item_header(&mut self) -> Result<SequenceItemHeader>
Decode::decode_item_header
over the bound source.Source§fn read_value(&mut self, header: &DataElementHeader) -> Result<PrimitiveValue>
fn read_value(&mut self, header: &DataElementHeader) -> Result<PrimitiveValue>
chrono
crate. To avoid this conversion, see
read_value_preserved
. Read moreSource§fn read_value_preserved(
&mut self,
header: &DataElementHeader,
) -> Result<PrimitiveValue>
fn read_value_preserved( &mut self, header: &DataElementHeader, ) -> Result<PrimitiveValue>
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. Read moreSource§fn read_value_bytes(
&mut self,
header: &DataElementHeader,
) -> Result<PrimitiveValue>
fn read_value_bytes( &mut self, header: &DataElementHeader, ) -> Result<PrimitiveValue>
Source§fn position(&self) -> u64
fn position(&self) -> u64
Source§fn read_to_vec(&mut self, length: u32, vec: &mut Vec<u8>) -> Result<()>
fn read_to_vec(&mut self, length: u32, vec: &mut Vec<u8>) -> Result<()>
Source§fn read_u32_to_vec(&mut self, length: u32, vec: &mut Vec<u32>) -> Result<()>
fn read_u32_to_vec(&mut self, length: u32, vec: &mut Vec<u32>) -> Result<()>
Source§fn read_to<W>(&mut self, length: u32, out: W) -> Result<()>
fn read_to<W>(&mut self, length: u32, out: W) -> Result<()>
Auto Trait Implementations§
impl<D, S, BD, TC> Freeze for StatefulDecoder<D, S, BD, TC>
impl<D, S, BD, TC> RefUnwindSafe for StatefulDecoder<D, S, BD, TC>
impl<D, S, BD, TC> Send for StatefulDecoder<D, S, BD, TC>
impl<D, S, BD, TC> Sync for StatefulDecoder<D, S, BD, TC>
impl<D, S, BD, TC> Unpin for StatefulDecoder<D, S, BD, TC>
impl<D, S, BD, TC> UnwindSafe for StatefulDecoder<D, S, BD, TC>
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> 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