dicom_dictionary_std/lib.rs
1//! This crate implements standard DICOM dictionaries and constants.
2//!
3//! ## Run-time dictinaries
4//!
5//! The following modules provide definitions for dictionaries
6//! which can be queried during a program's lifetime:
7//!
8//! - [`data_element`]: Contains all information about the
9//! DICOM attributes specified in the standard,
10//! and it will be used by default in most other abstractions available.
11//! When not using private tags, this dictionary should suffice.
12//! - `sop_class` (requires Cargo feature **sop-class**):
13//! Contains information about DICOM Service-Object Pair (SOP) classes
14//! and their respective unique identifiers.
15//!
16//! The records in these dictionaries are typically collected
17//! from [DICOM PS3.6] directly,
18//! but they may be obtained through other sources.
19//! Each dictionary is provided as a singleton
20//! behind a unit type for efficiency and ease of use.
21//!
22//! [DICOM PS3.6]: https://dicom.nema.org/medical/dicom/current/output/chtml/part06/ps3.6.html
23//!
24//! ## Constants
25//!
26//! The following modules contain constant declarations,
27//! which perform an equivalent mapping at compile time,
28//! thus without incurring a look-up cost:
29//!
30//! - [`tags`], which map an attribute alias to a DICOM tag
31//! - [`uids`], for various normative DICOM unique identifiers
32pub mod data_element;
33
34#[cfg(feature = "sop-class")]
35pub mod sop_class;
36pub mod tags;
37pub mod uids;
38
39pub use data_element::{StandardDataDictionary, StandardDataDictionaryRegistry};
40#[cfg(feature = "sop-class")]
41pub use sop_class::StandardSopClassDictionary;
42
43#[cfg(test)]
44mod tests {
45 use dicom_core::Tag;
46
47 /// tests for just a few attributes to make sure that the tag constants
48 /// were well installed into the crate
49 #[test]
50 fn tags_constants_available() {
51 use crate::tags::*;
52 assert_eq!(PATIENT_NAME, Tag(0x0010, 0x0010));
53 assert_eq!(MODALITY, Tag(0x0008, 0x0060));
54 assert_eq!(PIXEL_DATA, Tag(0x7FE0, 0x0010));
55 assert_eq!(STATUS, Tag(0x0000, 0x0900));
56 }
57
58 /// tests for the presence of a few UID constants
59 #[test]
60 fn uids_constants_available() {
61 use crate::uids::*;
62 assert_eq!(EXPLICIT_VR_LITTLE_ENDIAN, "1.2.840.10008.1.2.1");
63 assert_eq!(VERIFICATION, "1.2.840.10008.1.1");
64 assert_eq!(HOT_IRON_PALETTE, "1.2.840.10008.1.5.1");
65 assert_eq!(
66 PATIENT_ROOT_QUERY_RETRIEVE_INFORMATION_MODEL_FIND,
67 "1.2.840.10008.5.1.4.1.2.1.1"
68 );
69 assert_eq!(
70 STUDY_ROOT_QUERY_RETRIEVE_INFORMATION_MODEL_MOVE,
71 "1.2.840.10008.5.1.4.1.2.2.2"
72 );
73 }
74}