# gacou54/pyorthanc architecture

> Architecture diagram of the GitHub repository gacou54/pyorthanc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gacou54/pyorthanc
- Repository: https://github.com/gacou54/pyorthanc

## Overview

PyOrthanc is a Python client for Orthanc: callers use sync/async REST wrappers to manage DICOM data, search and materialize typed resources, upload/retrieve files, and issue remote-modality operations. The REST client is the transport layer; resource objects add hierarchy, metadata, downloads, and anonymization. README capabilities include the Orthanc Python-plugin SDK, represented here with its enum support. Edges reflect explicit README claims or source-index references and excerpts; unsampled internals are not expanded.

Main entry points: [`pyorthanc/client.py`](https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/client.py) (Sync client), [`pyorthanc/_resources/study.py`](https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_resources/study.py) (Study resource), [`pyorthanc/_resources/series.py`](https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_resources/series.py) (Series resource), [`pyorthanc/_resources/patient.py`](https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_resources/patient.py) (Patient resource)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["REST Clients"]
  node_orthanc["Sync client<br/>[client.py]"]
  node_async["Async client<br/>[async_client.py]"]
  node_internal["Plugin internal client"]
end

subgraph group_workflow["DICOM Workflows"]
  node_find["DICOM search<br/>[_find.py]"]
  node_filter["Resource filtering<br/>[_filtering.py]"]
  node_upload["DICOM upload<br/>[_upload.py]"]
  node_modality["Remote modality<br/>[_modality.py]"]
  node_retrieve["File retrieval<br/>[retrieve.py]"]
  node_jobs["Async jobs<br/>[jobs.py]"]
end

subgraph group_domain["Resource Model"]
  node_patient["Patient resource<br/>[patient.py]"]
  node_study["Study resource<br/>[study.py]"]
  node_series["Series resource<br/>[series.py]"]
  node_instance["Instance resource<br/>[instance.py]"]
  node_resource["Resource base<br/>[resource.py]"]
end

subgraph group_plugin["Plugin SDK"]
  node_sdk["Orthanc plugin SDK<br/>[orthanc_sdk.py]"]
  node_enums["SDK enums"]
end

node_caller(("Python caller"))
node_orthanc_server[("Orthanc server")]
node_pacs(("Remote PACS"))
node_dicom["DICOM files"]
node_orthanc_plugin(("Orthanc Python plugin"))

node_caller -->|"uses"| node_orthanc
node_caller -->|"uses"| node_async
node_caller -->|"searches"| node_find
node_caller -->|"uploads"| node_upload
node_caller -->|"queries"| node_modality
node_caller -->|"retrieves"| node_retrieve
node_caller -->|"uses"| node_sdk
node_orthanc -->|"REST requests"| node_orthanc_server
node_async -->|"async REST"| node_orthanc_server
node_internal -.->|"internal calls"| node_orthanc_server
node_find -->|"queries"| node_orthanc
node_find -->|"creates resources"| node_patient
node_find -->|"creates resources"| node_study
node_find -->|"creates resources"| node_series
node_find -->|"creates resources"| node_instance
node_filter -->|"filters"| node_patient
node_filter -->|"filters"| node_study
node_filter -->|"filters"| node_series
node_filter -->|"filters"| node_instance
node_upload -->|"sends files"| node_orthanc
node_dicom -->|"provides input"| node_upload
node_modality -->|"issues queries"| node_orthanc
node_orthanc -->|"routes DICOM"| node_pacs
node_retrieve -->|"writes resources"| node_patient
node_retrieve -->|"writes resources"| node_study
node_retrieve -->|"writes resources"| node_series
node_retrieve -->|"writes resources"| node_instance
node_patient -->|"constructs children"| node_study
node_study -->|"constructs children"| node_series
node_series -->|"uses instances"| node_instance
node_patient -->|"inherits"| node_resource
node_study -->|"inherits"| node_resource
node_series -->|"inherits"| node_resource
node_instance -->|"inherits"| node_resource
node_patient -->|"calls REST"| node_orthanc
node_study -.->|"calls REST"| node_orthanc
node_series -->|"calls REST"| node_orthanc
node_instance -->|"calls REST"| node_orthanc
node_patient -->|"creates jobs"| node_jobs
node_study -.->|"creates jobs"| node_jobs
node_series -->|"creates jobs"| node_jobs
node_orthanc_plugin -->|"hosts API"| node_sdk
node_sdk -->|"uses enums"| node_enums

click node_orthanc "https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/client.py"
click node_async "https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/async_client.py"
click node_internal "https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_internal_client.py"
click node_find "https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_find.py"
click node_filter "https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_filtering.py"
click node_upload "https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_upload.py"
click node_modality "https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_modality.py"
click node_retrieve "https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/retrieve.py"
click node_jobs "https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/jobs.py"
click node_patient "https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_resources/patient.py"
click node_study "https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_resources/study.py"
click node_series "https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_resources/series.py"
click node_instance "https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_resources/instance.py"
click node_resource "https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_resources/resource.py"
click node_sdk "https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/orthanc_sdk.py"
click node_enums "https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_orthanc_sdk_enums.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_orthanc,node_async,node_internal toneBlue
class node_find,node_filter,node_upload,node_modality,node_retrieve,node_jobs,node_orthanc_server toneAmber
class node_patient,node_study,node_series,node_instance,node_resource toneMint
class node_sdk,node_enums toneRose
class node_caller,node_pacs,node_dicom,node_orthanc_plugin toneIndigo
```

## Components

### REST Clients

- [Sync client](https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/client.py): `pyorthanc/client.py`
- [Async client](https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/async_client.py): `pyorthanc/async_client.py`
- [Plugin internal client](https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_internal_client.py): `pyorthanc/_internal_client.py`

### DICOM Workflows

- [DICOM search](https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_find.py): `pyorthanc/_find.py`
- [Resource filtering](https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_filtering.py): `pyorthanc/_filtering.py`
- [DICOM upload](https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_upload.py): `pyorthanc/_upload.py`
- [Remote modality](https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_modality.py): `pyorthanc/_modality.py`
- [File retrieval](https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/retrieve.py): `pyorthanc/retrieve.py`
- [Async jobs](https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/jobs.py): `pyorthanc/jobs.py`

### Resource Model

- [Patient resource](https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_resources/patient.py): `pyorthanc/_resources/patient.py`
- [Study resource](https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_resources/study.py): `pyorthanc/_resources/study.py`
- [Series resource](https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_resources/series.py): `pyorthanc/_resources/series.py`
- [Instance resource](https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_resources/instance.py): `pyorthanc/_resources/instance.py`
- [Resource base](https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_resources/resource.py): `pyorthanc/_resources/resource.py`

### Plugin SDK

- [Orthanc plugin SDK](https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/orthanc_sdk.py): `pyorthanc/orthanc_sdk.py`
- [SDK enums](https://github.com/gacou54/pyorthanc/blob/main/pyorthanc/_orthanc_sdk_enums.py): `pyorthanc/_orthanc_sdk_enums.py`

### Other components

- **Python caller**
- **Orthanc server**
- **Remote PACS**
- **DICOM files**
- **Orthanc Python plugin**

## Connections

- Python caller → Sync client: uses (evidence: `README.md`)
- Python caller → Async client: uses (evidence: `README.md`)
- Python caller → DICOM search: searches (evidence: `README.md`)
- Python caller → DICOM upload: uploads (evidence: `README.md`)
- Python caller → Remote modality: queries (evidence: `README.md`)
- Python caller → File retrieval: retrieves (evidence: `README.md`)
- Python caller → Orthanc plugin SDK: uses (evidence: `README.md`)
- Sync client → Orthanc server: REST requests (evidence: `README.md`)
- Async client → Orthanc server: async REST (evidence: `README.md`)
- Plugin internal client → Orthanc server: internal calls
- DICOM search → Sync client: queries (evidence: `pyorthanc/_find.py`)
- DICOM search → Patient resource: creates resources (evidence: `pyorthanc/_find.py`)
- DICOM search → Study resource: creates resources (evidence: `pyorthanc/_find.py`)
- DICOM search → Series resource: creates resources (evidence: `pyorthanc/_find.py`)
- DICOM search → Instance resource: creates resources (evidence: `pyorthanc/_find.py`)
- Resource filtering → Patient resource: filters (evidence: `pyorthanc/_filtering.py`)
- Resource filtering → Study resource: filters (evidence: `pyorthanc/_filtering.py`)
- Resource filtering → Series resource: filters (evidence: `pyorthanc/_filtering.py`)
- Resource filtering → Instance resource: filters (evidence: `pyorthanc/_filtering.py`)
- DICOM upload → Sync client: sends files (evidence: `pyorthanc/_upload.py`)
- DICOM files → DICOM upload: provides input (evidence: `README.md`)
- Remote modality → Sync client: issues queries (evidence: `pyorthanc/_modality.py`)
- Sync client → Remote PACS: routes DICOM (evidence: `README.md`)
- File retrieval → Patient resource: writes resources (evidence: `pyorthanc/retrieve.py`)
- File retrieval → Study resource: writes resources (evidence: `pyorthanc/retrieve.py`)
- File retrieval → Series resource: writes resources (evidence: `pyorthanc/retrieve.py`)
- File retrieval → Instance resource: writes resources (evidence: `pyorthanc/retrieve.py`)
- Patient resource → Study resource: constructs children (evidence: `pyorthanc/_resources/patient.py`)
- Study resource → Series resource: constructs children (evidence: `pyorthanc/_resources/study.py`)
- Series resource → Instance resource: uses instances (evidence: `pyorthanc/_resources/series.py`)
- Patient resource → Resource base: inherits (evidence: `pyorthanc/_resources/patient.py`)
- Study resource → Resource base: inherits (evidence: `pyorthanc/_resources/study.py`)
- Series resource → Resource base: inherits (evidence: `pyorthanc/_resources/series.py`)
- Instance resource → Resource base: inherits (evidence: `pyorthanc/_resources/instance.py`)
- Patient resource → Sync client: calls REST (evidence: `pyorthanc/_resources/patient.py`)
- Study resource → Sync client: calls REST
- Series resource → Sync client: calls REST (evidence: `pyorthanc/_resources/series.py`)
- Instance resource → Sync client: calls REST (evidence: `pyorthanc/_resources/instance.py`)
- Patient resource → Async jobs: creates jobs (evidence: `pyorthanc/_resources/patient.py`)
- Study resource → Async jobs: creates jobs (evidence: `pyorthanc/_resources/study.py`)
- Series resource → Async jobs: creates jobs (evidence: `pyorthanc/_resources/series.py`)
- Orthanc Python plugin → Orthanc plugin SDK: hosts API (evidence: `README.md`)
- Orthanc plugin SDK → SDK enums: uses enums (evidence: `pyorthanc/orthanc_sdk.py`)
