Skip to main content

PixelDataObject

Trait PixelDataObject 

Source
pub trait PixelDataObject {
Show 13 methods // 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>; // Provided method fn frame_pixel_data(&self, frame: u32) -> Option<Cow<'_, [u8]>> { ... }
}
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§

Source

fn transfer_syntax_uid(&self) -> &str

Return the object’s transfer syntax UID.

Source

fn rows(&self) -> Option<u16>

Return the Rows, or None if it is not found

Source

fn cols(&self) -> Option<u16>

Return the Columns, or None if it is not found

Source

fn samples_per_pixel(&self) -> Option<u16>

Return the Samples Per Pixel, or None if it is not found

Source

fn bits_allocated(&self) -> Option<u16>

Return the Bits Allocated, or None if it is not defined

Source

fn bits_stored(&self) -> Option<u16>

Return the Bits Stored, or None if it is not defined

Source

fn photometric_interpretation(&self) -> Option<&str>

Return the Photometric Interpretation, with trailing whitespace removed, or None if it is not defined

Source

fn number_of_frames(&self) -> Option<u32>

Return the Number Of Frames, or None if it is not defined by this object.

Source

fn number_of_fragments(&self) -> Option<u32>

Returns the number of pixel data fragments, excluding the basic offset table, or None for native pixel data.

Source

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.

Source

fn offset_table(&self) -> Option<Cow<'_, [u32]>>

Return the object’s offset table, or None if no offset table is available.

Source

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.

Provided Methods§

Source

fn frame_pixel_data(&self, frame: u32) -> Option<Cow<'_, [u8]>>

Return the pixel data of a specific frame as a byte slice/vector, in its encoded form.

Returns None if there is no such frame or there is no pixel data at all.

Note: If pixel data is uncompressed and Bits Allocated is 1, the slice may include leading or trailing bits belonging to other frames, depending on the size of each frame.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§