pub trait PixelDataObject {
// Required methods
fn transfer_syntax_uid(&self) -> &str;
fn rows(&self) -> Option<u16>;
fn cols(&self) -> Option<u16>;
fn samples_per_pixel(&self) -> Option<u16>;
fn bits_allocated(&self) -> Option<u16>;
fn bits_stored(&self) -> Option<u16>;
fn photometric_interpretation(&self) -> Option<&str>;
fn number_of_frames(&self) -> Option<u32>;
fn number_of_fragments(&self) -> Option<u32>;
fn fragment(&self, fragment: usize) -> Option<Cow<'_, [u8]>>;
fn offset_table(&self) -> Option<Cow<'_, [u32]>>;
fn raw_pixel_data(&self) -> Option<RawPixelData>;
}
Expand description
A DICOM object trait to be interpreted as pixel data.
This trait extends the concept of DICOM object
as defined in dicom_object
,
in order to retrieve important pieces of the object
for pixel data decoding into images or multi-dimensional arrays.
It is defined in this crate so that
transfer syntax implementers only have to depend on dicom_encoding
.
Required Methods§
Sourcefn transfer_syntax_uid(&self) -> &str
fn transfer_syntax_uid(&self) -> &str
Return the object’s transfer syntax UID.
Sourcefn samples_per_pixel(&self) -> Option<u16>
fn samples_per_pixel(&self) -> Option<u16>
Return the Samples Per Pixel, or None
if it is not found
Sourcefn bits_allocated(&self) -> Option<u16>
fn bits_allocated(&self) -> Option<u16>
Return the Bits Allocated, or None
if it is not defined
Sourcefn bits_stored(&self) -> Option<u16>
fn bits_stored(&self) -> Option<u16>
Return the Bits Stored, or None
if it is not defined
Sourcefn photometric_interpretation(&self) -> Option<&str>
fn photometric_interpretation(&self) -> Option<&str>
Return the Photometric Interpretation,
with trailing whitespace removed,
or None
if it is not defined
Sourcefn number_of_frames(&self) -> Option<u32>
fn number_of_frames(&self) -> Option<u32>
Return the Number Of Frames, or None
if it is not defined
Sourcefn number_of_fragments(&self) -> Option<u32>
fn number_of_fragments(&self) -> Option<u32>
Returns the Number of Fragments, or None
for native pixel data
Sourcefn fragment(&self, fragment: usize) -> Option<Cow<'_, [u8]>>
fn fragment(&self, fragment: usize) -> Option<Cow<'_, [u8]>>
Return a specific encoded pixel fragment by index
(where 0 is the first fragment after the basic offset table)
as a Cow<[u8]>
,
or None
if no such fragment is available.
In the case of native (non-encapsulated) pixel data, the whole data may be obtained by requesting fragment number 0.
Sourcefn offset_table(&self) -> Option<Cow<'_, [u32]>>
fn offset_table(&self) -> Option<Cow<'_, [u32]>>
Return the object’s offset table,
or None
if no offset table is available.
Sourcefn raw_pixel_data(&self) -> Option<RawPixelData>
fn raw_pixel_data(&self) -> Option<RawPixelData>
Should return either a byte slice/vector if the pixel data is native or the list of byte fragments and offset table if encapsulated.
Returns None
if no pixel data is found.