Struct dicom_core::header::DataElement[][src]

pub struct DataElement<I = EmptyObject, P = [u8; 0]> { /* fields omitted */ }

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

impl<I, P> DataElement<I, P>[src]

pub fn empty(tag: Tag, vr: VR) -> Self[src]

Create an empty data element.

pub fn header(&self) -> &DataElementHeader[src]

Retrieve the element header.

pub fn vr(&self) -> VR[src]

Retrieve the value representation, which may be unknown or not applicable.

pub fn value(&self) -> &Value<I, P>[src]

Retrieve the data value.

pub fn into_value(self) -> Value<I, P>[src]

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.

impl<I, P> DataElement<I, P> where
    I: HasLength
[src]

pub fn new<T>(tag: Tag, vr: VR, value: T) -> Self where
    T: Into<Value<I, P>>, 
[src]

Create a primitive data element from the given parts.

This method will not check whether the value representation is compatible with the given value.

pub fn to_str(&self) -> Result<Cow<'_, str>, CastValueError>[src]

Retrieve the element’s value as a single string.

pub fn to_clean_str(&self) -> Result<Cow<'_, str>, CastValueError>[src]

Retrieves the element’s value as a clean string

pub fn to_bytes(&self) -> Result<Cow<'_, [u8]>, CastValueError>[src]

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.

pub fn to_multi_str(&self) -> Result<Cow<'_, [String]>, CastValueError>[src]

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>, 
[src]

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>, 
[src]

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.

pub fn to_float32(&self) -> Result<f32, ConvertValueError>[src]

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.

pub fn to_multi_float32(&self) -> Result<Vec<f32>, ConvertValueError>[src]

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.

pub fn to_float64(&self) -> Result<f64, ConvertValueError>[src]

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.

pub fn to_multi_float64(&self) -> Result<Vec<f64>, ConvertValueError>[src]

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.

pub fn to_date(&self) -> Result<NaiveDate, ConvertValueError>[src]

Retrieve and convert the primitive value into a date.

If the value is a primitive, it will be converted into a NaiveDate as described in PrimitiveValue::to_date.

Returns an error if the value is not primitive.

pub fn to_multi_date(&self) -> Result<Vec<NaiveDate>, ConvertValueError>[src]

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 NaiveDate as described in PrimitiveValue::to_multi_date.

Returns an error if the value is not primitive.

pub fn to_time(&self) -> Result<NaiveTime, ConvertValueError>[src]

Retrieve and convert the primitive value into a time.

If the value is a primitive, it will be converted into a NaiveTime as described in PrimitiveValue::to_time.

Returns an error if the value is not primitive.

pub fn to_multi_time(&self) -> Result<Vec<NaiveTime>, ConvertValueError>[src]

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 NaiveTime 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<DateTime<FixedOffset>, ConvertValueError>
[src]

Retrieve and convert the primitive value into a date-time.

If the value is a primitive, it will be converted into a DateTime 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<DateTime<FixedOffset>>, ConvertValueError>
[src]

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 DateTime as described in PrimitiveValue::to_multi_datetime.

Returns an error if the value is not primitive.

impl<I, P> DataElement<I, P>[src]

pub fn string(&self) -> Result<&str, CastValueError>[src]

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.

pub fn strings(&self) -> Result<&[String], CastValueError>[src]

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.

pub fn date(&self) -> Result<NaiveDate, CastValueError>[src]

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.

pub fn dates(&self) -> Result<&[NaiveDate], CastValueError>[src]

Get a sequence of values of the requested type without copying.

An error is returned if the variant is not compatible.

pub fn time(&self) -> Result<NaiveTime, CastValueError>[src]

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.

pub fn times(&self) -> Result<&[NaiveTime], CastValueError>[src]

Get a sequence of values of the requested type without copying.

An error is returned if the variant is not compatible.

pub fn datetime(&self) -> Result<DateTime<FixedOffset>, CastValueError>[src]

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.

pub fn datetimes(&self) -> Result<&[DateTime<FixedOffset>], CastValueError>[src]

Get a sequence of values of the requested type without copying.

An error is returned if the variant is not compatible.

pub fn uint8(&self) -> Result<u8, CastValueError>[src]

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.

pub fn uint8_slice(&self) -> Result<&[u8], CastValueError>[src]

Get a sequence of values of the requested type without copying.

An error is returned if the variant is not compatible.

pub fn uint16(&self) -> Result<u16, CastValueError>[src]

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.

pub fn uint16_slice(&self) -> Result<&[u16], CastValueError>[src]

Get a sequence of values of the requested type without copying.

An error is returned if the variant is not compatible.

pub fn int16(&self) -> Result<i16, CastValueError>[src]

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.

pub fn int16_slice(&self) -> Result<&[i16], CastValueError>[src]

Get a sequence of values of the requested type without copying.

An error is returned if the variant is not compatible.

pub fn uint32(&self) -> Result<u32, CastValueError>[src]

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.

pub fn uint32_slice(&self) -> Result<&[u32], CastValueError>[src]

Get a sequence of values of the requested type without copying.

An error is returned if the variant is not compatible.

pub fn int32(&self) -> Result<i32, CastValueError>[src]

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.

pub fn int32_slice(&self) -> Result<&[i32], CastValueError>[src]

Get a sequence of values of the requested type without copying.

An error is returned if the variant is not compatible.

pub fn int64(&self) -> Result<i64, CastValueError>[src]

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.

pub fn int64_slice(&self) -> Result<&[i64], CastValueError>[src]

Get a sequence of values of the requested type without copying.

An error is returned if the variant is not compatible.

pub fn uint64(&self) -> Result<u64, CastValueError>[src]

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.

pub fn uint64_slice(&self) -> Result<&[u64], CastValueError>[src]

Get a sequence of values of the requested type without copying.

An error is returned if the variant is not compatible.

pub fn float32(&self) -> Result<f32, CastValueError>[src]

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.

pub fn float32_slice(&self) -> Result<&[f32], CastValueError>[src]

Get a sequence of values of the requested type without copying.

An error is returned if the variant is not compatible.

pub fn float64(&self) -> Result<f64, CastValueError>[src]

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.

pub fn float64_slice(&self) -> Result<&[f64], CastValueError>[src]

Get a sequence of values of the requested type without copying.

An error is returned if the variant is not compatible.

Trait Implementations

impl<I: Clone, P: Clone> Clone for DataElement<I, P>[src]

impl<I: Debug, P: Debug> Debug for DataElement<I, P>[src]

impl<I, P> From<PrimitiveDataElement> for DataElement<I, P>[src]

impl<I, P> HasLength for DataElement<I, P>[src]

impl<I, P> HasLength for &DataElement<I, P>[src]

impl<I, P> Header for DataElement<I, P>[src]

impl<'a, I, P> Header for &'a DataElement<I, P>[src]

impl<I: PartialEq, P: PartialEq> PartialEq<DataElement<I, P>> for DataElement<I, P>[src]

impl<I, P> StructuralPartialEq for DataElement<I, P>[src]

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: RefUnwindSafe + UnwindSafe,
    P: RefUnwindSafe + UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.