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§

source

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.

The frame index is 0-based.

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. If the image has 3 samples per pixel, the output must be in RGB with each pixel contiguous in memory (planar configuration of 0). However, if the image is monochrome, the output should retain the photometric interpretation of the source object (so that images in MONOCHROME1 continue to be in MONOCHROME1 and images in MONOCHROME2 continue to be in MONOCHROME2).

Provided Methods§

source

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. If the image has 3 samples per pixel, the output must be in RGB with each pixel contiguous in memory (planar configuration of 0). However, if the image is monochrome, the output should retain the photometric interpretation of the source object (so that images in MONOCHROME1 continue to be in MONOCHROME1 and images in MONOCHROME2 continue to be in MONOCHROME2).

Implementors§