dicom_transfer_syntax_registry

Struct TransferSyntax

Source
pub struct TransferSyntax<D = Box<dyn DataRWAdapter<Box<dyn Read>, Box<dyn Write>, Reader = Box<dyn Read>, Writer = Box<dyn Write>> + Sync + Send>, R = Box<dyn PixelDataReader + Sync + Send>, W = Box<dyn PixelDataWriter + Sync + Send>> { /* 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>

Source

pub const fn new( uid: &'static str, name: &'static str, byte_order: Endianness, explicit_vr: bool, codec: Codec<D, R, W>, ) -> TransferSyntax<D, R, W>

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),
    )
}
Source

pub const fn new_ele( uid: &'static str, name: &'static str, codec: Codec<D, R, W>, ) -> TransferSyntax<D, R, W>

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.

Source

pub const fn uid(&self) -> &'static str

Obtain this transfer syntax’ unique identifier.

Source

pub const fn name(&self) -> &'static str

Obtain the name of this transfer syntax.

Source

pub const fn endianness(&self) -> Endianness

Obtain this transfer syntax’ expected endianness.

Source

pub fn codec(&self) -> &Codec<D, R, W>

Obtain this transfer syntax’ codec specification.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn can_decode_all(&self) -> bool

Check whether this codec can fully decode both data sets and pixel data.

Source

pub fn can_decode_dataset(&self) -> bool

Check whether this codec can decode the data set.

Source

pub fn decoder<'s>(&self) -> Option<Box<dyn DecodeFrom<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.

Source

pub fn decoder_for<S>(&self) -> Option<Box<dyn DecodeFrom<S>>>
where TransferSyntax<D, R, W>: Sized, S: Read + ?Sized,

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.

Source

pub fn encoder<'w>(&self) -> Option<Box<dyn EncodeTo<dyn Write + 'w> + '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.

Source

pub fn encoder_for<'w, T>(&self) -> Option<Box<dyn EncodeTo<T> + 'w>>
where TransferSyntax<D, R, W>: Sized, T: Write + 'w + ?Sized,

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.

Source

pub fn basic_decoder(&self) -> BasicDecoder

Obtain a dynamic basic decoder, based on this transfer syntax’ expected endianness.

Source

pub fn erased(self) -> TransferSyntax
where D: Send + Sync + 'static + DataRWAdapter<Box<dyn Read>, Box<dyn Write>, Reader = Box<dyn Read>, Writer = Box<dyn Write>>, R: Send + Sync + 'static + PixelDataReader, W: Send + Sync + 'static + PixelDataWriter,

Type-erase the pixel data or data set codec.

Trait Implementations§

Source§

impl<D, R, W> Debug for TransferSyntax<D, R, W>
where D: Debug, R: Debug, W: Debug,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<D, R, W> Freeze for TransferSyntax<D, R, W>
where R: Freeze, W: Freeze, D: Freeze,

§

impl<D, R, W> RefUnwindSafe for TransferSyntax<D, R, W>

§

impl<D, R, W> Send for TransferSyntax<D, R, W>
where R: Send, W: Send, D: Send,

§

impl<D, R, W> Sync for TransferSyntax<D, R, W>
where R: Sync, W: Sync, D: Sync,

§

impl<D, R, W> Unpin for TransferSyntax<D, R, W>
where R: Unpin, W: Unpin, D: Unpin,

§

impl<D, R, W> UnwindSafe for TransferSyntax<D, R, W>
where R: UnwindSafe, W: UnwindSafe, D: 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> Pointable for T

Source§

const ALIGN: usize = _

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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