Skip to main content

REST client for Orthanc DICOM servers

Project description

Orthanc REST client

Build Status PyPI version

Provides a REST client targeted at Orthanc REST API endpoints.

Based on the excellent apiron library.


pip install orthanc-rest-client

How to use

Import the pre-defined client and pass the server details

from orthanc_rest_client import Orthanc
orthanc = Orthanc('http://localhost:8042')

# Patient endpoints
...and so on

# Study endpoints
...and so on

# Series endpoints
...and so on

# Instance endpoints
...and so on

# Get changes

# Find objects by query
query = {'Level': 'Patient',
            'Query': {'PatientName': 'Jon*'},

# Get previous queries

There are many other preconfigured endpoints.


Pass valid auth object:

from requests.auth import HTTPBasicAuth
auth = HTTPBasicAuth('orthanc', 'orthanc')
orthanc = Orthanc('', auth=auth)

Then call functions normally (the auth object is passed automatically).

Advanced examples

For example, to save an instance file to local directory:

def save_dcm_file(instance_id):
    fileName = '.'.join([instance_id, "dcm"])
    with open(fileName, 'wb') as dcm:
        for chunk in orthanc.get_instance_file(instance_id):

To get a zip of DCM files from a series:

with open('', 'wb') as z:
    for chunk in orthanc.get_series_archive(<id>):

Security warning on non-HTTPS endpoints

The rest client will warn when using HTTP endpoints. Strongly consider using HTTPS given the data sensitivity.

You can disable the warning using the warn_insecure keyword argument:

orthanc = Orthanc('', warn_insecure=False)

Further help

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for orthanc-rest-client, version 0.5.7
Filename, size File type Python version Upload date Hashes
Filename, size orthanc_rest_client-0.5.7.tar.gz (23.6 kB) File type Source Python version None Upload date Hashes View
Filename, size orthanc_rest_client-0.5.7-py3-none-any.whl (16.1 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page