Mercurial > hg > orthanc
annotate OrthancFramework/Sources/DicomFormat/DicomTag.cpp @ 4325:b96aedfa8cc1
unit tests now running in WebAssembly
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 24 Nov 2020 16:21:29 +0100 |
parents | 91554aecff9a |
children | 93c281752e7a |
rev | line source |
---|---|
0 | 1 /** |
59 | 2 * Orthanc - A Lightweight, RESTful DICOM Store |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1276
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
3640
94f4a18a79cc
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
0 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public License |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
10 * the License, or (at your option) any later version. |
136 | 11 * |
0 | 12 * This program is distributed in the hope that it will be useful, but |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
15 * Lesser General Public License for more details. |
0 | 16 * |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
18 * License along with this program. If not, see |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
19 * <http://www.gnu.org/licenses/>. |
0 | 20 **/ |
21 | |
22 | |
824
a811bdf8b8eb
precompiled headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
23 #include "../PrecompiledHeaders.h" |
0 | 24 #include "DicomTag.h" |
25 | |
59 | 26 #include "../OrthancException.h" |
0 | 27 |
28 #include <iostream> | |
29 #include <iomanip> | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
30 #include <stdio.h> |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
31 #include <string.h> |
0 | 32 |
59 | 33 namespace Orthanc |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
34 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
35 static inline uint16_t GetCharValue(char c) |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
36 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
37 if (c >= '0' && c <= '9') |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
38 return c - '0'; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
39 else if (c >= 'a' && c <= 'f') |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
40 return c - 'a' + 10; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
41 else if (c >= 'A' && c <= 'F') |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
42 return c - 'A' + 10; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
43 else |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
44 return 0; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
45 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
46 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
47 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
48 static inline uint16_t GetTagValue(const char* c) |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
49 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
50 return ((GetCharValue(c[0]) << 12) + |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
51 (GetCharValue(c[1]) << 8) + |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
52 (GetCharValue(c[2]) << 4) + |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
53 GetCharValue(c[3])); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
54 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
55 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
56 |
4297 | 57 DicomTag::DicomTag(uint16_t group, uint16_t element) : |
58 group_(group), | |
59 element_(element) | |
60 { | |
61 } | |
62 | |
63 uint16_t DicomTag::GetGroup() const | |
64 { | |
65 return group_; | |
66 } | |
67 | |
68 uint16_t DicomTag::GetElement() const | |
69 { | |
70 return element_; | |
71 } | |
72 | |
73 bool DicomTag::IsPrivate() const | |
74 { | |
75 return group_ % 2 == 1; | |
76 } | |
77 | |
78 | |
0 | 79 bool DicomTag::operator< (const DicomTag& other) const |
80 { | |
81 if (group_ < other.group_) | |
82 return true; | |
83 | |
84 if (group_ > other.group_) | |
85 return false; | |
86 | |
87 return element_ < other.element_; | |
88 } | |
89 | |
90 | |
4218
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
91 bool DicomTag::operator<= (const DicomTag& other) const |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
92 { |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
93 if (group_ < other.group_) |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
94 return true; |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
95 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
96 if (group_ > other.group_) |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
97 return false; |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
98 |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
99 return element_ <= other.element_; |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
100 } |
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
101 |
4297 | 102 bool DicomTag::operator>(const DicomTag &other) const |
103 { | |
104 return !(*this <= other); | |
105 } | |
106 | |
107 bool DicomTag::operator>=(const DicomTag &other) const | |
108 { | |
109 return !(*this < other); | |
110 } | |
111 | |
112 bool DicomTag::operator==(const DicomTag &other) const | |
113 { | |
114 return group_ == other.group_ && element_ == other.element_; | |
115 } | |
116 | |
117 bool DicomTag::operator!=(const DicomTag &other) const | |
118 { | |
119 return !(*this == other); | |
120 } | |
121 | |
4218
8e069a7e1c11
validation against orthanc-tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
122 |
4313
91554aecff9a
removed a friend method for better abi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4297
diff
changeset
|
123 std::ostream& DicomTag::FormatStream(std::ostream& o) const |
0 | 124 { |
125 using namespace std; | |
126 ios_base::fmtflags state = o.flags(); | |
127 o.flags(ios::right | ios::hex); | |
4313
91554aecff9a
removed a friend method for better abi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4297
diff
changeset
|
128 o << "(" << setfill('0') << setw(4) << GetGroup() |
91554aecff9a
removed a friend method for better abi
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4297
diff
changeset
|
129 << "," << setw(4) << GetElement() << ")"; |
0 | 130 o.flags(state); |
131 return o; | |
132 } | |
133 | |
134 | |
35
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
135 std::string DicomTag::Format() const |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
136 { |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
137 char b[16]; |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
138 sprintf(b, "%04x,%04x", group_, element_); |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
139 return std::string(b); |
f6d12037f886
full json vs. simplified json
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
0
diff
changeset
|
140 } |
291
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
141 |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
142 |
2662
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
143 bool DicomTag::ParseHexadecimal(DicomTag& tag, |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
144 const char* value) |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
145 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
146 size_t length = strlen(value); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
147 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
148 if (length == 9 && |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
149 isxdigit(value[0]) && |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
150 isxdigit(value[1]) && |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
151 isxdigit(value[2]) && |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
152 isxdigit(value[3]) && |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
153 (value[4] == '-' || value[4] == ',') && |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
154 isxdigit(value[5]) && |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
155 isxdigit(value[6]) && |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
156 isxdigit(value[7]) && |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
157 isxdigit(value[8])) |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
158 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
159 uint16_t group = GetTagValue(value); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
160 uint16_t element = GetTagValue(value + 5); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
161 tag = DicomTag(group, element); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
162 return true; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
163 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
164 else if (length == 8 && |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
165 isxdigit(value[0]) && |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
166 isxdigit(value[1]) && |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
167 isxdigit(value[2]) && |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
168 isxdigit(value[3]) && |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
169 isxdigit(value[4]) && |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
170 isxdigit(value[5]) && |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
171 isxdigit(value[6]) && |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
172 isxdigit(value[7])) |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
173 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
174 uint16_t group = GetTagValue(value); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
175 uint16_t element = GetTagValue(value + 4); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
176 tag = DicomTag(group, element); |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
177 return true; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
178 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
179 else |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
180 { |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
181 return false; |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
182 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
183 } |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
184 |
47d812308d63
serialization of DicomModification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
185 |
291
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
186 const char* DicomTag::GetMainTagsName() const |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
187 { |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
188 if (*this == DICOM_TAG_ACCESSION_NUMBER) |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
189 return "AccessionNumber"; |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
190 |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
191 if (*this == DICOM_TAG_SOP_INSTANCE_UID) |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
192 return "SOPInstanceUID"; |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
193 |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
194 if (*this == DICOM_TAG_PATIENT_ID) |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
195 return "PatientID"; |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
196 |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
197 if (*this == DICOM_TAG_SERIES_INSTANCE_UID) |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
198 return "SeriesInstanceUID"; |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
199 |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
200 if (*this == DICOM_TAG_STUDY_INSTANCE_UID) |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
201 return "StudyInstanceUID"; |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
202 |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
203 if (*this == DICOM_TAG_PIXEL_DATA) |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
204 return "PixelData"; |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
205 |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
206 if (*this == DICOM_TAG_IMAGE_INDEX) |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
207 return "ImageIndex"; |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
208 |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
209 if (*this == DICOM_TAG_INSTANCE_NUMBER) |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
210 return "InstanceNumber"; |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
211 |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
212 if (*this == DICOM_TAG_NUMBER_OF_SLICES) |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
213 return "NumberOfSlices"; |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
214 |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
215 if (*this == DICOM_TAG_NUMBER_OF_FRAMES) |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
216 return "NumberOfFrames"; |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
217 |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
218 if (*this == DICOM_TAG_CARDIAC_NUMBER_OF_IMAGES) |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
219 return "CardiacNumberOfImages"; |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
220 |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
221 if (*this == DICOM_TAG_IMAGES_IN_ACQUISITION) |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
222 return "ImagesInAcquisition"; |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
223 |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
224 if (*this == DICOM_TAG_PATIENT_NAME) |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
225 return "PatientName"; |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
226 |
1732
5cdea1cd2071
remove display of ImageOrientationPatient and ImagePositionPatient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1725
diff
changeset
|
227 if (*this == DICOM_TAG_IMAGE_POSITION_PATIENT) |
5cdea1cd2071
remove display of ImageOrientationPatient and ImagePositionPatient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1725
diff
changeset
|
228 return "ImagePositionPatient"; |
5cdea1cd2071
remove display of ImageOrientationPatient and ImagePositionPatient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1725
diff
changeset
|
229 |
5cdea1cd2071
remove display of ImageOrientationPatient and ImagePositionPatient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1725
diff
changeset
|
230 if (*this == DICOM_TAG_IMAGE_ORIENTATION_PATIENT) |
5cdea1cd2071
remove display of ImageOrientationPatient and ImagePositionPatient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1725
diff
changeset
|
231 return "ImageOrientationPatient"; |
5cdea1cd2071
remove display of ImageOrientationPatient and ImagePositionPatient
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1725
diff
changeset
|
232 |
3651
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
233 // New in Orthanc 1.6.0, as tagged as "RETIRED_" since DCMTK 3.6.4 |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
234 if (*this == DICOM_TAG_OTHER_PATIENT_IDS) |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
235 return "OtherPatientIDs"; |
46cb00e4adbb
DicomMap::DumpMainDicomTags() and DicomMap::ParseMainDicomTags()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
236 |
291
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
237 return ""; |
4d7469f72a0b
embedding of dicom dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
238 } |
961 | 239 |
240 | |
1368 | 241 void DicomTag::AddTagsForModule(std::set<DicomTag>& target, |
1276
6164f7200c43
refactoring modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
242 DicomModule module) |
961 | 243 { |
244 // REFERENCE: 11_03pu.pdf, DICOM PS 3.3 2011 - Information Object Definitions | |
245 | |
246 switch (module) | |
247 { | |
1276
6164f7200c43
refactoring modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
248 case DicomModule_Patient: |
961 | 249 // This is Table C.7-1 "Patient Module Attributes" (p. 373) |
250 target.insert(DicomTag(0x0010, 0x0010)); // Patient's name | |
251 target.insert(DicomTag(0x0010, 0x0020)); // Patient ID | |
252 target.insert(DicomTag(0x0010, 0x0030)); // Patient's birth date | |
253 target.insert(DicomTag(0x0010, 0x0040)); // Patient's sex | |
254 target.insert(DicomTag(0x0008, 0x1120)); // Referenced patient sequence | |
255 target.insert(DicomTag(0x0010, 0x0032)); // Patient's birth time | |
256 target.insert(DicomTag(0x0010, 0x1000)); // Other patient IDs | |
257 target.insert(DicomTag(0x0010, 0x1002)); // Other patient IDs sequence | |
258 target.insert(DicomTag(0x0010, 0x1001)); // Other patient names | |
259 target.insert(DicomTag(0x0010, 0x2160)); // Ethnic group | |
260 target.insert(DicomTag(0x0010, 0x4000)); // Patient comments | |
261 target.insert(DicomTag(0x0010, 0x2201)); // Patient species description | |
262 target.insert(DicomTag(0x0010, 0x2202)); // Patient species code sequence | |
263 target.insert(DicomTag(0x0010, 0x2292)); // Patient breed description | |
264 target.insert(DicomTag(0x0010, 0x2293)); // Patient breed code sequence | |
265 target.insert(DicomTag(0x0010, 0x2294)); // Breed registration sequence | |
266 target.insert(DicomTag(0x0010, 0x2297)); // Responsible person | |
267 target.insert(DicomTag(0x0010, 0x2298)); // Responsible person role | |
268 target.insert(DicomTag(0x0010, 0x2299)); // Responsible organization | |
269 target.insert(DicomTag(0x0012, 0x0062)); // Patient identity removed | |
270 target.insert(DicomTag(0x0012, 0x0063)); // De-identification method | |
271 target.insert(DicomTag(0x0012, 0x0064)); // De-identification method code sequence | |
272 | |
273 // Table 10-18 ISSUER OF PATIENT ID MACRO (p. 112) | |
274 target.insert(DicomTag(0x0010, 0x0021)); // Issuer of Patient ID | |
275 target.insert(DicomTag(0x0010, 0x0024)); // Issuer of Patient ID qualifiers sequence | |
276 break; | |
277 | |
1276
6164f7200c43
refactoring modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
278 case DicomModule_Study: |
961 | 279 // This is Table C.7-3 "General Study Module Attributes" (p. 378) |
280 target.insert(DicomTag(0x0020, 0x000d)); // Study instance UID | |
281 target.insert(DicomTag(0x0008, 0x0020)); // Study date | |
282 target.insert(DicomTag(0x0008, 0x0030)); // Study time | |
283 target.insert(DicomTag(0x0008, 0x0090)); // Referring physician's name | |
284 target.insert(DicomTag(0x0008, 0x0096)); // Referring physician identification sequence | |
285 target.insert(DicomTag(0x0020, 0x0010)); // Study ID | |
286 target.insert(DicomTag(0x0008, 0x0050)); // Accession number | |
287 target.insert(DicomTag(0x0008, 0x0051)); // Issuer of accession number sequence | |
288 target.insert(DicomTag(0x0008, 0x1030)); // Study description | |
289 target.insert(DicomTag(0x0008, 0x1048)); // Physician(s) of record | |
290 target.insert(DicomTag(0x0008, 0x1049)); // Physician(s) of record identification sequence | |
291 target.insert(DicomTag(0x0008, 0x1060)); // Name of physician(s) reading study | |
292 target.insert(DicomTag(0x0008, 0x1062)); // Physician(s) reading study identification sequence | |
293 target.insert(DicomTag(0x0032, 0x1034)); // Requesting service code sequence | |
294 target.insert(DicomTag(0x0008, 0x1110)); // Referenced study sequence | |
295 target.insert(DicomTag(0x0008, 0x1032)); // Procedure code sequence | |
296 target.insert(DicomTag(0x0040, 0x1012)); // Reason for performed procedure code sequence | |
297 break; | |
298 | |
1276
6164f7200c43
refactoring modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
299 case DicomModule_Series: |
961 | 300 // This is Table C.7-5 "General Series Module Attributes" (p. 385) |
962 | 301 target.insert(DicomTag(0x0008, 0x0060)); // Modality |
302 target.insert(DicomTag(0x0020, 0x000e)); // Series Instance UID | |
303 target.insert(DicomTag(0x0020, 0x0011)); // Series Number | |
304 target.insert(DicomTag(0x0020, 0x0060)); // Laterality | |
305 target.insert(DicomTag(0x0008, 0x0021)); // Series Date | |
306 target.insert(DicomTag(0x0008, 0x0031)); // Series Time | |
307 target.insert(DicomTag(0x0008, 0x1050)); // Performing Physicians’ Name | |
308 target.insert(DicomTag(0x0008, 0x1052)); // Performing Physician Identification Sequence | |
309 target.insert(DicomTag(0x0018, 0x1030)); // Protocol Name | |
310 target.insert(DicomTag(0x0008, 0x103e)); // Series Description | |
311 target.insert(DicomTag(0x0008, 0x103f)); // Series Description Code Sequence | |
312 target.insert(DicomTag(0x0008, 0x1070)); // Operators' Name | |
313 target.insert(DicomTag(0x0008, 0x1072)); // Operator Identification Sequence | |
314 target.insert(DicomTag(0x0008, 0x1111)); // Referenced Performed Procedure Step Sequence | |
315 target.insert(DicomTag(0x0008, 0x1250)); // Related Series Sequence | |
316 target.insert(DicomTag(0x0018, 0x0015)); // Body Part Examined | |
317 target.insert(DicomTag(0x0018, 0x5100)); // Patient Position | |
318 target.insert(DicomTag(0x0028, 0x0108)); // Smallest Pixel Value in Series | |
319 target.insert(DicomTag(0x0029, 0x0109)); // Largest Pixel Value in Series | |
320 target.insert(DicomTag(0x0040, 0x0275)); // Request Attributes Sequence | |
321 target.insert(DicomTag(0x0010, 0x2210)); // Anatomical Orientation Type | |
322 | |
323 // Table 10-16 PERFORMED PROCEDURE STEP SUMMARY MACRO ATTRIBUTES | |
324 target.insert(DicomTag(0x0040, 0x0253)); // Performed Procedure Step ID | |
325 target.insert(DicomTag(0x0040, 0x0244)); // Performed Procedure Step Start Date | |
326 target.insert(DicomTag(0x0040, 0x0245)); // Performed Procedure Step Start Time | |
327 target.insert(DicomTag(0x0040, 0x0254)); // Performed Procedure Step Description | |
328 target.insert(DicomTag(0x0040, 0x0260)); // Performed Protocol Code Sequence | |
329 target.insert(DicomTag(0x0040, 0x0280)); // Comments on the Performed Procedure Step | |
961 | 330 break; |
331 | |
1276
6164f7200c43
refactoring modules
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1162
diff
changeset
|
332 case DicomModule_Instance: |
961 | 333 // This is Table C.12-1 "SOP Common Module Attributes" (p. 1207) |
962 | 334 target.insert(DicomTag(0x0008, 0x0016)); // SOP Class UID |
335 target.insert(DicomTag(0x0008, 0x0018)); // SOP Instance UID | |
336 target.insert(DicomTag(0x0008, 0x0005)); // Specific Character Set | |
337 target.insert(DicomTag(0x0008, 0x0012)); // Instance Creation Date | |
338 target.insert(DicomTag(0x0008, 0x0013)); // Instance Creation Time | |
339 target.insert(DicomTag(0x0008, 0x0014)); // Instance Creator UID | |
340 target.insert(DicomTag(0x0008, 0x001a)); // Related General SOP Class UID | |
341 target.insert(DicomTag(0x0008, 0x001b)); // Original Specialized SOP Class UID | |
342 target.insert(DicomTag(0x0008, 0x0110)); // Coding Scheme Identification Sequence | |
343 target.insert(DicomTag(0x0008, 0x0201)); // Timezone Offset From UTC | |
344 target.insert(DicomTag(0x0018, 0xa001)); // Contributing Equipment Sequence | |
345 target.insert(DicomTag(0x0020, 0x0013)); // Instance Number | |
346 target.insert(DicomTag(0x0100, 0x0410)); // SOP Instance Status | |
347 target.insert(DicomTag(0x0100, 0x0420)); // SOP Authorization DateTime | |
348 target.insert(DicomTag(0x0100, 0x0424)); // SOP Authorization Comment | |
349 target.insert(DicomTag(0x0100, 0x0426)); // Authorization Equipment Certification Number | |
350 target.insert(DicomTag(0x0400, 0x0500)); // Encrypted Attributes Sequence | |
351 target.insert(DicomTag(0x0400, 0x0561)); // Original Attributes Sequence | |
352 target.insert(DicomTag(0x0040, 0xa390)); // HL7 Structured Document Reference Sequence | |
353 target.insert(DicomTag(0x0028, 0x0303)); // Longitudinal Temporal Information Modified | |
354 | |
355 // Table C.12-6 "DIGITAL SIGNATURES MACRO ATTRIBUTES" (p. 1216) | |
356 target.insert(DicomTag(0x4ffe, 0x0001)); // MAC Parameters sequence | |
357 target.insert(DicomTag(0xfffa, 0xfffa)); // Digital signatures sequence | |
961 | 358 break; |
359 | |
962 | 360 // TODO IMAGE MODULE? |
361 | |
961 | 362 default: |
363 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
364 } | |
365 } | |
0 | 366 } |