dicom_object

Struct FileDicomObject

Source
pub struct FileDicomObject<O> { /* private fields */ }
Expand description

A root DICOM object retrieved from a standard DICOM file, containing additional information from the file meta group in a separate table value.

Implementations§

Source§

impl FileDicomObject<InMemDicomObject<StandardDataDictionary>>

Source

pub fn open_file<P: AsRef<Path>>(path: P) -> Result<Self, ReadError>

Create a DICOM object by reading from a file.

This function assumes the standard file encoding structure: first it automatically detects whether the 128-byte preamble is present, skipping it if found. Then it reads the file meta group, followed by the rest of the data set.

Source

pub fn from_reader<S>(src: S) -> Result<Self, ReadError>
where S: Read,

Create a DICOM object by reading from a byte source.

This function assumes the standard file encoding structure: first it automatically detects whether the 128-byte preamble is present, skipping it if found. Then it reads the file meta group, followed by the rest of the data set.

Source§

impl<D> FileDicomObject<InMemDicomObject<D>>
where D: DataDictionary + Clone,

Source

pub fn new_empty_with_dict_and_meta(dict: D, meta: FileMetaTable) -> Self

Create a new empty object, using the given dictionary and file meta table.

Source

pub fn open_file_with_dict<P: AsRef<Path>>( path: P, dict: D, ) -> Result<Self, ReadError>

Create a DICOM object by reading from a file.

This function assumes the standard file encoding structure: first it automatically detects whether the 128-byte preamble is present, skipping it when found. Then it reads the file meta group, followed by the rest of the data set.

Source

pub fn open_file_with<P, R>( path: P, dict: D, ts_index: R, ) -> Result<Self, ReadError>

Create a DICOM object by reading from a file.

This function assumes the standard file encoding structure: first it automatically detects whether the 128-byte preamble is present, skipping it when found. Then it reads the file meta group, followed by the rest of the data set.

This function allows you to choose a different transfer syntax index, but its use is only advised when the built-in transfer syntax registry is insufficient. Otherwise, please use open_file_with_dict instead.

Source

pub fn from_reader_with_dict<S>(src: S, dict: D) -> Result<Self, ReadError>
where S: Read,

Create a DICOM object by reading from a byte source.

This function assumes the standard file encoding structure: first it automatically detects whether the 128-byte preamble is present, skipping it when found. Then it reads the file meta group, followed by the rest of the data set.

Source

pub fn from_reader_with<'s, S, R>( src: S, dict: D, ts_index: R, ) -> Result<Self, ReadError>
where S: Read + 's, R: TransferSyntaxIndex,

Create a DICOM object by reading from a byte source.

This function assumes the standard file encoding structure: first it automatically detects whether the preamble is present, skipping it when found. Then it reads the file meta group, followed by the rest of the data set.

This function allows you to choose a different transfer syntax index, but its use is only advised when the built-in transfer syntax registry is insufficient. Otherwise, please use from_reader_with_dict instead.

Source§

impl FileDicomObject<InMemDicomObject<StandardDataDictionary>>

Source

pub fn new_empty_with_meta(meta: FileMetaTable) -> Self

Create a new empty object, using the given file meta table.

Source§

impl<O> FileDicomObject<O>

Source

pub fn meta(&self) -> &FileMetaTable

Retrieve the processed meta header table.

Source

pub fn meta_mut(&mut self) -> &mut FileMetaTable

Retrieve a mutable reference to the processed meta header table.

Considerable care should be taken when modifying this table, as it may influence object reading and writing operations. When modifying the table through this method, the user is responsible for updating the meta information group length as well, which can be done by calling update_information_group_length.

See also update_meta.

Source

pub fn update_meta(&mut self, f: impl FnOnce(&mut FileMetaTable))

Update the processed meta header table through a function.

Considerable care should be taken when modifying this table, as it may influence object reading and writing operations. The meta information group length is updated automatically.

Source

pub fn into_inner(self) -> O

Retrieve the inner DICOM object structure, discarding the meta table.

Source§

impl<O> FileDicomObject<O>
where for<'a> &'a O: IntoTokens,

Source

pub fn write_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), WriteError>

Write the entire object as a DICOM file into the given file path. Preamble, magic code, and file meta group will be included before the inner object.

Source

pub fn write_all<W: Write>(&self, to: W) -> Result<(), WriteError>

Write the entire object as a DICOM file into the given writer. Preamble, magic code, and file meta group will be included before the inner object.

Source

pub fn write_meta<W: Write>(&self, to: W) -> Result<(), WriteError>

Write the file meta group set into the given writer.

This is equivalent to self.meta().write(to).

Source

pub fn write_dataset<W: Write>(&self, to: W) -> Result<(), WriteError>

Write the inner data set into the given writer, without preamble, magic code, nor file meta group.

The transfer syntax is selected from the file meta table.

Trait Implementations§

Source§

impl<T> ApplyOp for FileDicomObject<T>
where T: ApplyOp<Err = ApplyError>,

Source§

fn apply(&mut self, op: AttributeOp) -> ApplyResult

Apply the given attribute operation on this object.

The operation is delegated to the file meta table if the selector root tag is in group 0002, and to the underlying object otherwise.

See the dicom_core::ops module for more information.

Source§

type Err = ApplyError

The operation error type
Source§

impl<O: Clone> Clone for FileDicomObject<O>

Source§

fn clone(&self) -> FileDicomObject<O>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<O: Debug> Debug for FileDicomObject<O>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<O> Deref for FileDicomObject<O>

Source§

type Target = O

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<O> DerefMut for FileDicomObject<O>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<'a, O> DicomObject for &'a FileDicomObject<O>
where O: DicomObject + 'a,

Source§

type Element = <O as DicomObject>::Element

Source§

fn element(&self, tag: Tag) -> Result<Self::Element, AccessError>

Retrieve a particular DICOM element by its tag.
Source§

fn element_by_name( &self, name: &str, ) -> Result<Self::Element, AccessByNameError>

Retrieve a particular DICOM element by its name.
Source§

fn meta(&self) -> Option<&FileMetaTable>

Retrieve the processed meta information table, if available. Read more
Source§

impl<O> DicomObject for FileDicomObject<O>
where O: DicomObject,

Source§

type Element = <O as DicomObject>::Element

Source§

fn element(&self, tag: Tag) -> Result<Self::Element, AccessError>

Retrieve a particular DICOM element by its tag.
Source§

fn element_by_name( &self, name: &str, ) -> Result<Self::Element, AccessByNameError>

Retrieve a particular DICOM element by its name.
Source§

fn meta(&self) -> Option<&FileMetaTable>

Retrieve the processed meta information table, if available. Read more
Source§

impl<'a, O> IntoIterator for &'a FileDicomObject<O>

This implementation creates an iterator to the elements of the underlying data set. The attributes in the file meta group are not included.

To obtain an iterator over the meta elements, use meta().to_element_iter().

Source§

type Item = <&'a O as IntoIterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = <&'a O as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<O> IntoIterator for FileDicomObject<O>
where O: IntoIterator,

This implementation creates an iterator to the elements of the underlying data set, consuming the whole object. The attributes in the file meta group are not included.

To obtain an iterator over the meta elements, use meta().to_element_iter().

Source§

type Item = <O as IntoIterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = <O as IntoIterator>::IntoIter

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<O: PartialEq> PartialEq for FileDicomObject<O>

Source§

fn eq(&self, other: &FileDicomObject<O>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<D> PixelDataObject for FileDicomObject<InMemDicomObject<D>>
where D: DataDictionary + Clone,

Implement basic pixeldata encoder/decoder functionality

Source§

fn rows(&self) -> Option<u16>

Return the Rows attribute or None if it is not found

Source§

fn cols(&self) -> Option<u16>

Return the Columns attribute or None if it is not found

Source§

fn samples_per_pixel(&self) -> Option<u16>

Return the SamplesPerPixel attribute or None if it is not found

Source§

fn bits_allocated(&self) -> Option<u16>

Return the BitsAllocated attribute or None if it is not set

Source§

fn bits_stored(&self) -> Option<u16>

Return the BitsStored attribute or None if it is not set

Source§

fn number_of_frames(&self) -> Option<u32>

Return the NumberOfFrames attribute or None if it is not set

Source§

fn number_of_fragments(&self) -> Option<u32>

Returns the number of fragments or None for native pixel data

Source§

fn fragment(&self, fragment: usize) -> Option<Cow<'_, [u8]>>

Return a specific encoded pixel fragment by index as a Vec<u8> or None if no pixel data is found.

Non-encapsulated pixel data can be retrieved by requesting fragment #0.

Panics if fragment is out of bounds for the encapsulated pixel data fragments.

Source§

fn raw_pixel_data(&self) -> Option<RawPixelData>

Should return either a byte slice/vector if native pixel data or byte fragments if encapsulated. Returns None if no pixel data is found

Source§

fn transfer_syntax_uid(&self) -> &str

Return the object’s transfer syntax UID.
Source§

fn photometric_interpretation(&self) -> Option<&str>

Return the Photometric Interpretation, with trailing whitespace removed, or None if it is not defined
Source§

fn offset_table(&self) -> Option<Cow<'_, [u32]>>

Return the object’s offset table, or None if no offset table is available.
Source§

impl<O> StructuralPartialEq for FileDicomObject<O>

Auto Trait Implementations§

§

impl<O> Freeze for FileDicomObject<O>
where O: Freeze,

§

impl<O> RefUnwindSafe for FileDicomObject<O>
where O: RefUnwindSafe,

§

impl<O> Send for FileDicomObject<O>
where O: Send,

§

impl<O> Sync for FileDicomObject<O>
where O: Sync,

§

impl<O> Unpin for FileDicomObject<O>
where O: Unpin,

§

impl<O> UnwindSafe for FileDicomObject<O>
where O: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more