Skip to main content

Python Orthanc REST API client

Project description

python-orthanc-api-client

A python client to ease using the Orthanc Rest API.

Functionalities are very limited now ! Backward compat will break a lot in the near future !

Installation:

pip3 install orthanc-api-client

Examples:

from orthanc_api_client import OrthancApiClient

orthanc_a = OrthancApiClient('http://localhost:8042', user='orthanc', pwd='orthanc')
orthanc_b = OrthancApiClient('http://localhost:8043', user='orthanc', pwd='orthanc')

all_patients_ids = orthanc_a.patients.get_all_ids()
all_studies_ids = orthanc_a.studies.get_all_ids()
all_series_ids = orthanc_a.series.get_all_ids()
all_instances_ids = orthanc_a.instances.get_all_ids()

dicom_file = orthanc_a.instances.get_file(orthanc_id=all_instances_ids[0])

instances_ids = orthanc_b.upload(buffer=dicom_file)
study_id = orthanc_b.instances.get_parent_study_id(instances_ids[0])

orthanc_a.instances.set_metadata(orthanc_id=all_instances_ids[0], 1024, 'my-value')

tags = orthanc_a.instances.get_tags(orhtanc_id=all_instances_ids[0])

patient_name = tags['PatientName']
patient_id = tags['0010,0020']
patient_sex = tags['0010-0040']

anon_study_id = orthanc_b.studies.anonymize(
    orthanc_id=study_id,
    keep_tags=['PatientName'],
    replace_tags={
        'PatientID': 'ANON'
    },
    force=True,
    delete_original=False
)

upload a folder to Orthanc

from orthanc_api_client import OrthancApiClient

o = OrthancApiClient('http://localhost:8042', user='orthanc', pwd='orthanc')
o.upload_folder('/home/o/files', ignore_errors=True)

Project details


Release history Release notifications | RSS feed

This version

0.1.7

Download files

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

Source Distribution

orthanc_api_client-0.1.7.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

orthanc_api_client-0.1.7-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file orthanc_api_client-0.1.7.tar.gz.

File metadata

  • Download URL: orthanc_api_client-0.1.7.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10

File hashes

Hashes for orthanc_api_client-0.1.7.tar.gz
Algorithm Hash digest
SHA256 4b6c68040a5d2cbc092e607d12d400ab60e3623556f37b37effd47cd447b1fb0
MD5 6854d27f1026b00ba3f7a232037cf242
BLAKE2b-256 87eedb6e44f44845008fab6c6c883fb9ecd98446d35b47180d086e44765fbdbe

See more details on using hashes here.

File details

Details for the file orthanc_api_client-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: orthanc_api_client-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10

File hashes

Hashes for orthanc_api_client-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 d7d17f951f372d4eff259a906efdf730d48a1a9aa69157d51c89173c600d1b66
MD5 22a37f5dcfb29ededf54f03347c386c3
BLAKE2b-256 3d409c8d67f046c14b7127be8f534b07a7711d668f86f6f5e91320e9ee347996

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page