Skip to content

FNNDSC/orthanc-rs

Repository files navigation

Orthanc Plugins in Rust

Crates.io License Test codecov

This cargo workspace contains:

Crate Version Description
orthanc_sdk Crates.io Version Abstractions for developing a Rust Orthanc plugin
orthanc_client_ogen Crates.io Version Automatically generated Orthanc client using OpenAPI
orthanc_api Crates.io Version Hand-written types for the Orthanc API
examples/basic N/A Example Orthanc plugin using orthanc_sdk
blt Cargo.toml Version Orthanc plugin for automating the Boston Children's Hospital BLT project

Development

Dependencies for codegen and testing are listed in ./flake.nix and can be setup automatically using nix develop.

nix develop -c just

Instructions for Debian, Ubuntu, or Other

[!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:

Codegen

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

Testing

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.

About

Orthanc plugin SDK for Rust

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages