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
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):
dcm.write(chunk)
To get a zip of DCM files from a series:
with open('test.zip', 'wb') as z:
for chunk in orthanc.get_series_archive(<id>):
z.write(chunk)
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('http://insecure.endpoint.com', warn_insecure=False)
Further help
Metadata
Release files for orthanc-rest-client 0.5.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| orthanc_rest_client-0.5.7.tar.gz | 23.6 kB | Without provenance | Details for orthanc_rest_client-0.5.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| orthanc_rest_client-0.5.7-py3-none-any.whl | Python 3 | none | any | Details for orthanc_rest_client-0.5.7-py3-none-any.whl |
Total release size: 39.7 kB
Release files / orthanc_rest_client-0.5.7.tar.gz
| Download URL | orthanc_rest_client-0.5.7.tar.gz |
|---|---|
| Size | 23.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e14450b28c8837f008dd39d24becc3a8fb8dc7d492204e3d71b19a76dc2865f3
|
|
BLAKE2b-256 checksum How to use checksums |
b2118837b32a7d13898a5f1e0b4e9767b03f4c5fa078a6524e80b748d56ddbd9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.4
|
Release files / orthanc_rest_client-0.5.7-py3-none-any.whl
| Download URL | orthanc_rest_client-0.5.7-py3-none-any.whl |
|---|---|
| Size | 16.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5d4036558c88c3f78061344d7a65d0fd940a260bb7d318d9ee3585892956c5b2
|
|
BLAKE2b-256 checksum How to use checksums |
13824e9c2ae7eb459060f888137fc5d5b6ae3bfb608ef39a0cf217407e798130
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.4
|
Security for orthanc-rest-client 0.5.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.