pub struct DataElement<I = EmptyObject, P = [u8; 0]> { /* private fields */ }
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

Create an empty data element.

Retrieve the element header.

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

Retrieve the data value.

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 clean string, with no trailing whitespace.

Returns an error if the value is not primitive.

Retrieve the element’s value as a single raw string, with trailing whitespace kept.

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.

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.

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.

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.

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.

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.

Retrieve the items stored in a sequence value.

Returns None if the value is not a sequence.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. 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).

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).

Retrieve the element’s tag as a (group, element) tuple.

Check whether this is the header of an item.

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.

Retrieve the element’s tag as a (group, element) tuple.

Check whether this is the header of an item.

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

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.