orthanc_sdk
[!CAUTION] Work in progress. Please reach out via GitHub or Matrix if you're using this crate! It would motivate me to complete the missing features.
Idiomatic and hopefully safe abstractions for developing an Orthanc plugin in Rust.
Getting Started
Please refer to the example plugin.
Supported Features
- Rust bindings for
OrthancCPlugin.h
:orthanc_sdk::bindings
- Read the Orthanc configuration JSON:
orthanc_sdk::get_configuration
-
tracing::Subscriber
implementation for Orthanc's built-in logging:orthanc_sdk::OrthancLogger
- Helper for handling on change events in a background thread:
orthanc_sdk::utils::OnChangeThread
- Register REST callbacks:
orthanc_sdk::register_rest
andorthanc_sdk::register_rest_no_lock
- Call the built-in Orthanc API:
DicomClient
andGeneralClient
- Easily package a static web application as an Orthanc plugin:
orthanc_sdk::serve_static_file
.- Real example: https://github.com/FNNDSC/orthanc-patient-list/
- Support HTTP headers when calling the Orthanc built-in API
- Support specific HTTP responses using
OrthancPluginSendMethodNotAllowed
,OrthancPluginRedirect
,OrthancPluginSendUnauthorized
- Support HTTP multi-part answer using
OrthancPluginStartMultipartAnswer
- Support HTTP stream answer using
OrthancPluginStartStreamAnswer
- Call Orthanc peer using
OrthancPluginCallPeerApi
- Make arbitrary HTTP calls using
OrthancPluginHttpClient
- Callback for received DICOM instances
- Custom storage are
- Custom database back-end area
- Handler for C-Find SCP
- Handler for C-Find SCP against DICOM worklists
- Handler for C-Move SCP
- Custom decoder for DICOM images
- Callback to filter incoming HTTP requests
- Callback to underialize jobs
- Callback to refresh its metrics
- Callback to answer chunked HTTP transfers
- Callback for Storage Commitment SCP
- Callback to keep/discard/modify incoming DICOM instances
- Custom transcoder for DICOM images
- Callback to discard instances received
- Callback to branch a WebDAV virtual filesystem
- Macro to generate safe
extern "C" fn
definitions - Safe wrappers for images and compression
- Safe wrappers for DicomInstance
- Safe wrapper for DicomCallbacks
Naming Conventions
Orthanc can do many operations asynchronously using a built-in job queue.
This is requested by including { "Asynchronous": true }
in the POST body.
Doing so is recommended.
API client methods have the following name conventions:
*_request
, e.g.DicomClient::anonymize_request
, are low-level methods for sending an arbitrary request (either synchronous or asynchronous) to the API endpoint with a generic return type.- The name without a suffix, e.g.
DicomCLient::anonymize
, are high-level methods for making the request with{ "Asynchronous": true }
in the POST body. The return type will always bePostJsonResponse<IdAndPath<JobId>>
.- (The name is simpler to imply that it's what you are recommended to use.)
Acknowledgements
Thanks to Andrew Webber's Orthanc Rust Samples for helping me get started with FFI and Orthanc's SDK.