Struct dicom_parser::stateful::decode::StatefulDecoder
source · [−]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
sourceimpl<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.
sourceimpl<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.
sourceimpl<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 calculatd with care.
Decoding or parsing errors may occur
if this position does not match the real position of the reader.
sourceimpl<D, S, BD, TC> StatefulDecoder<D, S, BD, TC> where
S: Seek,
BD: BasicDecode,
TC: TextCodec,
impl<D, S, BD, TC> StatefulDecoder<D, S, BD, TC> where
S: Seek,
BD: BasicDecode,
TC: TextCodec,
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
sourceimpl<D, S, BD> StatefulDecode for StatefulDecoder<D, S, BD> where
D: DecodeFrom<S>,
BD: BasicDecode,
S: Read,
impl<D, S, BD> StatefulDecode for StatefulDecoder<D, S, BD> where
D: DecodeFrom<S>,
BD: BasicDecode,
S: Read,
type Reader = S
sourcefn decode_header(&mut self) -> Result<DataElementHeader>
fn decode_header(&mut self) -> Result<DataElementHeader>
Same as Decode::decode_header
over the bound source.
sourcefn decode_item_header(&mut self) -> Result<SequenceItemHeader>
fn decode_item_header(&mut self) -> Result<SequenceItemHeader>
Same as Decode::decode_item_header
over the bound source.
sourcefn read_value(&mut self, header: &DataElementHeader) -> Result<PrimitiveValue>
fn read_value(&mut self, 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
. Read more
sourcefn read_value_preserved(
&mut self,
header: &DataElementHeader
) -> Result<PrimitiveValue>
fn read_value_preserved(
&mut self,
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. Read more
sourcefn read_value_bytes(
&mut self,
header: &DataElementHeader
) -> Result<PrimitiveValue>
fn read_value_bytes(
&mut self,
header: &DataElementHeader
) -> Result<PrimitiveValue>
Eagerly read the following data in the source as a primitive data value as bytes, regardless of its value representation. Read more
sourcefn position(&self) -> u64
fn position(&self) -> u64
Retrieve the known position of the inner reader source. If the stateful decoder was constructed at the beginning of the reader, this equals to the number of bytes read so far. Read more
sourcefn 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<()>
Read the following number of bytes into a vector.
sourcefn 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<()>
Read the following number of bytes as a sequence of unsigned 32 bit integers into a vector. Read more
sourcefn read_to<W>(&mut self, length: u32, out: W) -> Result<()> where
Self: Sized,
W: Write,
fn read_to<W>(&mut self, length: u32, out: W) -> Result<()> where
Self: Sized,
W: Write,
Read the following number of bytes into a generic writer.
Auto Trait Implementations
impl<D, S, BD, TC> RefUnwindSafe for StatefulDecoder<D, S, BD, TC> where
BD: RefUnwindSafe,
D: RefUnwindSafe,
S: RefUnwindSafe,
TC: RefUnwindSafe,
impl<D, S, BD, TC> Send for StatefulDecoder<D, S, BD, TC> where
BD: Send,
D: Send,
S: Send,
TC: Send,
impl<D, S, BD, TC> Sync for StatefulDecoder<D, S, BD, TC> where
BD: Sync,
D: Sync,
S: Sync,
TC: Sync,
impl<D, S, BD, TC> Unpin for StatefulDecoder<D, S, BD, TC> where
BD: Unpin,
D: Unpin,
S: Unpin,
TC: Unpin,
impl<D, S, BD, TC> UnwindSafe for StatefulDecoder<D, S, BD, TC> where
BD: UnwindSafe,
D: UnwindSafe,
S: UnwindSafe,
TC: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more