Enum dicom_core::value::Value[][src]

pub enum Value<I = EmptyObject, P = [u8; 0]> {
    Primitive(PrimitiveValue),
    Sequence {
        items: C<I>,
        size: Length,
    },
    PixelSequence {
        offset_table: C<u8>,
        fragments: C<P>,
    },
}

Representation of a full DICOM value, which may be either primitive or another DICOM object.

I is the complex type for nest data set items, which should usually implement HasLength. P is the encapsulated pixel data provider, which should usually implement AsRef<[u8]>.

Variants

Primitive(PrimitiveValue)

Primitive value.

Sequence

A complex sequence of items.

Show fields

Fields of Sequence

items: C<I>

Item collection.

size: Length

The size in bytes (length).

PixelSequence

An encapsulated pixel data sequence.

Show fields

Fields of PixelSequence

offset_table: C<u8>

The value contents of the offset table.

fragments: C<P>

The sequence of compressed fragments.

Implementations

impl<P> Value<EmptyObject, P>[src]

pub fn new_pixel_sequence<T>(offset_table: C<u8>, fragments: T) -> Self where
    T: Into<C<P>>, 
[src]

Construct a DICOM pixel sequence sequence value from an offset rable and a list of fragments.

Note: This function does not validate the offset table against the fragments.

impl<I> Value<I, [u8; 0]>[src]

pub fn new_sequence<T>(items: T, length: Length) -> Self where
    T: Into<C<I>>, 
[src]

Construct a full DICOM data set sequence value from a list of items and length.

impl Value<EmptyObject, [u8; 0]>[src]

pub fn new(value: PrimitiveValue) -> Self[src]

Construct a DICOM value from a primitive value.

This is equivalent to Value::from in behavior, except that suitable type parameters are specified instead of inferred.

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

pub fn multiplicity(&self) -> u32[src]

Obtain the number of individual values. In a primitive, this is the number of individual elements in the value. In a sequence item, this is the number of items. In a pixel sequence, this is currently set to 1 regardless of the number of compressed fragments or frames.

pub fn primitive(&self) -> Option<&PrimitiveValue>[src]

Gets a reference to the primitive value.

pub fn items(&self) -> Option<&[I]>[src]

Gets a reference to the items.

pub fn into_primitive(self) -> Option<PrimitiveValue>[src]

Retrieves the primitive value.

pub fn into_items(self) -> Option<C<I>>[src]

Retrieves the items.

pub fn offset_table(&self) -> Option<&[u8]>[src]

Gets a reference to the encapsulated pixel data’s offset table.

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

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

Convert the full primitive value into a single string.

If the value contains multiple strings, they are concatenated (separated by the standard DICOM value delimiter '\\') into an owned string.

Returns an error if the value is not primitive.

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

Convert the full primitive value into a clean string.

Returns an error if the value is not primitive.

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

Convert the full primitive value 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_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 as_u8(&self) -> Result<&[u8], CastValueError>[src]

👎 Deprecated:

use uint8_slice instead

Retrieves the primitive value as a sequence of unsigned bytes without conversions.

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

👎 Deprecated:

use int32_slice instead

Retrieves the primitive value as a sequence of signed 32-bit integers without conversions.

pub fn to_int<T>(&self) -> Result<T, ConvertValueError> where
    T: Clone,
    T: NumCast,
    T: FromStr<Err = ParseIntError>, 
[src]

Retrieve and convert the primitive value into an integer.

If the value is a primitive, it will be converted into an integer as described in PrimitiveValue::to_int.

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 primitive value 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 primitive value 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.

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

Retrieve and convert the primitive value 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.

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

Retrieve and convert the primitive value 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.

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

Retrieve and convert the primitive value 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.

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.

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.

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.

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.

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.

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.

pub fn to_tag(&self) -> Result<Tag, CastValueError>[src]

Retrieves the primitive value as a DICOM tag.

pub fn as_tags(&self) -> Result<&[Tag], CastValueError>[src]

👎 Deprecated:

use tags instead

Retrieves the primitive value as a sequence of DICOM tags.

impl<I, P> Value<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 tag(&self) -> Result<Tag, 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 tags(&self) -> Result<&[Tag], 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 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 Value<I, P>[src]

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

impl<I, P> DicomValueType for Value<I, P>[src]

impl<I, P> From<PrimitiveValue> for Value<I, P>[src]

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

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

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

Auto Trait Implementations

impl<I, P> RefUnwindSafe for Value<I, P> where
    I: RefUnwindSafe,
    P: RefUnwindSafe

impl<I, P> Send for Value<I, P> where
    I: Send,
    P: Send

impl<I, P> Sync for Value<I, P> where
    I: Sync,
    P: Sync

impl<I, P> Unpin for Value<I, P> where
    I: Unpin,
    P: Unpin

impl<I, P> UnwindSafe for Value<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.