Registry for DICOM pixel data codecs.
Maps Transfer Syntax UIDs to codec modules implementing Dicom.Codec.
Built-in codecs (e.g., Dicom.Codec.RLE) are registered automatically
on first access. Additional codecs can be registered at runtime:
Dicom.Codec.Registry.register(MyApp.JPEGCodec)Uses :persistent_term for O(1) lookup with no process overhead.
Summary
Functions
Removes the codec registration for a given Transfer Syntax UID.
Looks up a codec module for the given Transfer Syntax UID.
Registers a codec module for all Transfer Syntax UIDs it declares.
Returns all registered {uid, module} pairs.
Resets the registry to only built-in codecs.
Functions
@spec deregister(String.t()) :: :ok
Removes the codec registration for a given Transfer Syntax UID.
Returns :ok.
Looks up a codec module for the given Transfer Syntax UID.
Returns {:ok, module} or :error.
Examples
iex> Dicom.Codec.Registry.lookup("1.2.840.10008.1.2.5")
{:ok, Dicom.Codec.RLE}
@spec register(module()) :: :ok
Registers a codec module for all Transfer Syntax UIDs it declares.
The module must implement the Dicom.Codec behaviour, specifically
transfer_syntax_uids/0.
Returns :ok.
Examples
iex> Dicom.Codec.Registry.register(Dicom.Codec.RLE)
:ok
Returns all registered {uid, module} pairs.
Examples
iex> Dicom.Codec.Registry.registered() |> Enum.member?({"1.2.840.10008.1.2.5", Dicom.Codec.RLE})
true
@spec reset() :: :ok
Resets the registry to only built-in codecs.
Useful in tests to restore a clean state.