[−][src]Crate orthanc
orthanc-rs is a client for the REST API of Orthanc, an open-source, lightweight DICOM server.
To use the crate, add the dependency to your Cargo.toml
:
[dependencies]
orthanc = "0.5.1"
Usage
Create an API client instance:
use orthanc::Client; let client = Client::new("http://localhost:8042".to_string());
If authentication is enabled on the Orthanc instance:
client.auth("username".to_string(), "password".to_string());
List patients:
client.patients();
Or in an expanded format:
client.patients_expanded();
Get all DICOM tags of an instance:
let instance_id = "0b62ebce-8ab7b938-e5ca1b05-04802ab3-42ee4307"; let tags = client.instance_tags(instance_id); println!("{}", tags["PatientID"]);
Download a study:
let study_id = "9357491d-427a6c94-4080b6c8-1997f4aa-af658240"; let mut file = fs::File::create("/tmp/study.zip").unwrap(); client.study_dicom(study_id, &mut file).unwrap();
Even though the operation is not very efficient, Orthanc allows uploading DICOM files over REST API:
let data = fs::read("/tmp/instance.dcm").unwrap(); client.upload(&data).unwrap();
Structs
Ancestor | Ancestor of an entity |
Anonymization | Anonymization request body |
ApiError | Structure of Orthanc's API error |
Client | Client type |
Error | Error type |
Instance | Instance |
Modality | Modality |
Modification | Modification request body |
ModificationResult | Result of a modification or anonymization request |
Patient | Patient |
RemainingAncestor | Remaining ancestor response |
Series | Series |
StoreResult | Result of a C-STORE request (sending entities to a modality) |
Study | Study |
UploadResult | Result of a DICOM upload request |
Enums
Entity | Orthanc entity types. |