# `Dicom.Codec.Registry`
[🔗](https://github.com/Balneario-de-Cofrentes/dicom/blob/v0.9.2/lib/dicom/codec/registry.ex#L1)

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.

# `deregister`

```elixir
@spec deregister(String.t()) :: :ok
```

Removes the codec registration for a given Transfer Syntax UID.

Returns `:ok`.

# `lookup`

```elixir
@spec lookup(String.t()) :: {:ok, module()} | :error
```

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}

# `register`

```elixir
@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

# `registered`

```elixir
@spec registered() :: [{String.t(), module()}]
```

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

# `reset`

```elixir
@spec reset() :: :ok
```

Resets the registry to only built-in codecs.

Useful in tests to restore a clean state.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
