pub trait PixelRWAdapter {
    fn decode(
        &self,
        src: &dyn PixelDataObject,
        dst: &mut Vec<u8>
    ) -> DecodeResult<()>; fn encode(
        &self,
        src: &dyn PixelDataObject,
        options: EncodeOptions,
        dst: &mut Vec<u8>
    ) -> EncodeResult<()> { ... } }
Expand description

Trait object responsible for decoding and encoding pixel data based on the Transfersyntax.

Every transfer syntax with encapsulated pixel data should implement these methods.

Required Methods§

Decode the given DICOM object containing encapsulated pixel data into native pixel data as a byte stream in little endian, resizing the given vector dst to contain exactly these bytes.

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).

Provided Methods§

Encode a DICOM object’s image into the format supported by this adapter, writing a byte stream of pixel data fragment values into the given destination.

It is a necessary precondition that the object’s pixel data is in a native encoding. A NotNative error is returned otherwise.

It is possible that image encoding is not actually supported by this adapter, in which case a NotImplemented error is returned. Implementers leave the default method implementation for this behavior.

Implementors§

Decode TS: 1.2.840.10008.1.2.5 (RLE Lossless)