# `Dicom.SR.ContentTree`
[🔗](https://github.com/Balneario-de-Cofrentes/dicom/blob/v0.9.1/lib/dicom/sr/content_tree.ex#L1)

Reconstructs a `Dicom.SR.ContentItem` tree from a parsed `Dicom.DataSet`.

This module provides the read (deserialization) path for SR documents,
complementing the write path in `Dicom.SR.ContentItem.to_root_elements/1`
and `Dicom.SR.Document.to_data_set/1`.

## Usage

    {:ok, data_set} = Dicom.parse(p10_binary)
    {:ok, root} = Dicom.SR.ContentTree.from_data_set(data_set)
    root.value_type  #=> :container
    root.children    #=> [%ContentItem{}, ...]

Reference: DICOM PS3.3 Section C.17.3 (SR Document Content Module).

# `from_data_set`

```elixir
@spec from_data_set(Dicom.DataSet.t()) ::
  {:ok, Dicom.SR.ContentItem.t()} | {:error, term()}
```

Reconstructs the root `ContentItem` tree from a parsed DICOM SR data set.

The data set must contain at least a Value Type (0040,A040) and
Concept Name Code Sequence (0040,A043) at the top level. Child items
are recursively extracted from the Content Sequence (0040,A730).

Returns `{:ok, root_item}` on success, or `{:error, reason}` if
required attributes are missing or malformed.

# `from_sequence_item`

```elixir
@spec from_sequence_item(map()) :: {:ok, Dicom.SR.ContentItem.t()} | {:error, term()}
```

Reconstructs a `ContentItem` tree from a sequence item map.

Sequence items are represented as maps of `{group, element} => DataElement`
after parsing. This function is used internally to process Content Sequence
children and can also be used directly when working with raw sequence items.

---

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