REST client for Orthanc DICOM servers
Project description
Orthanc REST client
Provides a REST client targeted at Orthanc REST API endpoints.
Based on the excellent apiron library.
Install
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
orthanc.get_patients()
orthanc.get_patient(id)
...and so on
# Study endpoints
orthanc.get_studies()
orthanc.get_study(id)
...and so on
# Series endpoints
orthanc.get_series()
orthanc.get_one_series(id)
...and so on
# Instance endpoints
orthanc.get_instances()
orthanc.get_instance(id)
...and so on
# Get changes
orthanc.get_changes()
# Find objects by query
query = {'Level': 'Patient',
'Query': {'PatientName': 'Jon*'},
}
orthanc.find(query)
# Get previous queries
orthanc.get_queries()
There are many other preconfigured endpoints.
Authentication
Pass valid auth object:
from requests.auth import HTTPBasicAuth
auth = HTTPBasicAuth('orthanc', 'orthanc')
orthanc = Orthanc('https://test.server.com', auth=auth)
Then call functions normally (the auth object is passed automatically).
Advanced examples
Save 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):
dcm.write(chunk)
HTTP endpoints
The rest client will warn on using HTTP endpoints. Strongly consider using HTTPS given the data sensitivity.
Further help
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
orthanc_rest_client-0.5.6.tar.gz
(10.7 kB
view hashes)
Built Distribution
Close
Hashes for orthanc_rest_client-0.5.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | eec9844e2e3f0275e768e4f310fd7aea6f03f0ac356d831fce4dc36339b1b2f4 |
|
MD5 | 5a59baa32907aa6e6add41f06d3769ff |
|
BLAKE2b-256 | 202fde83f9b41ca9d939eb8adedc15ca040afaf18867336bae4273dfb724909c |
Close
Hashes for orthanc_rest_client-0.5.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f47477e441c763371606fec1df4a0d0a7983159b2ac36b02c9087a49dc5e80a |
|
MD5 | 3cd4e7c80cdaabd3349b0936923b193f |
|
BLAKE2b-256 | 70b66b505082c69db79bc47f5eb919cd6a6922c1a65c60156f5417faadae07a7 |