pub struct RleCodec;Expand description
DICOM RLE Lossless codec with DICOM-spec-compliant byte-plane ordering (PS3.5 §G).
For multi-byte samples the most-significant byte occupies the
lower-numbered segment (segment 0 = MSBs, segment 1 = LSBs).
This matches what DCMTK’s dcmdrle/dcmcrle tools produce and
what DICOM peers expect.
Supported configurations ─────────────────────────
bits_allocated | samples | segments |
|---|---|---|
| 8 | 1 | 1 |
| 16 | 1 | 2 |
| 8 | 3 | 3 |
| 16 | 3 | 6 |
Implementations§
Source§impl RleCodec
impl RleCodec
Sourcepub fn decode(
data: &[u8],
rows: u16,
cols: u16,
bits_allocated: u16,
samples: u16,
) -> DcmResult<Vec<u8>>
pub fn decode( data: &[u8], rows: u16, cols: u16, bits_allocated: u16, samples: u16, ) -> DcmResult<Vec<u8>>
Decode an RLE-compressed DICOM fragment into raw little-endian pixel bytes.
data must be the complete fragment payload, starting with the 64-byte
RLE segment-offset header.
Sourcepub fn encode(
data: &[u8],
rows: u16,
cols: u16,
bits_allocated: u16,
samples: u16,
) -> DcmResult<Vec<u8>>
pub fn encode( data: &[u8], rows: u16, cols: u16, bits_allocated: u16, samples: u16, ) -> DcmResult<Vec<u8>>
Encode raw little-endian pixel bytes into a DICOM RLE fragment.
The returned buffer includes the 64-byte segment-offset header and all compressed segments. Its length is always even (DICOM requirement).
Auto Trait Implementations§
impl Freeze for RleCodec
impl RefUnwindSafe for RleCodec
impl Send for RleCodec
impl Sync for RleCodec
impl Unpin for RleCodec
impl UnsafeUnpin for RleCodec
impl UnwindSafe for RleCodec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more