Calculating SDK metrics on DICOM studies directly via a DICOMWeb connection
You can use the DicomwebQueryCreateInput and DicomwebQueryEndpoint methods in the Rhino SDK to extract metrics directly from a Dicomweb server without extracting any image data or importing it into the Rhino client.
Below is some example code for how this workflow works:
Import relevant libraries
from rhino_health import RhinoSession
from rhino_health.lib.endpoints.dicomweb_query.dicomweb_query_endpoints import DicomwebQueryEndpoint
from rhino_health.lib.endpoints.dicomweb_query.dicomweb_query_dataclass import DicomwebQueryCreateInputDefine Dicomweb connection parameters
dicomweb_server_url="http://orthanc-external:4321/dicom-web/"
dicomweb_auth_credentials=dict(
auth_type="basic_http",
username="orthanc-user-external",
password=getpass("DICOMweb Server Password:"),
)Define which studies to include in your query with DicomwebQueryCreateInput, then run your query with DicomwebQueryEndpoint
create_query_input = DicomwebQueryCreateInput(
project=project_uid,
workgroup=workgroup_uid,
dicomweb_server_url=dicomweb_server_url,
dicomweb_auth_credentials=dicomweb_auth_credentials,
dicomweb_query={"Study Instance UID": "1.2.156.14702.1.1000.16.0.19480514*"},
dicom_object_level="Series",
metric_definitions=[dict(\
metric_name="count",\
metric_params={},\
request_arguments=dict(\
variable="Modality",\
),\
)],
)
query = DicomwebQueryEndpoint(session).run_query(create_query_input, timeout_seconds=30)
if query.results:
for metric in query.results:
print("Calculated Metric:", metric.calculated_metric)
if metric.errors:
print("Metric Calculation Errors:", metric.errors)
else:
print("Errors:", query.errors)Example output:
Example output:
Example output:
PreviousCreating a Generalized Compute Code Object Using the Rhino SDK
NextCalculating Federated Analytics (Part 1)
Was this helpful?