[][src]Crate gdcm_conv

An easy-to-use Grassroots DICOM Library wrapper designed to only convert DICOM files transfer syntaxes.

Usage

You need CMake to build GDCM Library and wrapper.

Linux Ubuntu:

sudo apt-get install cmake

Windows:

Download CMake directly from www.cmake.org/download page.

Warning

The GDCM library is big and may take some time to build it. Rushed people, please use very verbose option:

cargo run -vv

Quickstart

Copy this code and make sure you have a DICOM file to test.

use std::io::prelude::*;
use std::fs::File;
 
fn main() {
 
    // open and read file
    let mut ibuffer = Vec::new();
    let mut ifile = File::open("input.dcm").unwrap();    
    ifile.read_to_end(&mut ibuffer).unwrap();
 
    let obuffer = match gdcm_conv::transcode(
        ibuffer,
        gdcm_conv::TransferSyntax::Unknown,
        // input parameters: (quality1, quality2, quality3, irreversible)
        gdcm_conv::TransferSyntax::JPEG2000(100, 0, 0, false),
        None,
        None
    ) {
        Ok(t) => t,
        rr(e) => {
            println!("{}", e);
            return;
        }
    };
 
    // create file and save
    let mut ofile = File::create("output.dcm").unwrap();
    ofile.write_all(&obuffer).unwrap();
 
}

Enums

TransferSyntax

List of compatible encoding rules for the data set portion of a DICOM file.

Functions

transcode

Takes as input a DICOM file i_buffer and process it to generate an output DICOM file Result<>. The transfer syntax parameters dictate the type of operation gdcm_conv will use to generate the output file.