Struct orthanc::client::Client[][src]

pub struct Client { /* fields omitted */ }

Client type

The client itself is fairly simple. There are only 3 fields that the end-user should care about: server (the address of the Orthanc server, an HTTP(S) URL), username and password.

Creating a new client instance:

let client = Client::new("http://localhost:8042");

Authentication (setting username/password) can be done by calling the auth method:

client.auth("username", "password");

Or combined:

let client = Client::new("http://localhost:8042").auth("username", "password");

Implementations

impl Client[src]

pub fn new(server: impl Into<String>) -> Client[src]

Creates a new client instance

let client = Client::new("http://localhost:8042");

pub fn auth(
    self,
    username: impl Into<String>,
    password: impl Into<String>
) -> Client
[src]

Adds authentication to the client instance

let client = Client::new("http://localhost:8042").auth("username", "password");

pub fn modalities(&self) -> Result<Vec<String>, Error>[src]

List modalities

pub fn modalities_expanded(&self) -> Result<HashMap<String, Modality>, Error>[src]

List all modalities in an expanded format

pub fn create_modality(
    &self,
    name: &str,
    modality: Modality
) -> Result<(), Error>
[src]

Create a modality

pub fn modify_modality(
    &self,
    name: &str,
    modality: Modality
) -> Result<(), Error>
[src]

Modify a modality

pub fn delete_modality(&self, name: &str) -> Result<(), Error>[src]

Delete a modality

pub fn modality_echo(
    &self,
    modality: &str,
    timeout: Option<u32>
) -> Result<(), Error>
[src]

Send a C-ECHO request to a remote modality

If no error is returned, the request was successful

pub fn echo(&self, modality: &str, timeout: Option<u32>) -> Result<(), Error>[src]

👎 Deprecated since 0.8.0:

Renamed to modality_echo

Send a C-ECHO request to a remote modality

If no error is returned, the request was successful

pub fn modality_store(
    &self,
    modality: &str,
    ids: &[&str]
) -> Result<ModalityStoreResult, Error>
[src]

Send a C-STORE DICOM request to a remote modality

ids is a slice of entity IDs to send. An ID can signify either of Patient, Study, Series or Instance

pub fn store(
    &self,
    modality: &str,
    ids: &[&str]
) -> Result<ModalityStoreResult, Error>
[src]

👎 Deprecated since 0.8.0:

Renamed to modality_store

Send a C-STORE DICOM request to a remote modality

ids is a slice of entity IDs to send. An ID can signify either of Patient, Study, Series or Instance

pub fn modality_move(
    &self,
    modality: &str,
    move_request: ModalityMove
) -> Result<(), Error>
[src]

Send a C-MOVE request to a remote modality

If no error is returned, the request was successful

pub fn modality_find(
    &self,
    modality: &str,
    level: EntityKind,
    query: HashMap<String, String>,
    normalize: Option<bool>
) -> Result<ModalityFindResult, Error>
[src]

Send a C-FIND request to a remote modality

If no error is returned, the request was successful

pub fn peers(&self) -> Result<Vec<String>, Error>[src]

List peers

pub fn peers_expanded(&self) -> Result<HashMap<String, Peer>, Error>[src]

List all peers in an expanded format

pub fn create_peer(&self, name: &str, peer: Peer) -> Result<(), Error>[src]

Create a peer

pub fn modify_peer(&self, name: &str, peer: Peer) -> Result<(), Error>[src]

Modify a peer

pub fn delete_peer(&self, name: &str) -> Result<(), Error>[src]

Delete a peer

pub fn peer_store(
    &self,
    peer: &str,
    ids: &[&str]
) -> Result<PeerStoreResult, Error>
[src]

Send entities to a peer

ids is a slice of entity IDs to send. An ID can signify either of Patient, Study, Series or Instance

pub fn patients(&self) -> Result<Vec<String>, Error>[src]

List patients

pub fn patients_expanded(&self) -> Result<Vec<Patient>, Error>[src]

List all patients in an expanded format

pub fn patient(&self, id: &str) -> Result<Patient, Error>[src]

Get a patient by its ID

pub fn patient_dicom<W: Write>(&self, id: &str, writer: W) -> Result<(), Error>[src]

Download a patient as a collection of DICOM files

Accepts a mutable reference to an object, that implements a Write trait, and mutates the object, writing the data into it in a streaming fashion.

Streamed data is a ZIP archive

Example:

let mut file = fs::File::create("/tmp/patient.zip").unwrap();
client().patient_dicom("3693b9d5-8b0e2a80-2cf45dda-d19e7c22-8749103c", &mut file).unwrap();

pub fn anonymize_patient(
    &self,
    id: &str,
    anonymization: Option<Anonymization>
) -> Result<ModificationResult, Error>
[src]

Anonymize a patient

pub fn modify_patient(
    &self,
    id: &str,
    modification: Modification
) -> Result<ModificationResult, Error>
[src]

Modify a patient

pub fn delete_patient(&self, id: &str) -> Result<RemainingAncestor, Error>[src]

Delete a patient

pub fn studies(&self) -> Result<Vec<String>, Error>[src]

List studies

pub fn studies_expanded(&self) -> Result<Vec<Study>, Error>[src]

List all studies in an expanded format

pub fn study(&self, id: &str) -> Result<Study, Error>[src]

Get a study by its ID

pub fn study_dicom<W: Write>(&self, id: &str, writer: W) -> Result<(), Error>[src]

Download a study as a collection of DICOM files

Accepts a mutable reference to an object, that implements a Write trait, and mutates the object, writing the data into it in a streaming fashion.

Streamed data is a ZIP archive

Example:

let mut file = fs::File::create("/tmp/study.zip").unwrap();
client().study_dicom("3693b9d5-8b0e2a80-2cf45dda-d19e7c22-8749103c", &mut file).unwrap();

pub fn anonymize_study(
    &self,
    id: &str,
    anonymization: Option<Anonymization>
) -> Result<ModificationResult, Error>
[src]

Anonymize a study

pub fn modify_study(
    &self,
    id: &str,
    modification: Modification
) -> Result<ModificationResult, Error>
[src]

Modify a study

pub fn delete_study(&self, id: &str) -> Result<RemainingAncestor, Error>[src]

Delete a study

pub fn series_list(&self) -> Result<Vec<String>, Error>[src]

List series

pub fn series_expanded(&self) -> Result<Vec<Series>, Error>[src]

List all series in an expanded format

pub fn series(&self, id: &str) -> Result<Series, Error>[src]

Get a series by its ID

pub fn series_dicom<W: Write>(&self, id: &str, writer: W) -> Result<(), Error>[src]

Download a series as a collection of DICOM files

Accepts a mutable reference to an object, that implements a Write trait, and mutates the object, writing the data into it in a streaming fashion.

Streamed data is a ZIP archive

Example:

let mut file = fs::File::create("/tmp/series.zip").unwrap();
client().series_dicom("3693b9d5-8b0e2a80-2cf45dda-d19e7c22-8749103c", &mut file).unwrap();

pub fn anonymize_series(
    &self,
    id: &str,
    anonymization: Option<Anonymization>
) -> Result<ModificationResult, Error>
[src]

Anonymize a series

pub fn modify_series(
    &self,
    id: &str,
    modification: Modification
) -> Result<ModificationResult, Error>
[src]

Modify a series

pub fn delete_series(&self, id: &str) -> Result<RemainingAncestor, Error>[src]

Delete a series

pub fn instances(&self) -> Result<Vec<String>, Error>[src]

List instances

pub fn instances_expanded(&self) -> Result<Vec<Instance>, Error>[src]

List all instances in an expanded format

pub fn instance(&self, id: &str) -> Result<Instance, Error>[src]

Get an instance by its ID

pub fn instance_tags(&self, id: &str) -> Result<Value, Error>[src]

Get all DICOM tags of an instance in a simplified format

See related Orthanc documentation section for details

pub fn instance_tags_expanded(&self, id: &str) -> Result<Value, Error>[src]

Get all DICOM tags of an instance in an expanded format

See related Orthanc documentation section for details

pub fn instance_content(&self, id: &str) -> Result<Vec<String>, Error>[src]

Get all DICOM tags’ codings of an instance

Returns a Vec<String> of the following format: ["0008-0018", "0040-0260", "0040-0254"]

pub fn instance_tag(&self, id: &str, tag: &str) -> Result<String, Error>[src]

Get the value of a specific DICOM tag of an instance

tag is the DICOM tag coding, e.g. 0008-0018

pub fn instance_dicom<W: Write>(&self, id: &str, writer: W) -> Result<(), Error>[src]

Download an instance as a DICOM file

Accepts a mutable reference to an object, that implements a Write trait, and mutates the object, writing the data into it in a streaming fashion.

Example:

let mut file = fs::File::create("/tmp/instance.dcm").unwrap();
client().instance_dicom("3693b9d5-8b0e2a80-2cf45dda-d19e7c22-8749103c", &mut file).unwrap();

pub fn anonymize_instance<W: Write>(
    &self,
    id: &str,
    anonymization: Option<Anonymization>,
    writer: W
) -> Result<(), Error>
[src]

Anonymize an instance

Accepts a mutable reference to an object, that implements a Write trait, and mutates the object, writing the data into it in a streaming fashion.

Example:

let mut file = fs::File::create("/tmp/anonymized_instance.dcm").unwrap();
client().anonymize_instance("3693b9d5-8b0e2a80-2cf45dda-d19e7c22-8749103c", None, &mut file).unwrap();

pub fn modify_instance<W: Write>(
    &self,
    id: &str,
    modification: Modification,
    writer: W
) -> Result<(), Error>
[src]

Modify an instance

Accepts a mutable reference to an object, that implements a Write trait, and mutates the object, writing the data into it in a streaming fashion.

Example:

let mut file = fs::File::create("/tmp/modified_instance.dcm").unwrap();
let modification = Modification {
    replace: None,
    remove: vec!["PatientName"],
    force: false,
};
client().modify_instance("3693b9d5-8b0e2a80-2cf45dda-d19e7c22-8749103c", modification, &mut file).unwrap();

pub fn delete_instance(&self, id: &str) -> Result<RemainingAncestor, Error>[src]

Delete an instance

pub fn queries(&self) -> Result<Vec<String>, Error>[src]

List queries

pub fn query_level(&self, id: &str) -> Result<EntityKind, Error>[src]

Get query level

pub fn query_modality(&self, id: &str) -> Result<String, Error>[src]

Get query modality

pub fn query_query(&self, id: &str) -> Result<Value, Error>[src]

Get query query

pub fn query_answers(&self, id: &str) -> Result<Vec<String>, Error>[src]

List query answers

pub fn query_answer(&self, id: &str, answer_id: &str) -> Result<Value, Error>[src]

Get query answer

pub fn retrieve_query_answer(
    &self,
    id: &str,
    answer_id: &str,
    target_aet: Option<&str>
) -> Result<(), Error>
[src]

Retrieve a single query answer

pub fn retrieve_query_answers(
    &self,
    id: &str,
    target_aet: Option<&str>
) -> Result<(), Error>
[src]

Retrieve all query answers

pub fn system(&self) -> Result<System, Error>[src]

System information

pub fn upload(&self, data: &[u8]) -> Result<UploadResult, Error>[src]

Upload a DICOM file to Orthanc

let data = fs::read("/tmp/instance.dcm").unwrap();
let client = Client::new("http://localhost:8042");
client.upload(&data).unwrap();

pub fn search<T: Entity>(
    &self,
    query: HashMap<String, String>
) -> Result<Vec<T>, Error>
[src]

Search for Entities in Orthanc

Trait Implementations

impl Debug for Client[src]

Auto Trait Implementations

impl !RefUnwindSafe for Client

impl Send for Client

impl Sync for Client

impl Unpin for Client

impl !UnwindSafe for Client

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> WithSubscriber for T[src]