Skip to main content

ImageCodec

Trait ImageCodec 

Source
pub trait ImageCodec: Send + Sync {
    // Required methods
    fn transfer_syntax_uids(&self) -> &[&str];
    fn decode(
        &self,
        encapsulated: &PixelData,
        rows: u16,
        columns: u16,
        samples_per_pixel: u8,
        bits_allocated: u8,
    ) -> DcmResult<Vec<u8>>;
    fn encode(
        &self,
        pixels: &[u8],
        rows: u16,
        columns: u16,
        samples_per_pixel: u8,
        bits_allocated: u8,
        bits_stored: u8,
    ) -> DcmResult<PixelData>;

    // Provided methods
    fn decode_transfer_syntax_uids(&self) -> &[&str] { ... }
    fn encode_transfer_syntax_uids(&self) -> &[&str] { ... }
}
Expand description

Trait for DICOM image codecs.

Each codec handles one or more transfer syntaxes. The codec is responsible for decompressing/compressing pixel data items.

Required Methods§

Source

fn transfer_syntax_uids(&self) -> &[&str]

UID(s) of the transfer syntax(es) this codec handles.

Source

fn decode( &self, encapsulated: &PixelData, rows: u16, columns: u16, samples_per_pixel: u8, bits_allocated: u8, ) -> DcmResult<Vec<u8>>

Decode all frames in encapsulated pixel data.

Returns the raw, uncompressed pixel bytes for all frames concatenated.

Source

fn encode( &self, pixels: &[u8], rows: u16, columns: u16, samples_per_pixel: u8, bits_allocated: u8, bits_stored: u8, ) -> DcmResult<PixelData>

Encode raw pixel bytes into an encapsulated PixelData.

bits_allocated describes the native storage width of pixels. bits_stored is the actual sample precision to encode into the compressed stream and must be <= bits_allocated.

Provided Methods§

Source

fn decode_transfer_syntax_uids(&self) -> &[&str]

UID(s) of the transfer syntax(es) this codec can decode.

Source

fn encode_transfer_syntax_uids(&self) -> &[&str]

UID(s) of the transfer syntax(es) this codec can encode.

Implementors§