pub struct Client { /* private fields */ }
Expand description
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§
Source§impl Client
impl Client
Sourcepub fn new(server: impl Into<String>) -> Client
pub fn new(server: impl Into<String>) -> Client
Creates a new client instance
let client = Client::new("http://localhost:8042");
Sourcepub fn auth(
self,
username: impl Into<String>,
password: impl Into<String>,
) -> Client
pub fn auth( self, username: impl Into<String>, password: impl Into<String>, ) -> Client
Adds authentication to the client instance
let client = Client::new("http://localhost:8042").auth("username", "password");
Sourcepub fn modalities_expanded(&self) -> Result<HashMap<String, Modality>, Error>
pub fn modalities_expanded(&self) -> Result<HashMap<String, Modality>, Error>
List all modalities in an expanded format
Sourcepub fn create_modality(
&self,
name: &str,
modality: Modality,
) -> Result<(), Error>
pub fn create_modality( &self, name: &str, modality: Modality, ) -> Result<(), Error>
Create a modality
Sourcepub fn modify_modality(
&self,
name: &str,
modality: Modality,
) -> Result<(), Error>
pub fn modify_modality( &self, name: &str, modality: Modality, ) -> Result<(), Error>
Modify a modality
Sourcepub fn modality_echo(
&self,
modality: &str,
timeout: Option<u32>,
) -> Result<(), Error>
pub fn modality_echo( &self, modality: &str, timeout: Option<u32>, ) -> Result<(), Error>
Send a C-ECHO request to a remote modality
If no error is returned, the request was successful
Sourcepub fn echo(&self, modality: &str, timeout: Option<u32>) -> Result<(), Error>
👎Deprecated since 0.8.0: Renamed to modality_echo
pub fn echo(&self, modality: &str, timeout: Option<u32>) -> Result<(), Error>
Send a C-ECHO request to a remote modality
If no error is returned, the request was successful
Sourcepub fn modality_store(
&self,
modality: &str,
ids: &[&str],
) -> Result<ModalityStoreResult, Error>
pub fn modality_store( &self, modality: &str, ids: &[&str], ) -> Result<ModalityStoreResult, Error>
Sourcepub fn store(
&self,
modality: &str,
ids: &[&str],
) -> Result<ModalityStoreResult, Error>
👎Deprecated since 0.8.0: Renamed to modality_store
pub fn store( &self, modality: &str, ids: &[&str], ) -> Result<ModalityStoreResult, Error>
Sourcepub fn modality_move(
&self,
modality: &str,
move_request: ModalityMove,
) -> Result<(), Error>
pub fn modality_move( &self, modality: &str, move_request: ModalityMove, ) -> Result<(), Error>
Send a C-MOVE request to a remote modality
If no error is returned, the request was successful
Sourcepub fn modality_find(
&self,
modality: &str,
level: EntityKind,
query: HashMap<String, String>,
normalize: Option<bool>,
) -> Result<ModalityFindResult, Error>
pub fn modality_find( &self, modality: &str, level: EntityKind, query: HashMap<String, String>, normalize: Option<bool>, ) -> Result<ModalityFindResult, Error>
Send a C-FIND request to a remote modality
If no error is returned, the request was successful
Sourcepub fn peers_expanded(&self) -> Result<HashMap<String, Peer>, Error>
pub fn peers_expanded(&self) -> Result<HashMap<String, Peer>, Error>
List all peers in an expanded format
Sourcepub fn peer_store(
&self,
peer: &str,
ids: &[&str],
) -> Result<PeerStoreResult, Error>
pub fn peer_store( &self, peer: &str, ids: &[&str], ) -> Result<PeerStoreResult, Error>
Sourcepub fn patients_expanded(&self) -> Result<Vec<Patient>, Error>
pub fn patients_expanded(&self) -> Result<Vec<Patient>, Error>
List all patients in an expanded format
Sourcepub fn patient_dicom<W: Write>(&self, id: &str, writer: W) -> Result<(), Error>
pub fn patient_dicom<W: Write>(&self, id: &str, writer: W) -> Result<(), Error>
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();
Sourcepub fn anonymize_patient(
&self,
id: &str,
anonymization: Option<Anonymization>,
) -> Result<ModificationResult, Error>
pub fn anonymize_patient( &self, id: &str, anonymization: Option<Anonymization>, ) -> Result<ModificationResult, Error>
Anonymize a patient
Sourcepub fn modify_patient(
&self,
id: &str,
modification: Modification,
) -> Result<ModificationResult, Error>
pub fn modify_patient( &self, id: &str, modification: Modification, ) -> Result<ModificationResult, Error>
Modify a patient
Sourcepub fn delete_patient(&self, id: &str) -> Result<RemainingAncestor, Error>
pub fn delete_patient(&self, id: &str) -> Result<RemainingAncestor, Error>
Delete a patient
Sourcepub fn studies_expanded(&self) -> Result<Vec<Study>, Error>
pub fn studies_expanded(&self) -> Result<Vec<Study>, Error>
List all studies in an expanded format
Sourcepub fn study_dicom<W: Write>(&self, id: &str, writer: W) -> Result<(), Error>
pub fn study_dicom<W: Write>(&self, id: &str, writer: W) -> Result<(), Error>
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();
Sourcepub fn anonymize_study(
&self,
id: &str,
anonymization: Option<Anonymization>,
) -> Result<ModificationResult, Error>
pub fn anonymize_study( &self, id: &str, anonymization: Option<Anonymization>, ) -> Result<ModificationResult, Error>
Anonymize a study
Sourcepub fn modify_study(
&self,
id: &str,
modification: Modification,
) -> Result<ModificationResult, Error>
pub fn modify_study( &self, id: &str, modification: Modification, ) -> Result<ModificationResult, Error>
Modify a study
Sourcepub fn delete_study(&self, id: &str) -> Result<RemainingAncestor, Error>
pub fn delete_study(&self, id: &str) -> Result<RemainingAncestor, Error>
Delete a study
Sourcepub fn series_expanded(&self) -> Result<Vec<Series>, Error>
pub fn series_expanded(&self) -> Result<Vec<Series>, Error>
List all series in an expanded format
Sourcepub fn series_dicom<W: Write>(&self, id: &str, writer: W) -> Result<(), Error>
pub fn series_dicom<W: Write>(&self, id: &str, writer: W) -> Result<(), Error>
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();
Sourcepub fn anonymize_series(
&self,
id: &str,
anonymization: Option<Anonymization>,
) -> Result<ModificationResult, Error>
pub fn anonymize_series( &self, id: &str, anonymization: Option<Anonymization>, ) -> Result<ModificationResult, Error>
Anonymize a series
Sourcepub fn modify_series(
&self,
id: &str,
modification: Modification,
) -> Result<ModificationResult, Error>
pub fn modify_series( &self, id: &str, modification: Modification, ) -> Result<ModificationResult, Error>
Modify a series
Sourcepub fn delete_series(&self, id: &str) -> Result<RemainingAncestor, Error>
pub fn delete_series(&self, id: &str) -> Result<RemainingAncestor, Error>
Delete a series
Sourcepub fn instances_expanded(&self) -> Result<Vec<Instance>, Error>
pub fn instances_expanded(&self) -> Result<Vec<Instance>, Error>
List all instances in an expanded format
Get all DICOM tags of an instance in a simplified format
See related Orthanc documentation section for details
Get all DICOM tags of an instance in an expanded format
See related Orthanc documentation section for details
Sourcepub fn instance_tag(&self, id: &str, tag: &str) -> Result<String, Error>
pub fn instance_tag(&self, id: &str, tag: &str) -> Result<String, Error>
Get the value of a specific DICOM tag of an instance
tag
is the DICOM tag coding, e.g. 0008-0018
Sourcepub fn instance_dicom<W: Write>(&self, id: &str, writer: W) -> Result<(), Error>
pub fn instance_dicom<W: Write>(&self, id: &str, writer: W) -> Result<(), Error>
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();
Sourcepub fn anonymize_instance<W: Write>(
&self,
id: &str,
anonymization: Option<Anonymization>,
writer: W,
) -> Result<(), Error>
pub fn anonymize_instance<W: Write>( &self, id: &str, anonymization: Option<Anonymization>, writer: W, ) -> Result<(), Error>
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();
Sourcepub fn modify_instance<W: Write>(
&self,
id: &str,
modification: Modification,
writer: W,
) -> Result<(), Error>
pub fn modify_instance<W: Write>( &self, id: &str, modification: Modification, writer: W, ) -> Result<(), Error>
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();
Sourcepub fn delete_instance(&self, id: &str) -> Result<RemainingAncestor, Error>
pub fn delete_instance(&self, id: &str) -> Result<RemainingAncestor, Error>
Delete an instance
Sourcepub fn query_level(&self, id: &str) -> Result<EntityKind, Error>
pub fn query_level(&self, id: &str) -> Result<EntityKind, Error>
Get query level
Sourcepub fn retrieve_query_answer(
&self,
id: &str,
answer_id: &str,
target_aet: Option<&str>,
) -> Result<(), Error>
pub fn retrieve_query_answer( &self, id: &str, answer_id: &str, target_aet: Option<&str>, ) -> Result<(), Error>
Retrieve a single query answer
Sourcepub fn retrieve_query_answers(
&self,
id: &str,
target_aet: Option<&str>,
) -> Result<(), Error>
pub fn retrieve_query_answers( &self, id: &str, target_aet: Option<&str>, ) -> Result<(), Error>
Retrieve all query answers