dicom 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,334 @@
1
+ 1.2.840.10008.1.1 Verification SOP Class SOP Class
2
+ 1.2.840.10008.1.2 Implicit VR Little Endian: Default Transfer Syntax for DICOM Transfer Syntax
3
+ 1.2.840.10008.1.2.1 Explicit VR Little Endian Transfer Syntax
4
+ 1.2.840.10008.1.2.1.99 Deflated Explicit VR Little Endian Transfer Syntax
5
+ 1.2.840.10008.1.2.2 Explicit VR Big Endian Transfer Syntax
6
+ 1.2.840.10008.1.2.4.50 JPEG Baseline (Process 1): Default Transfer Syntax for Lossy JPEG 8 Bit Image Compression Transfer Syntax
7
+ 1.2.840.10008.1.2.4.51 JPEG Extended (Process 2 & 4): Default Transfer Syntax for Lossy JPEG 12 Bit Image Compression (Process 4 only) Transfer Syntax
8
+ 1.2.840.10008.1.2.4.52 JPEG Extended (Process 3 & 5) (Retired) Transfer Syntax R
9
+ 1.2.840.10008.1.2.4.53 JPEG Spectral Selection, Non-Hierarchical (Process 6 & 8) (Retired) Transfer Syntax R
10
+ 1.2.840.10008.1.2.4.54 JPEG Spectral Selection, Non-Hierarchical (Process 7 & 9) (Retired) Transfer Syntax R
11
+ 1.2.840.10008.1.2.4.55 JPEG Full Progression, Non-Hierarchical (Process 10 & 12) (Retired) Transfer Syntax R
12
+ 1.2.840.10008.1.2.4.56 JPEG Full Progression, Non-Hierarchical (Process 11 & 13) (Retired) Transfer Syntax R
13
+ 1.2.840.10008.1.2.4.57 JPEG Lossless, Non-Hierarchical (Process 14) Transfer Syntax
14
+ 1.2.840.10008.1.2.4.58 JPEG Lossless, Non-Hierarchical (Process 15) (Retired) Transfer Syntax R
15
+ 1.2.840.10008.1.2.4.59 JPEG Extended, Hierarchical (Process 16 & 18) (Retired) Transfer Syntax R
16
+ 1.2.840.10008.1.2.4.60 JPEG Extended, Hierarchical (Process 17 & 19) (Retired) Transfer Syntax R
17
+ 1.2.840.10008.1.2.4.61 JPEG Spectral Selection, Hierarchical (Process 20 & 22) (Retired) Transfer Syntax R
18
+ 1.2.840.10008.1.2.4.62 JPEG Spectral Selection, Hierarchical (Process 21 & 23) (Retired) Transfer Syntax R
19
+ 1.2.840.10008.1.2.4.63 JPEG Full Progression, Hierarchical (Process 24 & 26) (Retired) Transfer Syntax R
20
+ 1.2.840.10008.1.2.4.64 JPEG Full Progression, Hierarchical (Process 25 & 27) (Retired) Transfer Syntax R
21
+ 1.2.840.10008.1.2.4.65 JPEG Lossless, Hierarchical (Process 28) (Retired) Transfer Syntax R
22
+ 1.2.840.10008.1.2.4.66 JPEG Lossless, Hierarchical (Process 29) (Retired) Transfer Syntax R
23
+ 1.2.840.10008.1.2.4.70 JPEG Lossless, Non-Hierarchical, First-Order Prediction (Process 14 [Selection Value 1]): Default Transfer Syntax for Lossless JPEG Image Compression Transfer Syntax
24
+ 1.2.840.10008.1.2.4.80 JPEG-LS Lossless Image Compression Transfer Syntax
25
+ 1.2.840.10008.1.2.4.81 JPEG-LS Lossy (Near-Lossless) Image Compression Transfer Syntax
26
+ 1.2.840.10008.1.2.4.90 JPEG 2000 Image Compression (Lossless Only) Transfer Syntax
27
+ 1.2.840.10008.1.2.4.91 JPEG 2000 Image Compression Transfer Syntax
28
+ 1.2.840.10008.1.2.4.92 JPEG 2000 Part 2 Multi-component Image Compression (Lossless Only) Transfer Syntax
29
+ 1.2.840.10008.1.2.4.93 JPEG 2000 Part 2 Multi-component Image Compression Transfer Syntax
30
+ 1.2.840.10008.1.2.4.94 JPIP Referenced Transfer Syntax
31
+ 1.2.840.10008.1.2.4.95 JPIP Referenced Deflate Transfer Syntax
32
+ 1.2.840.10008.1.2.4.100 MPEG2 Main Profile @ Main Level Transfer Syntax
33
+ 1.2.840.10008.1.2.4.101 MPEG2 Main Profile @ High Level Transfer Syntax
34
+ 1.2.840.10008.1.2.4.102 MPEG-4 AVC/H.264 High Profile / Level 4.1 Transfer Syntax
35
+ 1.2.840.10008.1.2.4.103 MPEG-4 AVC/H.264 BD-compatible High Profile / Level 4.1 Transfer Syntax
36
+ 1.2.840.10008.1.2.5 RLE Lossless Transfer Syntax
37
+ 1.2.840.10008.1.2.6.1 RFC 2557 MIME encapsulation Transfer Syntax 
38
+ 1.2.840.10008.1.2.6.2 XML Encoding Transfer Syntax 
39
+ 1.2.840.10008.1.3.10 Media Storage Directory Storage SOP Class
40
+ 1.2.840.10008.1.4.1.1 Talairach Brain Atlas Frame of Reference Well-known frame of reference
41
+ 1.2.840.10008.1.4.1.2 SPM2 T1 Frame of Reference Well-known frame of reference
42
+ 1.2.840.10008.1.4.1.3 SPM2 T2 Frame of Reference Well-known frame of reference
43
+ 1.2.840.10008.1.4.1.4 SPM2 PD Frame of Reference Well-known frame of reference
44
+ 1.2.840.10008.1.4.1.5 SPM2 EPI Frame of Reference Well-known frame of reference
45
+ 1.2.840.10008.1.4.1.6 SPM2 FIL T1 Frame of Reference Well-known frame of reference
46
+ 1.2.840.10008.1.4.1.7 SPM2 PET Frame of Reference Well-known frame of reference
47
+ 1.2.840.10008.1.4.1.8 SPM2 TRANSM Frame of Reference Well-known frame of reference
48
+ 1.2.840.10008.1.4.1.9 SPM2 SPECT Frame of Reference Well-known frame of reference
49
+ 1.2.840.10008.1.4.1.10 SPM2 GRAY Frame of Reference Well-known frame of reference
50
+ 1.2.840.10008.1.4.1.11 SPM2 WHITE Frame of Reference Well-known frame of reference
51
+ 1.2.840.10008.1.4.1.12 SPM2 CSF Frame of Reference Well-known frame of reference
52
+ 1.2.840.10008.1.4.1.13 SPM2 BRAINMASK Frame of Reference Well-known frame of reference
53
+ 1.2.840.10008.1.4.1.14 SPM2 AVG305T1 Frame of Reference Well-known frame of reference
54
+ 1.2.840.10008.1.4.1.15 SPM2 AVG152T1 Frame of Reference Well-known frame of reference
55
+ 1.2.840.10008.1.4.1.16 SPM2 AVG152T2 Frame of Reference Well-known frame of reference
56
+ 1.2.840.10008.1.4.1.17 SPM2 AVG152PD Frame of Reference Well-known frame of reference
57
+ 1.2.840.10008.1.4.1.18 SPM2 SINGLESUBJT1 Frame of Reference Well-known frame of reference
58
+ 1.2.840.10008.1.4.2.1 ICBM 452 T1 Frame of Reference Well-known frame of reference
59
+ 1.2.840.10008.1.4.2.2 ICBM Single Subject MRI Frame of Reference Well-known frame of reference
60
+ 1.2.840.10008.1.5.1 Hot Iron Color Palette SOP Instance Well-known SOP Instance
61
+ 1.2.840.10008.1.5.2 PET Color Palette SOP Instance Well-known SOP Instance
62
+ 1.2.840.10008.1.5.3 Hot Metal Blue Color Palette SOP Instance Well-known SOP Instance
63
+ 1.2.840.10008.1.5.4 PET 20 Step Color Palette SOP Instance Well-known SOP Instance
64
+ 1.2.840.10008.1.9 Basic Study Content Notification SOP Class (Retired) SOP Class R
65
+ 1.2.840.10008.1.20.1 Storage Commitment Push Model SOP Class SOP Class
66
+ 1.2.840.10008.1.20.1.1 Storage Commitment Push Model SOP Instance Well-known SOP Instance
67
+ 1.2.840.10008.1.20.2 Storage Commitment Pull Model SOP Class (Retired) SOP Class R
68
+ 1.2.840.10008.1.20.2.1 Storage Commitment Pull Model SOP Instance (Retired) Well-known SOP Instance R
69
+ 1.2.840.10008.1.40 Procedural Event Logging SOP Class SOP Class
70
+ 1.2.840.10008.1.40.1 Procedural Event Logging SOP Instance Well-known SOP Instance
71
+ 1.2.840.10008.1.42 Substance Administration Logging SOP Class SOP Class
72
+ 1.2.840.10008.1.42.1 Substance Administration Logging SOP Instance Well-known SOP Instance
73
+ 1.2.840.10008.2.6.1 DICOM UID Registry DICOM UIDs as a Coding Scheme
74
+ 1.2.840.10008.2.16.4 DICOM Controlled Terminology Coding Scheme
75
+ 1.2.840.10008.3.1.1.1 DICOM Application Context Name Application Context Name
76
+ 1.2.840.10008.3.1.2.1.1 Detached Patient Management SOP Class (Retired) SOP Class R
77
+ 1.2.840.10008.3.1.2.1.4 Detached Patient Management Meta SOP Class (Retired) Meta SOP Class R
78
+ 1.2.840.10008.3.1.2.2.1 Detached Visit Management SOP Class (Retired) SOP Class R
79
+ 1.2.840.10008.3.1.2.3.1 Detached Study Management SOP Class (Retired) SOP Class R
80
+ 1.2.840.10008.3.1.2.3.2 Study Component Management SOP Class (Retired) SOP Class R
81
+ 1.2.840.10008.3.1.2.5.1 Detached Results Management SOP Class (Retired) SOP Class R
82
+ 1.2.840.10008.3.1.2.5.4 Detached Results Management Meta SOP Class (Retired) Meta SOP Class R
83
+ 1.2.840.10008.3.1.2.5.5 Detached Study Management Meta SOP Class (Retired) Meta SOP Class R
84
+ 1.2.840.10008.3.1.2.6.1 Detached Interpretation Management SOP Class (Retired) SOP Class R
85
+ 1.2.840.10008.4.2 Storage Service Class Service Class
86
+ 1.2.840.10008.5.1.1.1 Basic Film Session SOP Class SOP Class
87
+ 1.2.840.10008.5.1.1.2 Basic Film Box SOP Class SOP Class
88
+ 1.2.840.10008.5.1.1.4 Basic Grayscale Image Box SOP Class SOP Class
89
+ 1.2.840.10008.5.1.1.4.1 Basic Color Image Box SOP Class SOP Class
90
+ 1.2.840.10008.5.1.1.4.2 Referenced Image Box SOP Class (Retired) SOP Class R
91
+ 1.2.840.10008.5.1.1.9 Basic Grayscale Print Management Meta SOP Class Meta SOP Class
92
+ 1.2.840.10008.5.1.1.9.1 Referenced Grayscale Print Management Meta SOP Class (Retired) Meta SOP Class R
93
+ 1.2.840.10008.5.1.1.14 Print Job SOP Class SOP Class
94
+ 1.2.840.10008.5.1.1.15 Basic Annotation Box SOP Class SOP Class
95
+ 1.2.840.10008.5.1.1.16 Printer SOP Class SOP Class
96
+ 1.2.840.10008.5.1.1.16.376 Printer Configuration Retrieval SOP Class SOP Class
97
+ 1.2.840.10008.5.1.1.17 Printer SOP Instance Well-known Printer SOP Instance
98
+ 1.2.840.10008.5.1.1.17.376 Printer Configuration Retrieval SOP Instance Well-known Printer SOP Instance
99
+ 1.2.840.10008.5.1.1.18 Basic Color Print Management Meta SOP Class Meta SOP Class
100
+ 1.2.840.10008.5.1.1.18.1 Referenced Color Print Management Meta SOP Class (Retired) Meta SOP Class R
101
+ 1.2.840.10008.5.1.1.22 VOI LUT Box SOP Class SOP Class
102
+ 1.2.840.10008.5.1.1.23 Presentation LUT SOP Class SOP Class
103
+ 1.2.840.10008.5.1.1.24 Image Overlay Box SOP Class (Retired) SOP Class R
104
+ 1.2.840.10008.5.1.1.24.1 Basic Print Image Overlay Box SOP Class (Retired) SOP Class R
105
+ 1.2.840.10008.5.1.1.25 Print Queue SOP Instance (Retired) Well-known Print Queue SOP Instance R
106
+ 1.2.840.10008.5.1.1.26 Print Queue Management SOP Class (Retired) SOP Class R
107
+ 1.2.840.10008.5.1.1.27 Stored Print Storage SOP Class (Retired) SOP Class R
108
+ 1.2.840.10008.5.1.1.29 Hardcopy Grayscale Image Storage SOP Class (Retired) SOP Class R
109
+ 1.2.840.10008.5.1.1.30 Hardcopy Color Image Storage SOP Class (Retired) SOP Class R
110
+ 1.2.840.10008.5.1.1.31 Pull Print Request SOP Class (Retired) SOP Class R
111
+ 1.2.840.10008.5.1.1.32 Pull Stored Print Management Meta SOP Class (Retired) Meta SOP Class R
112
+ 1.2.840.10008.5.1.1.33 Media Creation Management SOP Class UID SOP Class
113
+ 1.2.840.10008.5.1.4.1.1.1 Computed Radiography Image Storage SOP Class
114
+ 1.2.840.10008.5.1.4.1.1.1.1 Digital X-Ray Image Storage - For Presentation SOP Class
115
+ 1.2.840.10008.5.1.4.1.1.1.1.1 Digital X-Ray Image Storage - For Processing SOP Class
116
+ 1.2.840.10008.5.1.4.1.1.1.2 Digital Mammography X-Ray Image Storage - For Presentation SOP Class
117
+ 1.2.840.10008.5.1.4.1.1.1.2.1 Digital Mammography X-Ray Image Storage - For Processing SOP Class
118
+ 1.2.840.10008.5.1.4.1.1.1.3 Digital Intra-oral X-Ray Image Storage - For Presentation SOP Class
119
+ 1.2.840.10008.5.1.4.1.1.1.3.1 Digital Intra-oral X-Ray Image Storage - For Processing SOP Class
120
+ 1.2.840.10008.5.1.4.1.1.2 CT Image Storage SOP Class
121
+ 1.2.840.10008.5.1.4.1.1.2.1 Enhanced CT Image Storage SOP Class
122
+ 1.2.840.10008.5.1.4.1.1.3 Ultrasound Multi-frame Image Storage (Retired) SOP Class R
123
+ 1.2.840.10008.5.1.4.1.1.3.1 Ultrasound Multi-frame Image Storage SOP Class
124
+ 1.2.840.10008.5.1.4.1.1.4 MR Image Storage SOP Class
125
+ 1.2.840.10008.5.1.4.1.1.4.1 Enhanced MR Image Storage SOP Class
126
+ 1.2.840.10008.5.1.4.1.1.4.2 MR Spectroscopy Storage SOP Class
127
+ 1.2.840.10008.5.1.4.1.1.4.3 Enhanced MR Color Image Storage SOP Class
128
+ 1.2.840.10008.5.1.4.1.1.5 Nuclear Medicine Image Storage (Retired) SOP Class R
129
+ 1.2.840.10008.5.1.4.1.1.6 Ultrasound Image Storage (Retired) SOP Class R
130
+ 1.2.840.10008.5.1.4.1.1.6.1 Ultrasound Image Storage SOP Class
131
+ 1.2.840.10008.5.1.4.1.1.6.2 Enhanced US Volume Storage SOP Class
132
+ 1.2.840.10008.5.1.4.1.1.7 Secondary Capture Image Storage SOP Class
133
+ 1.2.840.10008.5.1.4.1.1.7.1 Multi-frame Single Bit Secondary Capture Image Storage SOP Class
134
+ 1.2.840.10008.5.1.4.1.1.7.2 Multi-frame Grayscale Byte Secondary Capture Image Storage SOP Class
135
+ 1.2.840.10008.5.1.4.1.1.7.3 Multi-frame Grayscale Word Secondary Capture Image Storage SOP Class
136
+ 1.2.840.10008.5.1.4.1.1.7.4 Multi-frame True Color Secondary Capture Image Storage SOP Class
137
+ 1.2.840.10008.5.1.4.1.1.8 Standalone Overlay Storage (Retired) SOP Class R
138
+ 1.2.840.10008.5.1.4.1.1.9 Standalone Curve Storage (Retired) SOP Class R
139
+ 1.2.840.10008.5.1.4.1.1.9.1 Waveform Storage - Trial (Retired) SOP Class R
140
+ 1.2.840.10008.5.1.4.1.1.9.1.1 12-lead ECG Waveform Storage SOP Class
141
+ 1.2.840.10008.5.1.4.1.1.9.1.2 General ECG Waveform Storage SOP Class
142
+ 1.2.840.10008.5.1.4.1.1.9.1.3 Ambulatory ECG Waveform Storage SOP Class
143
+ 1.2.840.10008.5.1.4.1.1.9.2.1 Hemodynamic Waveform Storage SOP Class
144
+ 1.2.840.10008.5.1.4.1.1.9.3.1 Cardiac Electrophysiology Waveform Storage SOP Class
145
+ 1.2.840.10008.5.1.4.1.1.9.4.1 Basic Voice Audio Waveform Storage SOP Class
146
+ 1.2.840.10008.5.1.4.1.1.9.4.2 General Audio Waveform Storage SOP Class
147
+ 1.2.840.10008.5.1.4.1.1.9.5.1 Arterial Pulse Waveform Storage SOP Class
148
+ 1.2.840.10008.5.1.4.1.1.9.6.1 Respiratory Waveform Storage SOP Class
149
+ 1.2.840.10008.5.1.4.1.1.10 Standalone Modality LUT Storage (Retired) SOP Class R
150
+ 1.2.840.10008.5.1.4.1.1.11 Standalone VOI LUT Storage (Retired) SOP Class R
151
+ 1.2.840.10008.5.1.4.1.1.11.1 Grayscale Softcopy Presentation State Storage SOP Class SOP Class
152
+ 1.2.840.10008.5.1.4.1.1.11.2 Color Softcopy Presentation State Storage SOP Class SOP Class
153
+ 1.2.840.10008.5.1.4.1.1.11.3 Pseudo-Color Softcopy Presentation State Storage SOP Class SOP Class
154
+ 1.2.840.10008.5.1.4.1.1.11.4 Blending Softcopy Presentation State Storage SOP Class SOP Class
155
+ 1.2.840.10008.5.1.4.1.1.11.5 XA/XRF Grayscale Softcopy Presentation State Storage SOP Class
156
+ 1.2.840.10008.5.1.4.1.1.12.1 X-Ray Angiographic Image Storage SOP Class
157
+ 1.2.840.10008.5.1.4.1.1.12.1.1 Enhanced XA Image Storage SOP Class
158
+ 1.2.840.10008.5.1.4.1.1.12.2 X-Ray Radiofluoroscopic Image Storage SOP Class
159
+ 1.2.840.10008.5.1.4.1.1.12.2.1 Enhanced XRF Image Storage SOP Class
160
+ 1.2.840.10008.5.1.4.1.1.12.3 X-Ray Angiographic Bi-Plane Image Storage (Retired) SOP Class R
161
+ 1.2.840.10008.5.1.4.1.1.13.1.1 X-Ray 3D Angiographic Image Storage SOP Class
162
+ 1.2.840.10008.5.1.4.1.1.13.1.2 X-Ray 3D Craniofacial Image Storage SOP Class
163
+ 1.2.840.10008.5.1.4.1.1.13.1.3 Breast Tomosynthesis Image Storage SOP Class
164
+ 1.2.840.10008.5.1.4.1.1.14.1 Intravascular Optical Coherence Tomography Image Storage - For Presentation SOP Class
165
+ 1.2.840.10008.5.1.4.1.1.14.2 Intravascular Optical Coherence Tomography Image Storage - For Processing SOP Class
166
+ 1.2.840.10008.5.1.4.1.1.20 Nuclear Medicine Image Storage SOP Class
167
+ 1.2.840.10008.5.1.4.1.1.66 Raw Data Storage SOP Class
168
+ 1.2.840.10008.5.1.4.1.1.66.1 Spatial Registration Storage SOP Class
169
+ 1.2.840.10008.5.1.4.1.1.66.2 Spatial Fiducials Storage SOP Class
170
+ 1.2.840.10008.5.1.4.1.1.66.3 Deformable Spatial Registration Storage SOP Class
171
+ 1.2.840.10008.5.1.4.1.1.66.4 Segmentation Storage SOP Class
172
+ 1.2.840.10008.5.1.4.1.1.66.5 Surface Segmentation Storage SOP Class
173
+ 1.2.840.10008.5.1.4.1.1.67 Real World Value Mapping Storage SOP Class
174
+ 1.2.840.10008.5.1.4.1.1.77.1 VL Image Storage - Trial (Retired)   R
175
+ 1.2.840.10008.5.1.4.1.1.77.2 VL Multi-frame Image Storage - Trial (Retired)   R
176
+ 1.2.840.10008.5.1.4.1.1.77.1.1 VL Endoscopic Image Storage SOP Class
177
+ 1.2.840.10008.5.1.4.1.1.77.1.1.1 Video Endoscopic Image Storage SOP Class
178
+ 1.2.840.10008.5.1.4.1.1.77.1.2 VL Microscopic Image Storage SOP Class
179
+ 1.2.840.10008.5.1.4.1.1.77.1.2.1 Video Microscopic Image Storage SOP Class
180
+ 1.2.840.10008.5.1.4.1.1.77.1.3 VL Slide-Coordinates Microscopic Image Storage SOP Class
181
+ 1.2.840.10008.5.1.4.1.1.77.1.4 VL Photographic Image Storage SOP Class
182
+ 1.2.840.10008.5.1.4.1.1.77.1.4.1 Video Photographic Image Storage SOP Class
183
+ 1.2.840.10008.5.1.4.1.1.77.1.5.1 Ophthalmic Photography 8 Bit Image Storage SOP Class
184
+ 1.2.840.10008.5.1.4.1.1.77.1.5.2 Ophthalmic Photography 16 Bit Image Storage SOP Class
185
+ 1.2.840.10008.5.1.4.1.1.77.1.5.3 Stereometric Relationship Storage SOP Class
186
+ 1.2.840.10008.5.1.4.1.1.77.1.5.4 Ophthalmic Tomography Image Storage SOP Class
187
+ 1.2.840.10008.5.1.4.1.1.77.1.6 VL Whole Slide Microscopy Image Storage SOP Class
188
+ 1.2.840.10008.5.1.4.1.1.78.1 Lensometry Measurements Storage SOP Class
189
+ 1.2.840.10008.5.1.4.1.1.78.2 Autorefraction Measurements Storage SOP Class
190
+ 1.2.840.10008.5.1.4.1.1.78.3 Keratometry Measurements Storage SOP Class
191
+ 1.2.840.10008.5.1.4.1.1.78.4 Subjective Refraction Measurements Storage SOP Class
192
+ 1.2.840.10008.5.1.4.1.1.78.5 Visual Acuity Measurements Storage SOP Class
193
+ 1.2.840.10008.5.1.4.1.1.78.6 Spectacle Prescription Report Storage SOP Class
194
+ 1.2.840.10008.5.1.4.1.1.78.7 Ophthalmic Axial Measurements Storage SOP Class
195
+ 1.2.840.10008.5.1.4.1.1.78.8 Intraocular Lens Calculations Storage SOP Class
196
+ 1.2.840.10008.5.1.4.1.1.79.1 Macular Grid Thickness and Volume Report Storage SOP Class
197
+ 1.2.840.10008.5.1.4.1.1.80.1 Ophthalmic Visual Field Static Perimetry Measurements Storage SOP Class
198
+ 1.2.840.10008.5.1.4.1.1.88.1 Text SR Storage - Trial (Retired) SOP Class R
199
+ 1.2.840.10008.5.1.4.1.1.88.2 Audio SR Storage - Trial (Retired) SOP Class R
200
+ 1.2.840.10008.5.1.4.1.1.88.3 Detail SR Storage - Trial (Retired) SOP Class R
201
+ 1.2.840.10008.5.1.4.1.1.88.4 Comprehensive SR Storage - Trial (Retired) SOP Class R
202
+ 1.2.840.10008.5.1.4.1.1.88.11 Basic Text SR Storage SOP Class
203
+ 1.2.840.10008.5.1.4.1.1.88.22 Enhanced SR Storage SOP Class
204
+ 1.2.840.10008.5.1.4.1.1.88.33 Comprehensive SR Storage SOP Class
205
+ 1.2.840.10008.5.1.4.1.1.88.40 Procedure Log Storage SOP Class
206
+ 1.2.840.10008.5.1.4.1.1.88.50 Mammography CAD SR Storage SOP Class
207
+ 1.2.840.10008.5.1.4.1.1.88.59 Key Object Selection Document Storage SOP Class
208
+ 1.2.840.10008.5.1.4.1.1.88.65 Chest CAD SR Storage SOP Class
209
+ 1.2.840.10008.5.1.4.1.1.88.67 X-Ray Radiation Dose SR Storage SOP Class
210
+ 1.2.840.10008.5.1.4.1.1.88.69 Colon CAD SR Storage SOP Class
211
+ 1.2.840.10008.5.1.4.1.1.88.70 Implantation Plan SR Storage SOP Class
212
+ 1.2.840.10008.5.1.4.1.1.104.1 Encapsulated PDF Storage SOP Class
213
+ 1.2.840.10008.5.1.4.1.1.104.2 Encapsulated CDA Storage SOP Class
214
+ 1.2.840.10008.5.1.4.1.1.128 Positron Emission Tomography Image Storage SOP Class
215
+ 1.2.840.10008.5.1.4.1.1.129 Standalone PET Curve Storage (Retired) SOP Class R
216
+ 1.2.840.10008.5.1.4.1.1.130 Enhanced PET Image Storage SOP Class
217
+ 1.2.840.10008.5.1.4.1.1.131 Basic Structured Display Storage SOP Class
218
+ 1.2.840.10008.5.1.4.1.1.481.1 RT Image Storage SOP Class
219
+ 1.2.840.10008.5.1.4.1.1.481.2 RT Dose Storage SOP Class
220
+ 1.2.840.10008.5.1.4.1.1.481.3 RT Structure Set Storage SOP Class
221
+ 1.2.840.10008.5.1.4.1.1.481.4 RT Beams Treatment Record Storage SOP Class
222
+ 1.2.840.10008.5.1.4.1.1.481.5 RT Plan Storage SOP Class
223
+ 1.2.840.10008.5.1.4.1.1.481.6 RT Brachy Treatment Record Storage SOP Class
224
+ 1.2.840.10008.5.1.4.1.1.481.7 RT Treatment Summary Record Storage SOP Class
225
+ 1.2.840.10008.5.1.4.1.1.481.8 RT Ion Plan Storage SOP Class
226
+ 1.2.840.10008.5.1.4.1.1.481.9 RT Ion Beams Treatment Record Storage SOP Class
227
+ 1.2.840.10008.5.1.4.1.1.501.1 DICOS CT Image Storage SOP Class
228
+ 1.2.840.10008.5.1.4.1.1.501.2.1 DICOS Digital X-Ray Image Storage - For Presentation SOP Class
229
+ 1.2.840.10008.5.1.4.1.1.501.2.2 DICOS Digital X-Ray Image Storage - For Processing SOP Class
230
+ 1.2.840.10008.5.1.4.1.1.501.3 DICOS Threat Detection Report Storage SOP Class
231
+ 1.2.840.10008.5.1.4.1.1.601.1 Eddy Current Image Storage SOP Class
232
+ 1.2.840.10008.5.1.4.1.1.601.2 Eddy Current Multi-frame Image Storage SOP Class
233
+ 1.2.840.10008.5.1.4.1.2.1.1 Patient Root Query/Retrieve Information Model - FIND SOP Class
234
+ 1.2.840.10008.5.1.4.1.2.1.2 Patient Root Query/Retrieve Information Model - MOVE SOP Class
235
+ 1.2.840.10008.5.1.4.1.2.1.3 Patient Root Query/Retrieve Information Model - GET SOP Class
236
+ 1.2.840.10008.5.1.4.1.2.2.1 Study Root Query/Retrieve Information Model - FIND SOP Class
237
+ 1.2.840.10008.5.1.4.1.2.2.2 Study Root Query/Retrieve Information Model - MOVE SOP Class
238
+ 1.2.840.10008.5.1.4.1.2.2.3 Study Root Query/Retrieve Information Model - GET SOP Class
239
+ 1.2.840.10008.5.1.4.1.2.3.1 Patient/Study Only Query/Retrieve Information Model - FIND (Retired) SOP Class R
240
+ 1.2.840.10008.5.1.4.1.2.3.2 Patient/Study Only Query/Retrieve Information Model - MOVE (Retired) SOP Class R
241
+ 1.2.840.10008.5.1.4.1.2.3.3 Patient/Study Only Query/Retrieve Information Model - GET (Retired) SOP Class R
242
+ 1.2.840.10008.5.1.4.1.2.4.2 Composite Instance Root Retrieve - MOVE SOP Class
243
+ 1.2.840.10008.5.1.4.1.2.4.3 Composite Instance Root Retrieve - GET SOP Class
244
+ 1.2.840.10008.5.1.4.1.2.5.3 Composite Instance Retrieve Without Bulk Data - GET SOP Class
245
+ 1.2.840.10008.5.1.4.31 Modality Worklist Information Model - FIND SOP Class
246
+ 1.2.840.10008.5.1.4.32.1 General Purpose Worklist Information Model - FIND SOP Class
247
+ 1.2.840.10008.5.1.4.32.2 General Purpose Scheduled Procedure Step SOP Class SOP Class
248
+ 1.2.840.10008.5.1.4.32.3 General Purpose Performed Procedure Step SOP Class SOP Class
249
+ 1.2.840.10008.5.1.4.32 General Purpose Worklist Management Meta SOP Class Meta SOP Class
250
+ 1.2.840.10008.5.1.4.33 Instance Availability Notification SOP Class SOP Class
251
+ 1.2.840.10008.5.1.4.34.1 RT Beams Delivery Instruction Storage - Trial (Retired) SOP Class R
252
+ 1.2.840.10008.5.1.4.34.2 RT Conventional Machine Verification - Trial (Retired) SOP Class R
253
+ 1.2.840.10008.5.1.4.34.3 RT Ion Machine Verification - Trial (Retired) SOP Class R
254
+ 1.2.840.10008.5.1.4.34.4 Unified Worklist and Procedure Step Service Class - Trial (Retired) Service Class R
255
+ 1.2.840.10008.5.1.4.34.4.1 Unified Procedure Step - Push SOP Class - Trial (Retired) SOP Class R
256
+ 1.2.840.10008.5.1.4.34.4.2 Unified Procedure Step - Watch SOP Class - Trial (Retired) SOP Class R
257
+ 1.2.840.10008.5.1.4.34.4.3 Unified Procedure Step - Pull SOP Class - Trial (Retired) SOP Class R
258
+ 1.2.840.10008.5.1.4.34.4.4 Unified Procedure Step - Event SOP Class - Trial (Retired) SOP Class R
259
+ 1.2.840.10008.5.1.4.34.5 Unified Worklist and Procedure Step SOP Instance Well-known SOP Instance
260
+ 1.2.840.10008.5.1.4.34.6 Unified Worklist and Procedure Step Service Class Service Class
261
+ 1.2.840.10008.5.1.4.34.6.1 Unified Procedure Step - Push SOP Class SOP Class
262
+ 1.2.840.10008.5.1.4.34.6.2 Unified Procedure Step - Watch SOP Class SOP Class
263
+ 1.2.840.10008.5.1.4.34.6.3 Unified Procedure Step - Pull SOP Class SOP Class
264
+ 1.2.840.10008.5.1.4.34.6.4 Unified Procedure Step - Event SOP Class SOP Class
265
+ 1.2.840.10008.5.1.4.34.7 RT Beams Delivery Instruction Storage SOP Class
266
+ 1.2.840.10008.5.1.4.34.8 RT Conventional Machine Verification SOP Class
267
+ 1.2.840.10008.5.1.4.34.9 RT Ion Machine Verification SOP Class
268
+ 1.2.840.10008.5.1.4.37.1 General Relevant Patient Information Query SOP Class
269
+ 1.2.840.10008.5.1.4.37.2 Breast Imaging Relevant Patient Information Query SOP Class
270
+ 1.2.840.10008.5.1.4.37.3 Cardiac Relevant Patient Information Query SOP Class
271
+ 1.2.840.10008.5.1.4.38.1 Hanging Protocol Storage SOP Class
272
+ 1.2.840.10008.5.1.4.38.2 Hanging Protocol Information Model - FIND SOP Class
273
+ 1.2.840.10008.5.1.4.38.3 Hanging Protocol Information Model - MOVE SOP Class
274
+ 1.2.840.10008.5.1.4.38.4 Hanging Protocol Information Model - GET SOP Class
275
+ 1.2.840.10008.5.1.4.39.1 Color Palette Storage Transfer
276
+ 1.2.840.10008.5.1.4.39.2 Color Palette Information Model - FIND Query/Retrieve
277
+ 1.2.840.10008.5.1.4.39.3 Color Palette Information Model - MOVE Query/Retrieve
278
+ 1.2.840.10008.5.1.4.39.4 Color Palette Information Model - GET Query/Retrieve
279
+ 1.2.840.10008.5.1.4.41 Product Characteristics Query SOP Class SOP Class
280
+ 1.2.840.10008.5.1.4.42 Substance Approval Query SOP Class SOP Class
281
+ 1.2.840.10008.5.1.4.43.1 Generic Implant Template Storage SOP Class
282
+ 1.2.840.10008.5.1.4.43.2 Generic Implant Template Information Model - FIND SOP Class
283
+ 1.2.840.10008.5.1.4.43.3 Generic Implant Template Information Model - MOVE SOP Class
284
+ 1.2.840.10008.5.1.4.43.4 Generic Implant Template Information Model - GET SOP Class
285
+ 1.2.840.10008.5.1.4.44.1 Implant Assembly Template Storage SOP Class
286
+ 1.2.840.10008.5.1.4.44.2 Implant Assembly Template Information Model - FIND SOP Class
287
+ 1.2.840.10008.5.1.4.44.3 Implant Assembly Template Information Model - MOVE SOP Class
288
+ 1.2.840.10008.5.1.4.44.4 Implant Assembly Template Information Model - GET SOP Class
289
+ 1.2.840.10008.5.1.4.45.1 Implant Template Group Storage SOP Class
290
+ 1.2.840.10008.5.1.4.45.2 Implant Template Group Information Model - FIND SOP Class
291
+ 1.2.840.10008.5.1.4.45.3 Implant Template Group Information Model - MOVE SOP Class
292
+ 1.2.840.10008.5.1.4.45.4 Implant Template Group Information Model - GET SOP Class
293
+ 1.2.840.10008.7.1.1 Native DICOM Model Application Hosting Model
294
+ 1.2.840.10008.7.1.2 Abstract Multi-Dimensional Image Model Application Hosting Model
295
+ 1.2.840.10008.15.0.3.1 dicomDeviceName LDAP OID
296
+ 1.2.840.10008.15.0.3.2 dicomDescription LDAP OID
297
+ 1.2.840.10008.15.0.3.3 dicomManufacturer LDAP OID
298
+ 1.2.840.10008.15.0.3.4 dicomManufacturerModelName LDAP OID
299
+ 1.2.840.10008.15.0.3.5 dicomSoftwareVersion LDAP OID
300
+ 1.2.840.10008.15.0.3.6 dicomVendorData LDAP OID
301
+ 1.2.840.10008.15.0.3.7 dicomAETitle LDAP OID
302
+ 1.2.840.10008.15.0.3.8 dicomNetworkConnectionReference LDAP OID
303
+ 1.2.840.10008.15.0.3.9 dicomApplicationCluster LDAP OID
304
+ 1.2.840.10008.15.0.3.10 dicomAssociationInitiator LDAP OID
305
+ 1.2.840.10008.15.0.3.11 dicomAssociationAcceptor LDAP OID
306
+ 1.2.840.10008.15.0.3.12 dicomHostname LDAP OID
307
+ 1.2.840.10008.15.0.3.13 dicomPort LDAP OID
308
+ 1.2.840.10008.15.0.3.14 dicomSOPClass LDAP OID
309
+ 1.2.840.10008.15.0.3.15 dicomTransferRole LDAP OID
310
+ 1.2.840.10008.15.0.3.16 dicomTransferSyntax LDAP OID
311
+ 1.2.840.10008.15.0.3.17 dicomPrimaryDeviceType LDAP OID
312
+ 1.2.840.10008.15.0.3.18 dicomRelatedDeviceReference LDAP OID
313
+ 1.2.840.10008.15.0.3.19 dicomPreferredCalledAETitle LDAP OID
314
+ 1.2.840.10008.15.0.3.20 dicomTLSCyphersuite LDAP OID
315
+ 1.2.840.10008.15.0.3.21 dicomAuthorizedNodeCertificateReference LDAP OID
316
+ 1.2.840.10008.15.0.3.22 dicomThisNodeCertificateReference LDAP OID
317
+ 1.2.840.10008.15.0.3.23 dicomInstalled LDAP OID
318
+ 1.2.840.10008.15.0.3.24 dicomStationName LDAP OID
319
+ 1.2.840.10008.15.0.3.25 dicomDeviceSerialNumber LDAP OID
320
+ 1.2.840.10008.15.0.3.26 dicomInstitutionName LDAP OID
321
+ 1.2.840.10008.15.0.3.27 dicomInstitutionAddress LDAP OID
322
+ 1.2.840.10008.15.0.3.28 dicomInstitutionDepartmentName LDAP OID
323
+ 1.2.840.10008.15.0.3.29 dicomIssuerOfPatientID LDAP OID
324
+ 1.2.840.10008.15.0.3.30 dicomPreferredCallingAETitle LDAP OID
325
+ 1.2.840.10008.15.0.3.31 dicomSupportedCharacterSet LDAP OID
326
+ 1.2.840.10008.15.0.4.1 dicomConfigurationRoot LDAP OID
327
+ 1.2.840.10008.15.0.4.2 dicomDevicesRoot LDAP OID
328
+ 1.2.840.10008.15.0.4.3 dicomUniqueAETitlesRegistryRoot LDAP OID
329
+ 1.2.840.10008.15.0.4.4 dicomDevice LDAP OID
330
+ 1.2.840.10008.15.0.4.5 dicomNetworkAE LDAP OID
331
+ 1.2.840.10008.15.0.4.6 dicomNetworkConnection LDAP OID
332
+ 1.2.840.10008.15.0.4.7 dicomUniqueAETitle LDAP OID
333
+ 1.2.840.10008.15.0.4.8 dicomTransferCapability LDAP OID
334
+ 1.2.840.10008.15.1.1 Universal Coordinated Time Synchronization Frame of Reference
@@ -0,0 +1,61 @@
1
+ module DICOM
2
+
3
+ # This class handles the various Element types (data, file meta, directory structuring)
4
+ # found in the DICOM Data Dictionary.
5
+ #
6
+ class DictionaryElement
7
+
8
+ # The element's name, e.g. 'SOP Instance UID'.
9
+ attr_reader :name
10
+ # The element's retired status string, i.e. an empty string or 'R'.
11
+ attr_reader :retired
12
+ # The element's tag, e.g. '0010,0010'.
13
+ attr_reader :tag
14
+ # The element's value multiplicity, e.g. '1', '2-n'.
15
+ attr_reader :vm
16
+ # The element's value representations, e.g. ['UL'], ['US', 'SS'].
17
+ attr_reader :vrs
18
+
19
+ # Creates a new dictionary element.
20
+ #
21
+ # @param [String] tag the element's tag
22
+ # @param [String] name the element's name
23
+ # @param [Array<String>] vrs the element's value representation(s)
24
+ # @param [String] vm the element's value multiplicity
25
+ # @param [String] retired the element's retired status string
26
+ #
27
+ def initialize(tag, name, vrs, vm, retired)
28
+ @tag = tag
29
+ @name = name
30
+ @vrs = vrs
31
+ @vm = vm
32
+ @retired = retired
33
+ end
34
+
35
+ # Checks if the element is private by analyzing its tag string.
36
+ #
37
+ # @return [Boolean] true if the element is private, and false if not.
38
+ #
39
+ def private?
40
+ @tag.private?
41
+ end
42
+
43
+ # Converts the retired status string to a boolean.
44
+ #
45
+ # @return [Boolean] true if the element is retired, and false if not.
46
+ #
47
+ def retired?
48
+ @retired =~ /R/ ? true : false
49
+ end
50
+
51
+ # Extracts the first (default) value representation of the element's value representations.
52
+ #
53
+ # @return [String] the first value representation listed for this particular element
54
+ #
55
+ def vr
56
+ @vrs[0]
57
+ end
58
+
59
+ end
60
+
61
+ end
@@ -1,219 +1,279 @@
1
- module DICOM
2
-
3
- # The Element class handles information related to ordinary (non-parent) elementals (data elements).
4
- #
5
- class Element
6
-
7
- # Include the Elemental mix-in module:
8
- include Elemental
9
-
10
- # The (decoded) value of the data element.
11
- attr_reader :value
12
-
13
- # Creates a Element instance.
14
- #
15
- # === Notes
16
- #
17
- # * In the case where the Element is given a binary instead of value, the Element will not have a formatted value (value = nil).
18
- # * Private data elements will have their names listed as "Private".
19
- # * Non-private data elements that are not found in the dictionary will be listed as "Unknown".
20
- #
21
- # === Parameters
22
- #
23
- # * <tt>tag</tt> -- A string which identifies the tag of the data element.
24
- # * <tt>value</tt> -- A custom value to be encoded as the data element binary string, or in some cases (specified by options), a pre-encoded binary string.
25
- # * <tt>options</tt> -- A hash of parameters.
26
- #
27
- # === Options
28
- #
29
- # * <tt>:bin</tt> -- String. If you already have the value pre-encoded to a binary string, the string can be supplied with this option to avoid it being encoded a second time.
30
- # * <tt>:encoded</tt> -- Boolean. If the value parameter contains a pre-encoded binary, this boolean must to be set as true.
31
- # * <tt>:name</tt> - String. The name of the Element may be specified upon creation. If it is not, the name will be retrieved from the dictionary.
32
- # * <tt>:parent</tt> - Item or DObject instance which the Element instance shall belong to.
33
- # * <tt>:vr</tt> -- String. If a private Element is created with a custom value, this must be specified to enable the encoding of the value. If it is not specified, the vr will be retrieved from the dictionary.
34
- #
35
- # === Examples
36
- #
37
- # # Create a new data element and connect it to a DObject instance:
38
- # patient_name = Element.new("0010,0010", "John Doe", :parent => dcm)
39
- # # Create a "Pixel Data" element and insert image data that you have already encoded elsewhere:
40
- # pixel_data = Element.new("7FE0,0010", processed_pixel_data, :encoded => true, :parent => dcm)
41
- # # Create a private data element:
42
- # private_data = Element.new("0011,2102", some_data, :parent => dcm, :vr => "LO")
43
- #
44
- def initialize(tag, value, options={})
45
- raise ArgumentError, "The supplied tag (#{tag}) is not valid. The tag must be a string of the form 'GGGG,EEEE'." unless tag.is_a?(String) && tag.tag?
46
- # Set instance variables:
47
- @tag = tag.upcase
48
- # We may beed to retrieve name and vr from the library:
49
- if options[:name] and options[:vr]
50
- @name = options[:name]
51
- @vr = options[:vr].upcase
52
- else
53
- name, vr = LIBRARY.get_name_vr(tag)
54
- @name = options[:name] || name
55
- @vr = (options[:vr] ? options[:vr].upcase : vr)
56
- end
57
- # Value may in some cases be the binary string:
58
- unless options[:encoded]
59
- @value = value
60
- # The Data Element may have a value, have no value and no binary, or have no value and only binary:
61
- if value
62
- # Is binary value provided or do we need to encode it?
63
- if options[:bin]
64
- @bin = options[:bin]
65
- else
66
- if value == ""
67
- @bin = ""
68
- else
69
- @bin = encode(value)
70
- end
71
- end
72
- else
73
- # When no value is present, we set the binary as an empty string, unless the binary is specified:
74
- @bin = options[:bin] || ""
75
- end
76
- else
77
- @bin = value
78
- end
79
- # Let the binary decide the length:
80
- @length = @bin.length
81
- # Manage the parent relation if specified:
82
- if options[:parent]
83
- @parent = options[:parent]
84
- @parent.add(self, :no_follow => true)
85
- end
86
- end
87
-
88
- # Returns true if the argument is an instance with attributes equal to self.
89
- #
90
- def ==(other)
91
- if other.respond_to?(:to_element)
92
- other.send(:state) == state
93
- end
94
- end
95
-
96
- alias_method :eql?, :==
97
-
98
- # Sets the binary string of a Element.
99
- #
100
- # === Notes
101
- #
102
- # If the specified binary has an odd length, a proper pad byte will automatically be appended
103
- # to give it an even length (which is needed to conform with the DICOM standard).
104
- #
105
- # === Parameters
106
- #
107
- # * <tt>new_bin</tt> -- A binary string of encoded data.
108
- #
109
- def bin=(new_bin)
110
- raise ArgumentError, "Expected String, got #{new_bin.class}." unless new_bin.is_a?(String)
111
- # Add a zero byte at the end if the length of the binary is odd:
112
- if new_bin.length.odd?
113
- @bin = new_bin + stream.pad_byte[@vr]
114
- else
115
- @bin = new_bin
116
- end
117
- @value = nil
118
- @length = @bin.length
119
- end
120
-
121
- # Checks if the Element actually has any child elementals.
122
- # Returns false, as Element instances by definition can not have children.
123
- #
124
- def children?
125
- return false
126
- end
127
-
128
- # Returns the endianness of the encoded binary value of this data element.
129
- # Returns false if little endian, true if big endian.
130
- #
131
- def endian
132
- return stream.str_endian
133
- end
134
-
135
- # Generates a Fixnum hash value for this instance.
136
- #
137
- def hash
138
- state.hash
139
- end
140
-
141
- # Returns a string containing a human-readable hash representation of the Element.
142
- #
143
- def inspect
144
- to_hash.inspect
145
- end
146
-
147
- # Checks if the Element is a parent.
148
- # Returns false, as Element instances by definition can not be parents.
149
- #
150
- def is_parent?
151
- return false
152
- end
153
-
154
- # Returns the value of the elemental (used as value in the parent's hash representation).
155
- #
156
- def to_hash
157
- return {self.send(DICOM.key_representation) => value}
158
- end
159
-
160
- # Returns self.
161
- #
162
- def to_element
163
- self
164
- end
165
-
166
- # Returns a json string containing a human-readable representation of the Element.
167
- #
168
- def to_json
169
- to_hash.to_json
170
- end
171
-
172
- # Returns a yaml string containing a human-readable representation of the Element.
173
- #
174
- def to_yaml
175
- to_hash.to_yaml
176
- end
177
-
178
- # Sets the value of the Element instance.
179
- #
180
- # === Notes
181
- #
182
- # In addition to updating the value attribute, the specified value is encoded and used to
183
- # update both the Element's binary and length attributes too.
184
- #
185
- # The specified value must be of a type that is compatible with the Element's value representation (vr).
186
- #
187
- # === Parameters
188
- #
189
- # * <tt>new_value</tt> -- A custom value (String, Fixnum, etc..) that is assigned to the Element.
190
- #
191
- def value=(new_value)
192
- @bin = encode(new_value)
193
- @value = new_value
194
- @length = @bin.length
195
- end
196
-
197
-
198
- # Following methods are private.
199
- private
200
-
201
-
202
- # Encodes a formatted value to a binary string and returns it.
203
- #
204
- # === Parameters
205
- #
206
- # * <tt>formatted_value</tt> -- A custom value (String, Fixnum, etc..).
207
- #
208
- def encode(formatted_value)
209
- return stream.encode_value(formatted_value, @vr)
210
- end
211
-
212
- # Returns the attributes of this instance in an array (for comparison purposes).
213
- #
214
- def state
215
- [@tag, @vr, @value, @bin]
216
- end
217
-
218
- end
1
+ module DICOM
2
+
3
+ # The Element class handles information related to ordinary (non-parent) elementals (data elements).
4
+ #
5
+ class Element
6
+
7
+ # Include the Elemental mix-in module:
8
+ include Elemental
9
+
10
+ # Creates an Element instance.
11
+ #
12
+ # @note In the case where the Element is given a binary instead of value,
13
+ # the Element will not have a formatted value (value = nil).
14
+ # @note Private data elements are named as 'Private'.
15
+ # @note Non-private data elements that are not found in the dictionary are named as 'Unknown'.
16
+ #
17
+ # @param [String] tag a ruby-dicom type element tag string
18
+ # @param [String, Integer, Float, Array, NilClass] value a custom value to be encoded as the data element binary string, or in some cases (specified by options), a pre-encoded binary string
19
+ # @param [Hash] options the options to use for creating the element
20
+ #
21
+ # @option options [String] :bin if you already have the value pre-encoded to a binary string, the string can be supplied with this option to avoid it being encoded a second time
22
+ # @option options [Boolean] :encoded if the value parameter contains a pre-encoded binary, this boolean must to be set as true
23
+ # @option options [String] :name the name of the Element (if not specified, the name is retrieved from the dictionary)
24
+ # @option options [DObject, Item, NilClass] :parent a parent instance (Item or DObject) which the element belongs to
25
+ # @option options [String] :vr if a private element is created with a custom value, this must be specified to enable the encoding of the value (if not specified, the vr is retrieved from the dictionary)
26
+ #
27
+ # @example Create a new data element and connect it to a DObject instance
28
+ # patient_name = Element.new('0010,0010', 'John Doe', :parent => dcm)
29
+ # @example Create a "Pixel Data" element and insert image data that you have already encoded elsewhere
30
+ # pixel_data = Element.new('7FE0,0010', processed_pixel_data, :encoded => true, :parent => dcm)
31
+ # @example Create a private data element
32
+ # private = Element.new('0011,2102', some_data, :parent => dcm, :vr => 'LO')
33
+ #
34
+ def initialize(tag, value, options={})
35
+ raise ArgumentError, "The supplied tag (#{tag}) is not valid. The tag must be a string of the form 'GGGG,EEEE'." unless tag.is_a?(String) && tag.tag?
36
+ # Set instance variables:
37
+ @tag = tag.upcase
38
+ # We may beed to retrieve name and vr from the library:
39
+ if options[:name] and options[:vr]
40
+ @name = options[:name]
41
+ @vr = options[:vr].upcase
42
+ else
43
+ name, vr = LIBRARY.name_and_vr(tag)
44
+ @name = options[:name] || name
45
+ @vr = (options[:vr] ? options[:vr].upcase : vr)
46
+ end
47
+ # Manage the parent relation if specified:
48
+ if options[:parent]
49
+ @parent = options[:parent]
50
+ # FIXME: Because of some implementation problems, attaching the special
51
+ # Data Set Trailing Padding element to a parent is not supported yet!
52
+ @parent.add(self, :no_follow => true) unless @tag == 'FFFC,FFFC' && @parent.is_a?(Sequence)
53
+ end
54
+ # Value may in some cases be the binary string:
55
+ unless options[:encoded]
56
+ # The Data Element may have a value, have no value and no binary, or have no value and only binary:
57
+ if value
58
+ # Is binary value provided or do we need to encode it?
59
+ if options[:bin]
60
+ @value = value
61
+ @bin = options[:bin]
62
+ else
63
+ if value == ''
64
+ @value = value
65
+ @bin = ''
66
+ else
67
+ # Set the value with our custom setter method to get proper encoding:
68
+ self.value = value
69
+ end
70
+ end
71
+ else
72
+ # When no value is present, we set the binary as an empty string, unless the binary is specified:
73
+ @bin = options[:bin] || ''
74
+ end
75
+ else
76
+ @bin = value
77
+ end
78
+ # Let the binary decide the length:
79
+ @length = @bin.length
80
+ end
81
+
82
+ # Checks for equality.
83
+ #
84
+ # Other and self are considered equivalent if they are
85
+ # of compatible types and their attributes are equivalent.
86
+ #
87
+ # @param other an object to be compared with self.
88
+ # @return [Boolean] true if self and other are considered equivalent
89
+ #
90
+ def ==(other)
91
+ if other.respond_to?(:to_element)
92
+ other.send(:state) == state
93
+ end
94
+ end
95
+
96
+ alias_method :eql?, :==
97
+
98
+ # Sets the binary string of a Element.
99
+ #
100
+ # @note if the specified binary has an odd length, a proper pad byte will automatically be appended
101
+ # to give it an even length (which is needed to conform with the DICOM standard).
102
+ #
103
+ # @param [String] new_bin a binary string of encoded data
104
+ #
105
+ def bin=(new_bin)
106
+ raise ArgumentError, "Expected String, got #{new_bin.class}." unless new_bin.is_a?(String)
107
+ # Add a zero byte at the end if the length of the binary is odd:
108
+ if new_bin.length.odd?
109
+ @bin = new_bin + stream.pad_byte[@vr]
110
+ else
111
+ @bin = new_bin
112
+ end
113
+ @value = nil
114
+ @length = @bin.length
115
+ end
116
+
117
+ # Checks if the Element actually has any child elementals.
118
+ #
119
+ # @return [FalseClass] always returns false, as Element instances by definition can't have children
120
+ #
121
+ def children?
122
+ return false
123
+ end
124
+
125
+ # Gives the endianness of the encoded binary value of this element.
126
+ #
127
+ # @return [Boolean] false if little endian, true if big endian
128
+ #
129
+ def endian
130
+ return stream.str_endian
131
+ end
132
+
133
+ # Computes a hash code for this object.
134
+ #
135
+ # @note Two objects with the same attributes will have the same hash code.
136
+ #
137
+ # @return [Fixnum] the object's hash code
138
+ #
139
+ def hash
140
+ state.hash
141
+ end
142
+
143
+ # Gives a string containing a human-readable hash representation of the Element.
144
+ #
145
+ # @return [String] a hash representation string of the element
146
+ #
147
+ def inspect
148
+ to_hash.inspect
149
+ end
150
+
151
+ # Checks if the Element is a parent.
152
+ #
153
+ # @return [FalseClass] always returns false, as Element instances by definition are not parents
154
+ #
155
+ def is_parent?
156
+ return false
157
+ end
158
+
159
+ # Creates a hash representation of the element instance.
160
+ #
161
+ # @note The key representation in this hash is configurable
162
+ # (refer to the DICOM module methods documentation for more details).
163
+ # @return [Hash] a hash containing a key & value pair (e.g. {"Modality"=>"MR"})
164
+ #
165
+ def to_hash
166
+ return {self.send(DICOM.key_representation) => value}
167
+ end
168
+
169
+ # Returns self.
170
+ #
171
+ # @return [Element] self
172
+ #
173
+ def to_element
174
+ self
175
+ end
176
+
177
+ # Gives a json string containing a human-readable representation of the Element.
178
+ #
179
+ # @return [String] a string containing a key & value pair (e.g. "{\"Modality\":\"MR\"}")
180
+ #
181
+ def to_json
182
+ to_hash.to_json
183
+ end
184
+
185
+ # Gives a yaml string containing a human-readable representation of the Element.
186
+ #
187
+ # @return [String] a string containing a key & value pair (e.g. "---\nModality: MR\n")
188
+ #
189
+ def to_yaml
190
+ to_hash.to_yaml
191
+ end
192
+
193
+ # Gives the (decoded) value of the data element.
194
+ #
195
+ # @note Returned string values are automatically converted from their originally
196
+ # encoding (e.g. ISO8859-1 or ASCII-8BIT) to UTF-8 for convenience reasons.
197
+ # If the value string is wanted in its original encoding, extract the data
198
+ # element's bin attribute instead.
199
+ #
200
+ # @note Note that according to the DICOM Standard PS 3.5 C.12.1.1.2, the Character Set only applies
201
+ # to values of data elements of type SH, LO, ST, PN, LT or UT. Currently in ruby-dicom, all
202
+ # string values are encoding converted regardless of VR, but whether this causes any problems is uknown.
203
+ #
204
+ # @return [String, Integer, Float] the formatted element value
205
+ #
206
+ def value
207
+ if @value.is_a?(String)
208
+ # Unless this is actually the Character Set data element,
209
+ # get the character set (note that it may not be available):
210
+ character_set = (@tag != '0008,0005' && top_parent.is_a?(DObject)) ? top_parent.value('0008,0005') : nil
211
+ # Convert to UTF-8 from [original encoding]:
212
+ # In most cases the original encoding is IS0-8859-1 (ISO_IR 100), but if
213
+ # it is not specified in the DICOM object, or if the specified string
214
+ # is not recognized, ASCII-8BIT is assumed.
215
+ @value.encode('UTF-8', ENCODING_NAME[character_set] || 'ASCII-8BIT')
216
+ # If unpleasant encoding exceptions occur, the below version may be considered:
217
+ #@value.encode('UTF-8', ENCODING_NAME[character_set] || 'ASCII-8BIT', :invalid => :replace, :undef => :replace)
218
+ else
219
+ @value
220
+ end
221
+ end
222
+
223
+ # Sets the value of the Element instance.
224
+ #
225
+ # In addition to updating the value attribute, the specified value is encoded to binary
226
+ # and used to update the Element's bin and length attributes too.
227
+ #
228
+ # @note The specified value must be of a type that is compatible with the Element's value representation (vr).
229
+ # @param [String, Integer, Float, Array] new_value a formatted value that is assigned to the element
230
+ #
231
+ def value=(new_value)
232
+ conversion = VALUE_CONVERSION[@vr] || :to_s
233
+ if conversion == :to_s
234
+ # Unless this is actually the Character Set data element,
235
+ # get the character set (note that it may not be available):
236
+ character_set = (@tag != '0008,0005' && top_parent.is_a?(DObject)) ? top_parent.value('0008,0005') : nil
237
+ # Convert to [DObject encoding] from [input string encoding]:
238
+ # In most cases the DObject encoding is IS0-8859-1 (ISO_IR 100), but if
239
+ # it is not specified in the DICOM object, or if the specified string
240
+ # is not recognized, ASCII-8BIT is assumed.
241
+ @value = new_value.to_s.encode(ENCODING_NAME[character_set] || 'ASCII-8BIT', new_value.to_s.encoding.name)
242
+ @bin = encode(@value)
243
+ else
244
+ # We may have an array (of numbers) which needs to be passed directly to
245
+ # the encode method instead of being forced into a numerical:
246
+ if new_value.is_a?(Array)
247
+ @value = new_value
248
+ @bin = encode(@value)
249
+ else
250
+ @value = new_value.send(conversion)
251
+ @bin = encode(@value)
252
+ end
253
+ end
254
+ @length = @bin.length
255
+ end
256
+
257
+
258
+ private
259
+
260
+
261
+ # Encodes a formatted value to a binary string.
262
+ #
263
+ # @param [String, Integer, Float, Array] formatted_value a formatted value
264
+ # @return [String] the encoded, binary string
265
+ #
266
+ def encode(formatted_value)
267
+ stream.encode_value(formatted_value, @vr)
268
+ end
269
+
270
+ # Collects the attributes of this instance.
271
+ #
272
+ # @return [Array<String>] an array of attributes
273
+ #
274
+ def state
275
+ [@tag, @vr, @value, @bin]
276
+ end
277
+
278
+ end
219
279
  end