Skip to main content

KkOrthanc

Python library that wraps the Orthanc REST API.

Installation

$ pip install KkOrthanc

Example of usage

Be sure that Orthanc is running. The default URL (if running locally) is http://localhost:8042.

Get all the patients, studies, series and instances identifiers:

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

patients_identifiers = orthanc.get_patients()
study_identifiers = orthanc.get_studies()
series_identifiers = orthanc.get_series()
instance_identifiers = orthanc.get_instances()

Get specified patient, study, series, instance information:

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

# To get patients identifiers
patients_identifiers = orthanc.get_patients()

# To get patient's studies identifier and main information
for patient_identifier in patients_identifiers:
    patient_information = orthanc.get_patients_info(patient_identifier)
    study_identifiers = patient_information['Studies']   
    # To get study's series identifier and main information
    for study_identifier in study_identifiers:
        study_information = orthanc.get_studies_info(study_identifier)	
        series_identifiers = study_information['Series']
        # To get series' instances identifier and main information
        for series_identifier in series_identifiers:
            series_information = orthanc.get_series_info(series_identifier)	
            instance_identifiers = series_information['Instances']
            # To get instances main information
            for instance_identifier in instance_identifiers:
                instance_information = orthanc.get_instances_info(instance_identifier)

Delete specified study

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

studies_identifiers = orthanc.get_studies()
print(studies_identifiers)
>>> ['c4bd9044-6b9654bd-43d61bca-2c58acd5-458c7854']
orthanc.delete_study('c4bd9044-6b9654bd-43d61bca-2c58acd5-458c7854')

studies_identifiers = orthanc.get_studies()
print(studies_identifiers)
>>> []

Post specified instance

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

with open('/Users/apple/Desktop/Instance.dcm', 'rb') as file:
    orthanc.post_instances(file.read())

Delete specified study

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

instances_identifiers = orthanc.get_instances()
print(instances_identifiers)
>>> ['5dbdad22-d21b8e67-83358204-fc591c97-55571dda']
orthanc.delete_instance('5dbdad22-d21b8e67-83358204-fc591c97-55571dda')

instances_identifiers = orthanc.get_instances()
print(instances_identifiers)
>>> []

Metadata

Release files for KkOrthanc 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for KkOrthanc 0.1.5
File Size Uploaded Provenance Actions
KkOrthanc-0.1.5.tar.gz 5.4 kB Without provenance Details for KkOrthanc-0.1.5.tar.gz

Release files / KkOrthanc-0.1.5.tar.gz

Download URL KkOrthanc-0.1.5.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b42c3572cf2a0f79e2a5a9d7ddb5dae737cf5a417d7d8c1658f10f460d58b2e5
BLAKE2b-256 checksum
How to use checksums
3737f20c5786b27fbb6bcd34139d477a893ec5c1aca277b9b823c8a4293b89fa
Upload date
Uploaded using Trusted Publishing?
What is 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.10.1

Security for KkOrthanc 0.1.5

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page