Orthanc integration¶
Utilities for interacting with an Orthanc DICOM server.
This module wraps common HTTP operations against an Orthanc instance, including listing patients, studies, and series, as well as downloading and extracting series data to a temporary directory. It centralizes authentication, availability checks, and basic error handling so other parts of the service can work with simple Python functions instead of raw REST calls.
download_series(series_id, output_dir=None)
¶
Download a series from Orthanc.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
series_id
|
str | list[str]
|
The ID of the series or a list of series IDs. |
required |
output_dir
|
str | None
|
The directory to save the series. If None, the series will be saved in a temporary directory (TMP_STUDY_DIR). |
None
|
Source code in src/nnunet_serve/orthanc_access.py
get_all_patients()
¶
Get all patients from Orthanc.
Returns:
| Type | Description |
|---|---|
|
A list of patients. |
Source code in src/nnunet_serve/orthanc_access.py
get_all_series()
¶
Get all series from Orthanc.
Returns:
| Type | Description |
|---|---|
|
A list of series. |
Source code in src/nnunet_serve/orthanc_access.py
get_all_series_for_study_uid(study_uid)
¶
Returns a dictionary with the series for a given study UID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
study_uid
|
str
|
The study UID. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
A dictionary with the series for the given study UID. |
Source code in src/nnunet_serve/orthanc_access.py
get_all_studies()
¶
Get all studies from Orthanc.
Returns:
| Type | Description |
|---|---|
|
A list of studies. |
Source code in src/nnunet_serve/orthanc_access.py
get_patient(patient_id)
¶
Get a patient from Orthanc.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
patient_id
|
str
|
The ID of the patient. |
required |
Returns:
| Type | Description |
|---|---|
|
A patient. |
Source code in src/nnunet_serve/orthanc_access.py
get_series(series_id)
¶
Get a series from Orthanc.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
series_id
|
str
|
The ID of the series. |
required |
Returns:
| Type | Description |
|---|---|
|
A series. |
Source code in src/nnunet_serve/orthanc_access.py
get_series_for_series_uid(series_uid)
¶
Returns a dictionary with the series for a given series UID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
series_uid
|
str
|
The series UID. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
A dictionary with the series for the given series UID. |
Source code in src/nnunet_serve/orthanc_access.py
get_series_in_study(study_id)
¶
Get all series in a study from Orthanc.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
study_id
|
str
|
The ID of the study. |
required |
Returns:
| Type | Description |
|---|---|
|
A list of series. |
Source code in src/nnunet_serve/orthanc_access.py
get_series_tags(series_id)
¶
Returns the tags for the first instance of a given series ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
series_id
|
str
|
The ID of the series. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: The tags for the series. |
Source code in src/nnunet_serve/orthanc_access.py
get_study(study_id)
¶
Get a study from Orthanc.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
study_id
|
str
|
The ID of the study. |
required |
Returns:
| Type | Description |
|---|---|
|
A study. |
Source code in src/nnunet_serve/orthanc_access.py
upload_instance(instance_path)
¶
Upload an instance to Orthanc.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instance_path
|
str
|
The path to the instance. |
required |
Source code in src/nnunet_serve/orthanc_access.py
upload_series(series_path)
¶
Upload one or multiple DICOM series to Orthanc.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
series_path
|
str | list[str]
|
Path(s) to either DICOM files or directories containing DICOM files. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
list[str]: Orthanc responses returned by |