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

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

Fields

items: C<I>

Item collection.

size: Length

The size in bytes (length).

A complex sequence of items.

PixelSequence

Fields

offset_table: C<u32>

The value contents of the offset table.

fragments: C<P>

The sequence of compressed fragments.

An encapsulated pixel data sequence.

Implementations

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.

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

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.

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.

Gets a reference to the primitive value.

Gets a reference to the items.

Retrieves the primitive value.

Retrieves the items.

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

Convert the full primitive value into a clean string.

The value is converted into a strings as described in PrimitiveValue::to_str. If the value contains multiple strings, they are trimmed at the end and concatenated (separated by the standard DICOM value delimiter '\\') into an owned string.

Returns an error if the value is not primitive.

Convert the full primitive value into a single raw string, with trailing whitespace kept.

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.

👎 Deprecated:

to_clean_str() is now deprecated in favour of using to_str() directly. to_raw_str() replaces the old functionality of to_str() and maintains all trailing whitespace.

Convert the full primitive value into a clean string.

Returns an error if the value is not primitive.

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.

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.

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.

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.

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.

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.

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.

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.

Retrieve and convert the primitive value into a DicomDate.

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

Retrieve and convert the primitive value into a sequence of DicomDates.

If the value is a primitive, it will be converted into a vector of DicomDate as described in PrimitiveValue::to_multi_date.

Retrieve and convert the primitive value into a DicomTime.

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

Retrieve and convert the primitive value into a sequence of DicomTimes.

If the value is a primitive, it will be converted into a vector of DicomTime as described in PrimitiveValue::to_multi_time.

Retrieve and convert the primitive value into a DicomDateTime.

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

Retrieve and convert the primitive value into a sequence of DicomDateTimes.

If the value is a primitive, it will be converted into a vector of DicomDateTime as described in PrimitiveValue::to_multi_datetime.

Retrieve and convert the primitive value into a DateRange.

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

Retrieve and convert the primitive value into a TimeRange.

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

Retrieve and convert the primitive value into a DateTimeRange.

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

Retrieves the primitive value as a DICOM tag.

Retrieves the primitive value as a PersonName.

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.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Retrieve the specific type of this value.

Retrieve the number of elements contained in the DICOM value. Read more

Converts to this type from the input type.

Retrieve the value data’s length as specified by the data element or item, in bytes. Read more

Check whether the value is empty (0 length).

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.