pub trait PixelDataWriter {
// Required method
fn encode_frame(
&self,
src: &dyn PixelDataObject,
frame: u32,
options: EncodeOptions,
dst: &mut Vec<u8>,
) -> EncodeResult<Vec<AttributeOp>>;
// Provided method
fn encode(
&self,
src: &dyn PixelDataObject,
options: EncodeOptions,
dst: &mut Vec<Vec<u8>>,
offset_table: &mut Vec<u32>,
) -> EncodeResult<Vec<AttributeOp>> { ... }
}
Expand description
Trait object responsible for encoding pixel data based on a certain transfer syntax.
A transfer syntax with support for creating compressed pixel data would implement these methods.
Required Methods§
Sourcefn encode_frame(
&self,
src: &dyn PixelDataObject,
frame: u32,
options: EncodeOptions,
dst: &mut Vec<u8>,
) -> EncodeResult<Vec<AttributeOp>>
fn encode_frame( &self, src: &dyn PixelDataObject, frame: u32, options: EncodeOptions, dst: &mut Vec<u8>, ) -> EncodeResult<Vec<AttributeOp>>
Encode a single frame of a DICOM object’s image into the format supported by this adapter, by writing a byte stream of pixel data values into the given destination. The bytes written comprise a single pixel data fragment in its entirety.
New data is appended to dst
,
keeping all bytes previously present before writing.
All implementations are required to support
writing the object’s pixel data when it is in a native encoding.
If the given pixel data object is not in a native encoding,
and this writer does not support transcoding
from that encoding to the target transfer syntax,
a NotNative
error is returned instead.
When the operation is successful, a listing of attribute changes is returned, comprising the sequence of operations that the DICOM object should consider upon assuming the new encoding.
Provided Methods§
Sourcefn encode(
&self,
src: &dyn PixelDataObject,
options: EncodeOptions,
dst: &mut Vec<Vec<u8>>,
offset_table: &mut Vec<u32>,
) -> EncodeResult<Vec<AttributeOp>>
fn encode( &self, src: &dyn PixelDataObject, options: EncodeOptions, dst: &mut Vec<Vec<u8>>, offset_table: &mut Vec<u32>, ) -> EncodeResult<Vec<AttributeOp>>
Encode a DICOM object’s image into the format supported by this adapter,
writing a byte stream of pixel data fragment values
to the given vector dst
and the offsets to each decoded frame into offset_table
.
New data is appended to dst
and offset_table
,
which are not cleared before writing.
All implementations are required to support
writing the object’s pixel data when it is in a native encoding.
If the given pixel data object is not in a native encoding,
and this writer does not support transcoding
from that encoding to the target transfer syntax,
a NotNative
error is returned instead.
When the operation is successful, a listing of attribute changes is returned, comprising the sequence of operations that the DICOM object should consider upon assuming the new encoding.