Struct dicom_core::header::DataElement [−][src]
pub struct DataElement<I = EmptyObject, P = [u8; 0]> { /* fields omitted */ }Expand description
A data type that represents and owns a DICOM data element.
This type is capable of representing any data element fully in memory,
whether it be a primitive value,
a nested data set (where each item contains an object of type I),
or an encapsulated pixel data sequence (each item of type P).
Implementations
Retrieve the element header.
Retrieve the value representation, which may be unknown or not applicable.
Move the data value out of the element, discarding the rest. If the value is a sequence, its lifetime may still be bound to its original source.
Create a primitive data element from the given parts, where the length is inferred from the value’s byte length.
If the value is textual,
the byte length of that value encoded in UTF-8 is assumed.
If you already have a length in this context,
prefer calling new_with_len instead.
This method will not check whether the value representation is compatible with the given value.
Create a primitive data element from the given parts.
This method will not check whether the length accurately represents the given value’s byte length, nor whether the value representation is compatible with the value.
Retrieve the element’s value as a single string.
Retrieves the element’s value as a clean string
Convert the full primitive value into raw bytes.
String values already encoded with the Str and Strs variants
are provided in UTF-8.
Returns an error if the value is not primitive.
Convert the full value of the data element into a sequence of strings.
If the value is a primitive, it will be converted into
a vector of strings as described in PrimitiveValue::to_multi_str.
Returns an error if the value is not primitive.
pub fn to_int<T>(&self) -> Result<T, ConvertValueError> where
T: Clone,
T: NumCast,
T: FromStr<Err = ParseIntError>,
pub fn to_int<T>(&self) -> Result<T, ConvertValueError> where
T: Clone,
T: NumCast,
T: FromStr<Err = ParseIntError>,
Retrieve and convert the value of the data element into an integer.
If the value is a primitive,
it will be converted into an integer
as described in PrimitiveValue::to_int.
Returns an error if the value is not primitive.
pub fn to_multi_int<T>(&self) -> Result<Vec<T>, ConvertValueError> where
T: Clone,
T: NumCast,
T: FromStr<Err = ParseIntError>,
pub fn to_multi_int<T>(&self) -> Result<Vec<T>, ConvertValueError> where
T: Clone,
T: NumCast,
T: FromStr<Err = ParseIntError>,
Retrieve and convert the value of the data element into a sequence of integers.
If the value is a primitive, it will be converted into a vector of integers as described in PrimitiveValue::to_multi_int.
Retrieve and convert the value of the data element into a single-precision floating point number.
If the value is a primitive, it will be converted into
a number as described in PrimitiveValue::to_float32.
Returns an error if the value is not primitive.
Retrieve and convert the value of the data element into a sequence of single-precision floating point numbers.
If the value is a primitive, it will be converted into
a vector of numbers as described in PrimitiveValue::to_multi_float32.
Returns an error if the value is not primitive.
Retrieve and convert the value of the data element into a double-precision floating point number.
If the value is a primitive, it will be converted into
a number as described in PrimitiveValue::to_float64.
Returns an error if the value is not primitive.
Retrieve and convert the value of the data element into a sequence of double-precision floating point numbers.
If the value is a primitive, it will be converted into
a vector of numbers as described in PrimitiveValue::to_multi_float64.
Returns an error if the value is not primitive.
Retrieve and convert the primitive value into a date.
If the value is a primitive, it will be converted into
a DicomDate as described in PrimitiveValue::to_date.
Returns an error if the value is not primitive.
Retrieve and convert the primitive value into a sequence of dates.
If the value is a primitive, it will be converted into
a vector of DicomDate as described in PrimitiveValue::to_multi_date.
Returns an error if the value is not primitive.
Retrieve and convert the primitive value into a time.
If the value is a primitive, it will be converted into
a DicomTime as described in PrimitiveValue::to_time.
Returns an error if the value is not primitive.
Retrieve and convert the primitive value into a sequence of times.
If the value is a primitive, it will be converted into
a vector of DicomTime as described in PrimitiveValue::to_multi_time.
Returns an error if the value is not primitive.
pub fn to_datetime(
&self,
default_offset: FixedOffset
) -> Result<DicomDateTime, ConvertValueError>
pub fn to_datetime(
&self,
default_offset: FixedOffset
) -> Result<DicomDateTime, ConvertValueError>
Retrieve and convert the primitive value into a date-time.
If the value is a primitive, it will be converted into
a DicomDateTime as described in PrimitiveValue::to_datetime.
Returns an error if the value is not primitive.
pub fn to_multi_datetime(
&self,
default_offset: FixedOffset
) -> Result<Vec<DicomDateTime>, ConvertValueError>
pub fn to_multi_datetime(
&self,
default_offset: FixedOffset
) -> Result<Vec<DicomDateTime>, ConvertValueError>
Retrieve and convert the primitive value into a sequence of date-times.
If the value is a primitive, it will be converted into
a vector of DicomDateTime as described in PrimitiveValue::to_multi_datetime.
Returns an error if the value is not primitive.
Get a single string value.
If it contains multiple strings, only the first one is returned.
An error is returned if the variant is not compatible.
To enable conversions of other variants to a textual representation,
see to_str() instead.
Get the inner sequence of string values
if the variant is either Str or Strs.
An error is returned if the variant is not compatible.
To enable conversions of other variants to a textual representation,
see to_str() instead.
Get a single value of the requested type.
If it contains multiple values, only the first one is returned. An error is returned if the variant is not compatible.
Get a sequence of values of the requested type without copying.
An error is returned if the variant is not compatible.
Get a single value of the requested type.
If it contains multiple values, only the first one is returned. An error is returned if the variant is not compatible.
Get a sequence of values of the requested type without copying.
An error is returned if the variant is not compatible.
Get a single value of the requested type.
If it contains multiple values, only the first one is returned. An error is returned if the variant is not compatible.
Get a sequence of values of the requested type without copying.
An error is returned if the variant is not compatible.
Get a single value of the requested type.
If it contains multiple values, only the first one is returned. An error is returned if the variant is not compatible.
Get a sequence of values of the requested type without copying.
An error is returned if the variant is not compatible.
Get a single value of the requested type.
If it contains multiple values, only the first one is returned. An error is returned if the variant is not compatible.
Get a sequence of values of the requested type without copying.
An error is returned if the variant is not compatible.
Get a single value of the requested type.
If it contains multiple values, only the first one is returned. An error is returned if the variant is not compatible.
Get a sequence of values of the requested type without copying.
An error is returned if the variant is not compatible.
Get a single value of the requested type.
If it contains multiple values, only the first one is returned. An error is returned if the variant is not compatible.
Get a sequence of values of the requested type without copying.
An error is returned if the variant is not compatible.
Get a single value of the requested type.
If it contains multiple values, only the first one is returned. An error is returned if the variant is not compatible.
Get a sequence of values of the requested type without copying.
An error is returned if the variant is not compatible.
Get a single value of the requested type.
If it contains multiple values, only the first one is returned. An error is returned if the variant is not compatible.
Get a sequence of values of the requested type without copying.
An error is returned if the variant is not compatible.
Get a single value of the requested type.
If it contains multiple values, only the first one is returned. An error is returned if the variant is not compatible.
Get a sequence of values of the requested type without copying.
An error is returned if the variant is not compatible.
Get a single value of the requested type.
If it contains multiple values, only the first one is returned. An error is returned if the variant is not compatible.
Get a sequence of values of the requested type without copying.
An error is returned if the variant is not compatible.
Get a single value of the requested type.
If it contains multiple values, only the first one is returned. An error is returned if the variant is not compatible.
Get a sequence of values of the requested type without copying.
An error is returned if the variant is not compatible.
Trait Implementations
Performs the conversion.
Check whether this is the header of an item delimiter.
Check whether this is the header of a sequence delimiter.
Check whether this is the header of an encapsulated pixel data.
Check whether this is the header of an item delimiter.
Check whether this is the header of a sequence delimiter.
Check whether this is the header of an encapsulated pixel data.
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
Auto Trait Implementations
impl<I, P> RefUnwindSafe for DataElement<I, P> where
I: RefUnwindSafe,
P: RefUnwindSafe,
impl<I, P> Send for DataElement<I, P> where
I: Send,
P: Send,
impl<I, P> Sync for DataElement<I, P> where
I: Sync,
P: Sync,
impl<I, P> Unpin for DataElement<I, P> where
I: Unpin,
P: Unpin,
impl<I, P> UnwindSafe for DataElement<I, P> where
I: UnwindSafe + RefUnwindSafe,
P: UnwindSafe + RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more