Trait dicom_encoding::adapters::PixelDataReader
source · pub trait PixelDataReader {
// Required method
fn decode_frame(
&self,
src: &dyn PixelDataObject,
frame: u32,
dst: &mut Vec<u8>
) -> DecodeResult<()>;
// Provided method
fn decode(
&self,
src: &dyn PixelDataObject,
dst: &mut Vec<u8>
) -> DecodeResult<()> { ... }
}
Expand description
Trait object responsible for decoding pixel data based on the transfer syntax.
A transfer syntax with support for decoding encapsulated pixel data would implement these methods.
Required Methods§
sourcefn decode_frame(
&self,
src: &dyn PixelDataObject,
frame: u32,
dst: &mut Vec<u8>
) -> DecodeResult<()>
fn decode_frame( &self, src: &dyn PixelDataObject, frame: u32, dst: &mut Vec<u8> ) -> DecodeResult<()>
Decode the given DICOM object
containing encapsulated pixel data
into native pixel data of a single frame
as a byte stream in little endian,
appending these bytes to the given vector dst
.
It is a necessary precondition that the object’s pixel data
is encoded in accordance to the transfer syntax(es)
supported by this adapter.
A NotEncapsulated
error is returned otherwise.
The output is a sequence of native pixel values of a frame
which follow the image properties of the given object
save for the photometric interpretation and planar configuration.
The output of an image with 1 sample per pixel
is expected to be interpreted as MONOCHROME2
,
and for 3-channel images,
the output must be in RGB with each pixel contiguous in memory
(planar configuration of 0).
Provided Methods§
sourcefn decode(
&self,
src: &dyn PixelDataObject,
dst: &mut Vec<u8>
) -> DecodeResult<()>
fn decode( &self, src: &dyn PixelDataObject, dst: &mut Vec<u8> ) -> DecodeResult<()>
Decode the given DICOM object
containing encapsulated pixel data
into native pixel data as a byte stream in little endian,
appending these bytes to the given vector dst
.
It is a necessary precondition that the object’s pixel data
is encoded in accordance to the transfer syntax(es)
supported by this adapter.
A NotEncapsulated
error is returned otherwise.
The output is a sequence of native pixel values
which follow the image properties of the given object
save for the photometric interpretation and planar configuration.
The output of an image with 1 sample per pixel
is expected to be interpreted as MONOCHROME2
,
and for 3-channel images,
the output must be in RGB with each pixel contiguous in memory
(planar configuration of 0).