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>>
impl FileDicomObject<InMemDicomObject<StandardDataDictionary>>
Sourcepub fn open_file<P: AsRef<Path>>(path: P) -> Result<Self, ReadError>
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.
Sourcepub fn from_reader<S>(src: S) -> Result<Self, ReadError>where
S: Read,
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,
impl<D> FileDicomObject<InMemDicomObject<D>>where
D: DataDictionary + Clone,
Sourcepub fn new_empty_with_dict_and_meta(dict: D, meta: FileMetaTable) -> Self
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.
Sourcepub fn open_file_with_dict<P: AsRef<Path>>(
path: P,
dict: D,
) -> Result<Self, ReadError>
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.
Sourcepub fn open_file_with<P, R>(
path: P,
dict: D,
ts_index: R,
) -> Result<Self, ReadError>
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.
Sourcepub fn from_reader_with_dict<S>(src: S, dict: D) -> Result<Self, ReadError>where
S: Read,
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.
Sourcepub fn from_reader_with<'s, S, R>(
src: S,
dict: D,
ts_index: R,
) -> Result<Self, ReadError>where
S: Read + 's,
R: TransferSyntaxIndex,
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>>
impl FileDicomObject<InMemDicomObject<StandardDataDictionary>>
Sourcepub fn new_empty_with_meta(meta: FileMetaTable) -> Self
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>
impl<O> FileDicomObject<O>
Sourcepub fn meta(&self) -> &FileMetaTable
pub fn meta(&self) -> &FileMetaTable
Retrieve the processed meta header table.
Sourcepub fn meta_mut(&mut self) -> &mut FileMetaTable
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
.
Sourcepub fn update_meta(&mut self, f: impl FnOnce(&mut FileMetaTable))
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.
Sourcepub fn into_inner(self) -> O
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,
impl<O> FileDicomObject<O>where
for<'a> &'a O: IntoTokens,
Sourcepub fn write_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), WriteError>
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.
Sourcepub fn write_all<W: Write>(&self, to: W) -> Result<(), WriteError>
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.
Sourcepub fn write_meta<W: Write>(&self, to: W) -> Result<(), WriteError>
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)
.
Sourcepub fn write_dataset<W: Write>(&self, to: W) -> Result<(), WriteError>
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>,
impl<T> ApplyOp for FileDicomObject<T>where
T: ApplyOp<Err = ApplyError>,
Source§fn apply(&mut self, op: AttributeOp) -> ApplyResult
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
type Err = ApplyError
Source§impl<O: Clone> Clone for FileDicomObject<O>
impl<O: Clone> Clone for FileDicomObject<O>
Source§fn clone(&self) -> FileDicomObject<O>
fn clone(&self) -> FileDicomObject<O>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<O: Debug> Debug for FileDicomObject<O>
impl<O: Debug> Debug for FileDicomObject<O>
Source§impl<O> Deref for FileDicomObject<O>
impl<O> Deref for FileDicomObject<O>
Source§impl<O> DerefMut for FileDicomObject<O>
impl<O> DerefMut for FileDicomObject<O>
Source§impl<'a, O> DicomObject for &'a FileDicomObject<O>where
O: DicomObject + 'a,
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>
fn element(&self, tag: Tag) -> Result<Self::Element, AccessError>
Source§fn element_by_name(
&self,
name: &str,
) -> Result<Self::Element, AccessByNameError>
fn element_by_name( &self, name: &str, ) -> Result<Self::Element, AccessByNameError>
Source§impl<O> DicomObject for FileDicomObject<O>where
O: DicomObject,
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>
fn element(&self, tag: Tag) -> Result<Self::Element, AccessError>
Source§fn element_by_name(
&self,
name: &str,
) -> Result<Self::Element, AccessByNameError>
fn element_by_name( &self, name: &str, ) -> Result<Self::Element, AccessByNameError>
Source§impl<'a, O> IntoIterator for &'a FileDicomObject<O>where
&'a O: IntoIterator,
impl<'a, O> IntoIterator for &'a FileDicomObject<O>where
&'a O: IntoIterator,
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§impl<O> IntoIterator for FileDicomObject<O>where
O: IntoIterator,
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§impl<O: PartialEq> PartialEq for FileDicomObject<O>
impl<O: PartialEq> PartialEq for FileDicomObject<O>
Source§impl<D> PixelDataObject for FileDicomObject<InMemDicomObject<D>>where
D: DataDictionary + Clone,
impl<D> PixelDataObject for FileDicomObject<InMemDicomObject<D>>where
D: DataDictionary + Clone,
Implement basic pixeldata encoder/decoder functionality
Source§fn samples_per_pixel(&self) -> Option<u16>
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>
fn bits_allocated(&self) -> Option<u16>
Return the BitsAllocated attribute or None if it is not set
Source§fn bits_stored(&self) -> Option<u16>
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>
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>
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]>>
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>
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
fn transfer_syntax_uid(&self) -> &str
Source§fn photometric_interpretation(&self) -> Option<&str>
fn photometric_interpretation(&self) -> Option<&str>
None
if it is not definedimpl<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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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