8000 GitHub - jdmichaud/rdicom: A simple DICOM library in rust
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

jdmichaud/rdicom

Repository files navigation

rdicom

ridcom is set of tools for DICOM written in rust. It contains:

  • A rust library for parsing DICOM files.
  • A set of tools using rdicom as either useful utility or showcases for the library.

⚠️ rdicom is not ready for production and only partially implement the DICOM file format and the dicom-web API. Moreover its implementation is far from being optimised. We do not publish a package yet and you will need to compile the library and embed it in your application yourself for now.

Compile

To compile rdicom:

cargo build

This will generate the library in the target folder.

rdicom can be compile to various targets including wasm:

cargo build --target wasm32-unknown-unknown

In order to build rdicom in webassembly, you need to install the WebAssembly target locally:

rustup target add wasm32-unknown-unknown

Build a release version of serve as a static executable (note the use of the musl target):

cargo build --bin serve --release --features=tools --target x86_64-unknown-linux-musl

Associated tools

  • dump a simplified clone of dcmdump.
  • scan an indexing tool to recursively parse a set of DICOM files and generate an index (sqlite or csv).
  • serve a dicomweb server based on the index generated by scan.
  • dcm2json, json2dcm and dcm2xml are conversion tools.

Compilation

To compile the tools:

cargo build --all-features --target x86_64-unknown-linux-musl

To compile released version:

cargo build --all-features --release --target x86_64-unknown-linux-musl

dump

dump will dump the content of a dicom file to your terminal using the same presentation as dcmdump:

cargo run --bin dump -- /path/to/some/dicom/file

Once build, the binary can also be found in the target folder:

cargo build --bin dump
target/x86_64-unknown-linux-gnu/debug/dump /path/to/some/dicom/file

scan

scan will recursively scan a folder for dicom files and extract dicom value based on a provided configuration file. The fields are then either dump as CSV to the standard output or into an sqlite database.

./scan --sql-output index.db /path/to/DICOM

The configuration will list the fields to be extracted to the index database. For example:

indexing:
  fields:
    studies:
      - StudyInstanceUID
      - PatientName
      - PatientID
      - PatientBirthDate
      - AccessionNumber
      - ReferringPhysicianName
      - StudyDate
      - StudyDescription
    series:
      - SeriesInstanceUID
      - Modality
    instances:
      - SOPInstanceUID
table_name: dicom_index

The default configuration can be printed with scan --print-output. You can redirect the output to a file, tweak it and then use it with scan --config myconfig.json.

serve

serve will serve a DICOMWeb service backed by a sqlite database previously created by scan.

How to start serve?:

serve --sqlfile base.db --dcmpath /path/to/DICOM

or from cargo:

cargo run --bin serve -- --sqlfile base.db /path/to/DICOM

The default configuration can be printed with serve --print-output. You can redirect the output to a file, tweak it and then use it with serve --config myconfig.json.

The library crate-type must be set to cdylib in Cargo.toml.

data-element.csv

data-element.csv is generated in the dicom-model project.

From this file to can create the dicom-tags with generate-dicom-tags.sh:

./generate-dicom-tags.sh data-elements.csv > src/dicom_tags.rs

About

A simple DICOM library in rust

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

0