Struct dicom_object::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.

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.

§

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>

§

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,

§

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,

§

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

§

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

The type of the elements being iterated over.
§

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

§

type Item = <O as IntoIterator>::Item

The type of the elements being iterated over.
§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method 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> 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,

§

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>,

§

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>,

§

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