Skip to content

Commit

Permalink
Added crate doc
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertHabrich committed Oct 31, 2018
1 parent 8d68fdf commit 2868b83
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 6 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
[![Documentation](https://docs.rs/dicom_dictionary_parser/badge.svg)](https://docs.rs/dicom_dictionary_parser)
[![Crates.io](https://img.shields.io/crates/l/dicom_dictionary_parser.svg)](https://crates.io/crates/dicom_dictionary_parser)

A Rust library that allows to parse the various elements defined in DICOM standard
part 6. It returns a simple data structure representing the definitions that
can be used to e.g. automatically generate a dictionary source file with all
elements currently defined by the DICOM standard. It is necessary to
automatically generate such files due to the sheer amount of elements defined
by the DICOM standard (thousands).
A Rust library that allows to parse the various elements defined in DICOM
standard part 6.

Full documentation can be found [here](https://docs.rs/dicom_dictionary_parser/0.1.0/dicom_dictionary_parser/).

## Usage

Expand Down
41 changes: 41 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
//! Library providing acess to the elements defined in the various tables of
//! DICOM part 6. Currently, access to the following tables is provided:
//! * "Registry of DICOM Data Elements"
//! * "Registry of DICOM File Meta Elements"
//! * "Registry of DICOM Directory Structuring Elements"
//! * "Registry of DICOM Unique Identifiers (UIDs)"
//!
//! # Example - Writing data elements to file
//!
//! ```rust,no_run
//! extern crate dicom_dictionary_parser as dict_parser;
//!
//! use std::fs::File;
//! use std::io::BufWriter;
//! use std::io::Write;
//!
//! fn main() -> Result<(), Box<::std::error::Error>> {
//! let parser = dict_parser::Parser::new()?;
//! let data_elements = parser.parse_data_element_registry()?;
//! let file = File::create("dictionary.rs")?;
//! let mut buf_writer = BufWriter::new(file);
//! for data_element in data_elements {
//! let upper_case_keyword = data_element
//! .keyword
//! .replace("\u{200b}", "")
//! .replace("__", "_")
//! .to_uppercase();
//!
//! buf_writer.write_all(
//! format!(
//! "const {}: Tag = Tag(0x{}, 0x{});\n",
//! upper_case_keyword,
//! &data_element.tag[1..5],
//! &data_element.tag[6..10])
//! .as_bytes())?;
//! }
//!
//! Ok(())
//! }
//! ```
pub mod data_element;
pub mod parser;
pub mod uid;
Expand Down

0 comments on commit 2868b83

Please sign in to comment.