Giter VIP home page Giter VIP logo

orthanc-rs's Introduction

crate doc test codecov license

orthanc-rs

orthanc-rs is a client for the REST API of Orthanc, an open-source, lightweight DICOM server.

Compatibility

Supported Orthanc versions are 1.6.x, 1.7.x, 1.8.x, 1.9.x.

Installation

To use the crate, add the dependency to your Cargo.toml:

[dependencies]
orthanc = "0.8.0"

Usage

Create an API client instance:

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

If authentication is enabled on the Orthanc instance:

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

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();

See tests directory for more usage examples.

Tests

orthanc-rs is covered by unit as well as integration and end-to-end tests.

To run all tests execute

$ make start_services && make test

Running specific test suits separately is described below.

Unit

To run unit tests execute

$ make unit_test

Integration

To run unit tests execute

$ make integration_test

End-to-end

Install docker-compose and jq and execute

$ make start_services && make e2e_test

This will spin up all the necessary services required for integration tests, and run the tests.

During and after the test run Orthanc web UI is available at http://localhost:8028 (username: orthanc, password: orthanc).

Containers started by start_services are left running after the test is finished. To stop them execute

$ make stop_services

TODO

  • Instance images (/instances/<id>/{preview,image-uint8,image-uint16})
  • Split/merge studies (/studies/<id>/{split,merge})
  • Tools API (/tools)
  • Log API (/changes, /exports)
  • Asynchronous requests (/jobs)

orthanc-rs's People

Contributors

ch00k avatar dependabot[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

ttauveron

orthanc-rs's Issues

Address review comments

  • Your lib.rs can be divided into smaller modules.
  • Maybe trait Entity should be sealed?
  • fn parent_kind_name(&self) -> Option - maybe return Option<&str>?
  • Some functions on Entity trait can be implemented inside impl dyn Entity, to disallow override and detach dependency from implementor. https://radicle.community/t/rust-s-impl-dyn-trait-syntax/102
  • Using pub fields may render future changes to structs incompatible with previous major version of the lib (see #[non_exhaustive] https://doc.rust-lang.org/reference/attributes/type_system.html).
  • You can apply #[serde(rename_all = "PascalCase")] to more structures instead of manual renaming.
  • You still have TODOs in your code. Maybe resolve them or move into github issues?
  • You can allow user to pass a &str as an argument where you need a String with arg: impl Into and acquire a String with arg.into() (in fn auth, for example).
  • You should accept Read and Write by value, and not reference, see https://rust-lang.github.io/api-guidelines/interoperability.html#c-rw-value
  • timeout != None => timeout.is_some() or if you need to access inner value if let Some(to) = timeout {
  • I think Error could be better. What errors typical user of your crate would expect and in what form? How much details can you omit? You can hide pub fields, and instead lend message with Display.
  • Option - you can use an enum inside of your Error to encapsulate different errors. Also, consider source https://doc.rust-lang.org/std/error/trait.Error.html#method.source
  • You can move integration tests from lib.rs to /tests

Can't read chinese words!

Java(Version 1.8)
The file is stored with the encoding ISO_IR 192 on the server but the DICOM response of C-FIND is ISO_IR_100.
i use the code try other system is fine,it's made me not to know what the problem is
image
could you give me any idea
image

Implement asyncronous calls

The library would be pretty much useless for dealing with large amounts of data without the ability to do it asynchronously.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.