Crate dicom_web

Source
Expand description

This crate contains a DICOMweb client for querying and retrieving DICOM objects.

It supports the QIDO-RS and WADO-RS DICOMweb services, which are used to query and retrieve DICOM objects respectively. As of now, the STOW-RS service is not supported. The HTTP requests are made using the reqwest crate, which is a high-level HTTP client for Rust.

§Examples

Query all studies from a DICOMweb server (with authentication):

use dicom_dictionary_std::tags;
use dicom_web::DicomWebClient;

async fn foo()
{
  let mut client = DicomWebClient::with_single_url("http://localhost:8042");
  client.set_basic_auth("orthanc", "orthanc");

  let studies = client.query_studies().run().await.unwrap();

  for study in studies {
      let study_instance_uid = study.element(tags::STUDY_INSTANCE_UID).unwrap().to_str().unwrap();
      println!("Study: {}", study_instance_uid);
  }
}

To retrieve a DICOM study from a DICOMweb server:

use dicom_dictionary_std::tags;
use dicom_web::DicomWebClient;
use futures_util::StreamExt;

async fn foo()
{
  let mut client = DicomWebClient::with_single_url("http://localhost:8042");
  client.set_basic_auth("orthanc", "orthanc");
   
  let study_instance_uid = "1.2.276.0.89.300.10035584652.20181014.93645";
   
  let mut study_objects = client.retrieve_study(study_instance_uid).run().await.unwrap();

  while let Some(object) = study_objects.next().await {
      let object = object.unwrap();
      let sop_instance_uid = object.element(tags::SOP_INSTANCE_UID).unwrap().to_str().unwrap();
      println!("Instance: {}", sop_instance_uid);
  }
}

Structs§

DicomWebClient
The DICOMweb client for querying and retrieving DICOM objects. Can be reused for multiple requests.

Enums§

DicomWebError
An error returned when parsing an invalid tag range.