pub struct TransferSyntax<D = DynDataRWAdapter, R = DynPixelDataReader, W = DynPixelDataWriter> { /* private fields */ }
Expand description
A DICOM transfer syntax specifier.
Custom encoding and decoding capabilities
are defined via the parameter types D
and P
,
The type parameter D
specifies
an adapter for reading and writing data sets,
whereas P
specifies the encoder and decoder of encapsulated pixel data.
This type is usually consumed in its “type erased” form,
with its default parameter types.
On the other hand, implementers of TransferSyntax
will typically specify
concrete types for D
and P
,
which are type-erased before registration.
If the transfer syntax requires no data set codec,
D
can be assigned to the utility type NeverAdapter
.
If pixel data encoding/decoding is not needed or not supported,
you can assign P
to NeverPixelAdapter
.
Implementations§
Source§impl<D, R, W> TransferSyntax<D, R, W>
impl<D, R, W> TransferSyntax<D, R, W>
Sourcepub const fn new(
uid: &'static str,
name: &'static str,
byte_order: Endianness,
explicit_vr: bool,
codec: Codec<D, R, W>,
) -> Self
pub const fn new( uid: &'static str, name: &'static str, byte_order: Endianness, explicit_vr: bool, codec: Codec<D, R, W>, ) -> Self
Create a new transfer syntax descriptor.
Note that only transfer syntax implementers are expected to construct TS descriptors from scratch. For a practical usage of transfer syntaxes, one should look up an existing transfer syntax registry by UID.
§Example
To register a private transfer syntax in your program,
use submit_transfer_syntax
outside of a function body:
submit_transfer_syntax! {
TransferSyntax::<NeverAdapter, NeverPixelAdapter, NeverPixelAdapter>::new(
"1.3.46.670589.33.1.4.1",
"CT-Private-ELE",
Endianness::Little,
true,
Codec::EncapsulatedPixelData(None, None),
)
}
Sourcepub const fn new_ele(
uid: &'static str,
name: &'static str,
codec: Codec<D, R, W>,
) -> Self
pub const fn new_ele( uid: &'static str, name: &'static str, codec: Codec<D, R, W>, ) -> Self
Create a new descriptor for a transfer syntax in explicit VR little endian.
Note that only transfer syntax implementers are expected to construct TS descriptors from scratch. For a practical usage of transfer syntaxes, one should look up an existing transfer syntax registry by UID.
§Example
To register a private transfer syntax in your program,
use submit_transfer_syntax
outside of a function body:
submit_transfer_syntax! {
TransferSyntax::<NeverAdapter, NeverPixelAdapter, NeverPixelAdapter>::new_ele(
"1.3.46.670589.33.1.4.1",
"CT-Private-ELE",
Codec::EncapsulatedPixelData(None, None),
)
}
See submit_ele_transfer_syntax
for an alternative.
Sourcepub const fn endianness(&self) -> Endianness
pub const fn endianness(&self) -> Endianness
Obtain this transfer syntax’ expected endianness.
Sourcepub fn is_fully_supported(&self) -> bool
pub fn is_fully_supported(&self) -> bool
Check whether this transfer syntax specifier provides a complete implementation, meaning that it can both decode and encode in this transfer syntax.
Sourcepub fn is_codec_free(&self) -> bool
pub fn is_codec_free(&self) -> bool
Check whether no codecs are required for this transfer syntax, meaning that a complete implementation is available and no pixel data conversion is required.
Sourcepub fn is_unsupported(&self) -> bool
pub fn is_unsupported(&self) -> bool
Check whether neither reading nor writing of data sets is supported.
If this is true
, encoding and decoding will not be available.
Sourcepub fn is_unsupported_pixel_encapsulation(&self) -> bool
pub fn is_unsupported_pixel_encapsulation(&self) -> bool
Check whether reading and writing the pixel data is unsupported.
If this is true
, encoding and decoding of the data set may still
be possible, but the pixel data will only be available in its
encapsulated form.
Sourcepub fn can_decode_all(&self) -> bool
pub fn can_decode_all(&self) -> bool
Check whether this codec can fully decode both data sets and pixel data.
Sourcepub fn can_decode_dataset(&self) -> bool
pub fn can_decode_dataset(&self) -> bool
Check whether this codec can decode the data set.
Sourcepub fn decoder<'s>(&self) -> Option<DynDecoder<dyn Read + 's>>
pub fn decoder<'s>(&self) -> Option<DynDecoder<dyn Read + 's>>
Retrieve the appropriate data element decoder for this transfer syntax. Can yield none if decoding is not supported.
The resulting decoder does not consider pixel data encapsulation or data set compression rules. This means that the consumer of this method needs to adapt the reader before using the decoder.
Sourcepub fn decoder_for<S>(&self) -> Option<DynDecoder<S>>
pub fn decoder_for<S>(&self) -> Option<DynDecoder<S>>
Retrieve the appropriate data element decoder for this transfer syntax and given reader type (this method is not object safe). Can yield none if decoding is not supported.
The resulting decoder does not consider pixel data encapsulation or data set compression rules. This means that the consumer of this method needs to adapt the reader before using the decoder.
Sourcepub fn encoder<'w>(&self) -> Option<DynEncoder<'w, dyn Write + 'w>>
pub fn encoder<'w>(&self) -> Option<DynEncoder<'w, dyn Write + 'w>>
Retrieve the appropriate data element encoder for this transfer syntax. Can yield none if encoding is not supported. The resulting encoder does not consider pixel data encapsulation or data set compression rules.
Sourcepub fn encoder_for<'w, T>(&self) -> Option<DynEncoder<'w, T>>
pub fn encoder_for<'w, T>(&self) -> Option<DynEncoder<'w, T>>
Retrieve the appropriate data element encoder for this transfer syntax and the given writer type (this method is not object safe). Can yield none if encoding is not supported. The resulting encoder does not consider pixel data encapsulation or data set compression rules.
Sourcepub fn basic_decoder(&self) -> BasicDecoder
pub fn basic_decoder(&self) -> BasicDecoder
Obtain a dynamic basic decoder, based on this transfer syntax’ expected endianness.
Sourcepub fn erased(self) -> TransferSyntax
pub fn erased(self) -> TransferSyntax
Type-erase the pixel data or data set codec.
Trait Implementations§
Auto Trait Implementations§
impl<D, R, W> Freeze for TransferSyntax<D, R, W>
impl<D, R, W> RefUnwindSafe for TransferSyntax<D, R, W>
impl<D, R, W> Send for TransferSyntax<D, R, W>
impl<D, R, W> Sync for TransferSyntax<D, R, W>
impl<D, R, W> Unpin for TransferSyntax<D, R, W>
impl<D, R, W> UnwindSafe for TransferSyntax<D, R, W>
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> 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