This cargo workspace contains:
Crate | Version | Description |
---|---|---|
orthanc_sdk | Abstractions for developing a Rust Orthanc plugin | |
orthanc_client_ogen | Automatically generated Orthanc client using OpenAPI | |
orthanc_api | Hand-written types for the Orthanc API | |
examples/basic | N/A | Example Orthanc plugin using orthanc_sdk |
blt | Orthanc plugin for automating the Boston Children's Hospital BLT project |
Dependencies for codegen and testing are listed in ./flake.nix and can be setup automatically using nix develop.
nix develop -c just
[!WARNING] I use Nix myself, so these instructions are untested.
If you don't want to use Nix, install the packages specified
in the outputs.devShell.buildInputs
section of flake.nix
manually.
On Ubuntu or Debian, some basic dependencies can be installed using apt
:
sudo apt update
sudo apt install just fd-find xh podman-compose
You will also need these, which are trickier to install:
- Rust: https://rustup.rs
- Bindgen: https://rust-lang.github.io/rust-bindgen/command-line-usage.html
- OpenAPI Generator: https://openapi-generator.tech/docs/installation
- Podman: https://podman.io/docs/installation
- Bun (to test the examples): https://bun.com/
This repository depends on automatic code generation (codegen) for:
- Rust bindings to Orthanc's C plugin header
- Orthanc API models (and client) generated from the OpenAPI specification
just
The examples/ directory contains both well-documented example plugins and tests for orthanc_sdk.
# optional: collect test coverage data
source <(cargo llvm-cov show-env --export-prefix)
cargo llvm-cov clean --workspace
cd examples
just up &
just test
just down
just clean
# optional: generate HTML coverage report
cargo llvm-cov report --html --ignore-filename-regex orthanc_client_ogen
The tests are written with Bun.
Why Bun?
Most of orthanc_sdk
cannot be tested using cargo test
because it is FFI
code to be invoked by Orthanc. We use Bun to cause the invocation of our code
via REST API calls made using fetch
.