pub trait DicomAttribute: DicomValueType {
type Item<'a>: HasLength
where Self: 'a;
type PixelData<'a>
where Self: 'a;
// Required methods
fn to_primitive_value(&self) -> Result<PrimitiveValue, AttributeError>;
fn item(&self, index: u32) -> Result<Self::Item<'_>, AttributeError>;
fn num_items(&self) -> Option<u32>;
fn fragment(
&self,
index: u32,
) -> Result<Self::PixelData<'_>, AttributeError>;
// Provided methods
fn num_fragments(&self) -> Option<u32> { ... }
fn to_str(&self) -> Result<Cow<'_, str>, AttributeError> { ... }
fn to_u16(&self) -> Result<u16, AttributeError> { ... }
fn to_i32(&self) -> Result<i32, AttributeError> { ... }
fn to_u32(&self) -> Result<u32, AttributeError> { ... }
fn to_f32(&self) -> Result<f32, AttributeError> { ... }
fn to_f64(&self) -> Result<f64, AttributeError> { ... }
fn to_bytes(&self) -> Result<Cow<'_, [u8]>, AttributeError> { ... }
}Expand description
Interface type for access to a DICOM object’ attribute in a DICOM object.
Accessing an attribute via the DicomObject trait
will generally result in a value of this type,
which can then be converted into a more usable form.
Both DicomValue and references to it implement this trait.
Required Associated Types§
Required Methods§
Sourcefn to_primitive_value(&self) -> Result<PrimitiveValue, AttributeError>
fn to_primitive_value(&self) -> Result<PrimitiveValue, AttributeError>
Obtain an in-memory representation of the primitive value, cloning the value if necessary.
An error is returned if the value is a data set sequence or an encapsulated pixel data fragment sequence.
Sourcefn item(&self, index: u32) -> Result<Self::Item<'_>, AttributeError>
fn item(&self, index: u32) -> Result<Self::Item<'_>, AttributeError>
Obtain one of the items in the attribute, if the attribute value represents a data set sequence.
Returns an error if the attribute is not a sequence.
Provided Methods§
Sourcefn num_fragments(&self) -> Option<u32>
fn num_fragments(&self) -> Option<u32>
Obtain the number of pixel data fragments, if the attribute value represents encapsulated pixel data.
It should equivalent to num_items,
save for returning None if the attribute is a data set sequence.
Sourcefn to_str(&self) -> Result<Cow<'_, str>, AttributeError>
fn to_str(&self) -> Result<Cow<'_, str>, AttributeError>
Obtain the attribute’s value as a string, converting it if necessary.
Sourcefn to_u16(&self) -> Result<u16, AttributeError>
fn to_u16(&self) -> Result<u16, AttributeError>
Obtain the attribute’s value as a 16-bit unsigned integer, converting it if necessary.
Sourcefn to_i32(&self) -> Result<i32, AttributeError>
fn to_i32(&self) -> Result<i32, AttributeError>
Obtain the attribute’s value as a 32-bit signed integer, converting it if necessary.
Sourcefn to_u32(&self) -> Result<u32, AttributeError>
fn to_u32(&self) -> Result<u32, AttributeError>
Obtain the attribute’s value as a 32-bit unsigned integer, converting it if necessary.
Sourcefn to_f32(&self) -> Result<f32, AttributeError>
fn to_f32(&self) -> Result<f32, AttributeError>
Obtain the attribute’s value as a 32-bit floating-point number, converting it if necessary.
Sourcefn to_f64(&self) -> Result<f64, AttributeError>
fn to_f64(&self) -> Result<f64, AttributeError>
Obtain the attribute’s value as a 64-bit floating-point number, converting it if necessary.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.