Mercurial > hg > orthanc
annotate Core/DicomFormat/DicomMap.cpp @ 1511:7962563129c9
starting support of deflate/gzip content types
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 10 Aug 2015 14:18:24 +0200 |
parents | 1412ec22ee0b |
children | 9980875edc7c |
rev | line source |
---|---|
0 | 1 /** |
59 | 2 * Orthanc - A Lightweight, RESTful DICOM Store |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1206
diff
changeset
|
3 * Copyright (C) 2012-2015 Sebastien Jodogne, Medical Physics |
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1206
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
0 | 5 * |
6 * This program is free software: you can redistribute it and/or | |
7 * modify it under the terms of the GNU General Public License as | |
8 * published by the Free Software Foundation, either version 3 of the | |
9 * License, or (at your option) any later version. | |
136 | 10 * |
11 * In addition, as a special exception, the copyright holders of this | |
12 * program give permission to link the code of its release with the | |
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
14 * that use the same license as the "OpenSSL" library), and distribute | |
15 * the linked executables. You must obey the GNU General Public License | |
16 * in all respects for all of the code used other than "OpenSSL". If you | |
17 * modify file(s) with this exception, you may extend this exception to | |
18 * your version of the file(s), but you are not obligated to do so. If | |
19 * you do not wish to do so, delete this exception statement from your | |
20 * version. If you delete this exception statement from all source files | |
21 * in the program, then also delete it here. | |
0 | 22 * |
23 * This program is distributed in the hope that it will be useful, but | |
24 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
26 * General Public License for more details. | |
27 * | |
28 * You should have received a copy of the GNU General Public License | |
29 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
30 **/ | |
31 | |
32 | |
824
a811bdf8b8eb
precompiled headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
730
diff
changeset
|
33 #include "../PrecompiledHeaders.h" |
0 | 34 #include "DicomMap.h" |
35 | |
36 #include <stdio.h> | |
37 #include <memory> | |
38 #include "DicomString.h" | |
1206
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
39 #include "DicomArray.h" |
59 | 40 #include "../OrthancException.h" |
0 | 41 |
42 | |
59 | 43 namespace Orthanc |
0 | 44 { |
45 static DicomTag patientTags[] = | |
46 { | |
38 | 47 //DicomTag(0x0010, 0x1010), // PatientAge |
48 //DicomTag(0x0010, 0x1040) // PatientAddress | |
77 | 49 DicomTag(0x0010, 0x0010), // PatientName |
50 DicomTag(0x0010, 0x0030), // PatientBirthDate | |
51 DicomTag(0x0010, 0x0040), // PatientSex | |
52 DicomTag(0x0010, 0x1000), // OtherPatientIDs | |
80 | 53 DICOM_TAG_PATIENT_ID |
0 | 54 }; |
55 | |
56 static DicomTag studyTags[] = | |
57 { | |
38 | 58 //DicomTag(0x0010, 0x1020), // PatientSize |
59 //DicomTag(0x0010, 0x1030) // PatientWeight | |
77 | 60 DicomTag(0x0008, 0x0020), // StudyDate |
61 DicomTag(0x0008, 0x0030), // StudyTime | |
62 DicomTag(0x0008, 0x1030), // StudyDescription | |
63 DicomTag(0x0020, 0x0010), // StudyID | |
80 | 64 DICOM_TAG_ACCESSION_NUMBER, |
65 DICOM_TAG_STUDY_INSTANCE_UID | |
0 | 66 }; |
67 | |
68 static DicomTag seriesTags[] = | |
69 { | |
38 | 70 //DicomTag(0x0010, 0x1080), // MilitaryRank |
77 | 71 DicomTag(0x0008, 0x0021), // SeriesDate |
72 DicomTag(0x0008, 0x0031), // SeriesTime | |
73 DicomTag(0x0008, 0x0060), // Modality | |
74 DicomTag(0x0008, 0x0070), // Manufacturer | |
75 DicomTag(0x0008, 0x1010), // StationName | |
76 DicomTag(0x0008, 0x103e), // SeriesDescription | |
77 DicomTag(0x0018, 0x0015), // BodyPartExamined | |
78 DicomTag(0x0018, 0x0024), // SequenceName | |
79 DicomTag(0x0018, 0x1030), // ProtocolName | |
80 DicomTag(0x0020, 0x0011), // SeriesNumber | |
433 | 81 DICOM_TAG_CARDIAC_NUMBER_OF_IMAGES, |
80 | 82 DICOM_TAG_IMAGES_IN_ACQUISITION, |
433 | 83 DICOM_TAG_NUMBER_OF_TEMPORAL_POSITIONS, |
80 | 84 DICOM_TAG_NUMBER_OF_SLICES, |
433 | 85 DICOM_TAG_NUMBER_OF_TIME_SLICES, |
80 | 86 DICOM_TAG_SERIES_INSTANCE_UID |
0 | 87 }; |
88 | |
89 static DicomTag instanceTags[] = | |
90 { | |
77 | 91 DicomTag(0x0008, 0x0012), // InstanceCreationDate |
92 DicomTag(0x0008, 0x0013), // InstanceCreationTime | |
93 DicomTag(0x0020, 0x0012), // AcquisitionNumber | |
80 | 94 DICOM_TAG_IMAGE_INDEX, |
95 DICOM_TAG_INSTANCE_NUMBER, | |
84 | 96 DICOM_TAG_NUMBER_OF_FRAMES, |
433 | 97 DICOM_TAG_TEMPORAL_POSITION_IDENTIFIER, |
80 | 98 DICOM_TAG_SOP_INSTANCE_UID |
0 | 99 }; |
100 | |
101 | |
102 | |
103 | |
104 void DicomMap::SetValue(uint16_t group, | |
105 uint16_t element, | |
106 DicomValue* value) | |
107 { | |
108 DicomTag tag(group, element); | |
109 Map::iterator it = map_.find(tag); | |
110 | |
111 if (it != map_.end()) | |
112 { | |
113 delete it->second; | |
114 it->second = value; | |
115 } | |
116 else | |
117 { | |
118 map_.insert(std::make_pair(tag, value)); | |
119 } | |
120 } | |
121 | |
122 void DicomMap::SetValue(DicomTag tag, | |
123 DicomValue* value) | |
124 { | |
125 SetValue(tag.GetGroup(), tag.GetElement(), value); | |
126 } | |
127 | |
128 | |
129 | |
130 | |
131 void DicomMap::Clear() | |
132 { | |
656 | 133 for (Map::iterator it = map_.begin(); it != map_.end(); ++it) |
0 | 134 { |
135 delete it->second; | |
136 } | |
137 | |
138 map_.clear(); | |
139 } | |
140 | |
141 | |
142 void DicomMap::ExtractTags(DicomMap& result, | |
143 const DicomTag* tags, | |
144 size_t count) const | |
145 { | |
146 result.Clear(); | |
147 | |
148 for (unsigned int i = 0; i < count; i++) | |
149 { | |
150 Map::const_iterator it = map_.find(tags[i]); | |
151 if (it != map_.end()) | |
152 { | |
153 result.SetValue(it->first, it->second->Clone()); | |
154 } | |
155 } | |
156 } | |
157 | |
158 | |
159 void DicomMap::ExtractPatientInformation(DicomMap& result) const | |
160 { | |
161 ExtractTags(result, patientTags, sizeof(patientTags) / sizeof(DicomTag)); | |
162 } | |
163 | |
164 void DicomMap::ExtractStudyInformation(DicomMap& result) const | |
165 { | |
166 ExtractTags(result, studyTags, sizeof(studyTags) / sizeof(DicomTag)); | |
167 } | |
168 | |
169 void DicomMap::ExtractSeriesInformation(DicomMap& result) const | |
170 { | |
171 ExtractTags(result, seriesTags, sizeof(seriesTags) / sizeof(DicomTag)); | |
172 } | |
173 | |
174 void DicomMap::ExtractInstanceInformation(DicomMap& result) const | |
175 { | |
176 ExtractTags(result, instanceTags, sizeof(instanceTags) / sizeof(DicomTag)); | |
177 } | |
178 | |
179 | |
80 | 180 |
0 | 181 DicomMap* DicomMap::Clone() const |
182 { | |
183 std::auto_ptr<DicomMap> result(new DicomMap); | |
184 | |
656 | 185 for (Map::const_iterator it = map_.begin(); it != map_.end(); ++it) |
0 | 186 { |
187 result->map_.insert(std::make_pair(it->first, it->second->Clone())); | |
188 } | |
189 | |
190 return result.release(); | |
191 } | |
192 | |
193 | |
1310
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
194 void DicomMap::Assign(const DicomMap& other) |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
195 { |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
196 Clear(); |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
197 |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
198 for (Map::const_iterator it = other.map_.begin(); it != other.map_.end(); ++it) |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
199 { |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
200 map_.insert(std::make_pair(it->first, it->second->Clone())); |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
201 } |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
202 } |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
203 |
61ce8147f30d
custom database back-end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
204 |
0 | 205 const DicomValue& DicomMap::GetValue(const DicomTag& tag) const |
206 { | |
80 | 207 const DicomValue* value = TestAndGetValue(tag); |
208 | |
209 if (value) | |
210 { | |
211 return *value; | |
212 } | |
213 else | |
214 { | |
730
309e686b41e7
better logging about nonexistent tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
215 throw OrthancException(ErrorCode_InexistentTag); |
80 | 216 } |
217 } | |
218 | |
219 | |
220 const DicomValue* DicomMap::TestAndGetValue(const DicomTag& tag) const | |
221 { | |
0 | 222 Map::const_iterator it = map_.find(tag); |
223 | |
224 if (it == map_.end()) | |
225 { | |
80 | 226 return NULL; |
0 | 227 } |
228 else | |
229 { | |
80 | 230 return it->second; |
0 | 231 } |
232 } | |
233 | |
234 | |
235 void DicomMap::Remove(const DicomTag& tag) | |
236 { | |
237 Map::iterator it = map_.find(tag); | |
238 if (it != map_.end()) | |
239 { | |
240 delete it->second; | |
241 map_.erase(it); | |
242 } | |
243 } | |
244 | |
245 | |
246 static void SetupFindTemplate(DicomMap& result, | |
247 const DicomTag* tags, | |
248 size_t count) | |
249 { | |
250 result.Clear(); | |
251 | |
252 for (size_t i = 0; i < count; i++) | |
253 { | |
254 result.SetValue(tags[i], ""); | |
255 } | |
256 } | |
257 | |
258 void DicomMap::SetupFindPatientTemplate(DicomMap& result) | |
259 { | |
260 SetupFindTemplate(result, patientTags, sizeof(patientTags) / sizeof(DicomTag)); | |
261 } | |
262 | |
263 void DicomMap::SetupFindStudyTemplate(DicomMap& result) | |
264 { | |
265 SetupFindTemplate(result, studyTags, sizeof(studyTags) / sizeof(DicomTag)); | |
80 | 266 result.SetValue(DICOM_TAG_ACCESSION_NUMBER, ""); |
267 result.SetValue(DICOM_TAG_PATIENT_ID, ""); | |
0 | 268 } |
269 | |
270 void DicomMap::SetupFindSeriesTemplate(DicomMap& result) | |
271 { | |
272 SetupFindTemplate(result, seriesTags, sizeof(seriesTags) / sizeof(DicomTag)); | |
80 | 273 result.SetValue(DICOM_TAG_ACCESSION_NUMBER, ""); |
274 result.SetValue(DICOM_TAG_PATIENT_ID, ""); | |
275 result.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, ""); | |
1372 | 276 |
277 // These tags are considered as "main" by Orthanc, but are not in the Series module | |
278 result.Remove(DicomTag(0x0008, 0x0070)); // Manufacturer | |
279 result.Remove(DicomTag(0x0008, 0x1010)); // Station name | |
280 result.Remove(DicomTag(0x0018, 0x0024)); // Sequence name | |
281 result.Remove(DICOM_TAG_CARDIAC_NUMBER_OF_IMAGES); | |
282 result.Remove(DICOM_TAG_IMAGES_IN_ACQUISITION); | |
283 result.Remove(DICOM_TAG_NUMBER_OF_SLICES); | |
284 result.Remove(DICOM_TAG_NUMBER_OF_TEMPORAL_POSITIONS); | |
285 result.Remove(DICOM_TAG_NUMBER_OF_TIME_SLICES); | |
0 | 286 } |
287 | |
288 void DicomMap::SetupFindInstanceTemplate(DicomMap& result) | |
289 { | |
290 SetupFindTemplate(result, instanceTags, sizeof(instanceTags) / sizeof(DicomTag)); | |
80 | 291 result.SetValue(DICOM_TAG_ACCESSION_NUMBER, ""); |
292 result.SetValue(DICOM_TAG_PATIENT_ID, ""); | |
293 result.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, ""); | |
294 result.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, ""); | |
0 | 295 } |
296 | |
297 | |
298 void DicomMap::CopyTagIfExists(const DicomMap& source, | |
299 const DicomTag& tag) | |
300 { | |
301 if (source.HasTag(tag)) | |
302 { | |
303 SetValue(tag, source.GetValue(tag)); | |
304 } | |
305 } | |
562
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
306 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
307 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
308 bool DicomMap::IsMainDicomTag(const DicomTag& tag, ResourceType level) |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
309 { |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
310 DicomTag *tags = NULL; |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
311 size_t size; |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
312 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
313 switch (level) |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
314 { |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
315 case ResourceType_Patient: |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
316 tags = patientTags; |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
317 size = sizeof(patientTags) / sizeof(DicomTag); |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
318 break; |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
319 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
320 case ResourceType_Study: |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
321 tags = studyTags; |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
322 size = sizeof(studyTags) / sizeof(DicomTag); |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
323 break; |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
324 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
325 case ResourceType_Series: |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
326 tags = seriesTags; |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
327 size = sizeof(seriesTags) / sizeof(DicomTag); |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
328 break; |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
329 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
330 case ResourceType_Instance: |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
331 tags = instanceTags; |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
332 size = sizeof(instanceTags) / sizeof(DicomTag); |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
333 break; |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
334 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
335 default: |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
336 throw OrthancException(ErrorCode_ParameterOutOfRange); |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
337 } |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
338 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
339 for (size_t i = 0; i < size; i++) |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
340 { |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
341 if (tags[i] == tag) |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
342 { |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
343 return true; |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
344 } |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
345 } |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
346 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
347 return false; |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
348 } |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
349 |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
350 bool DicomMap::IsMainDicomTag(const DicomTag& tag) |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
351 { |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
352 return (IsMainDicomTag(tag, ResourceType_Patient) || |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
353 IsMainDicomTag(tag, ResourceType_Study) || |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
354 IsMainDicomTag(tag, ResourceType_Series) || |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
355 IsMainDicomTag(tag, ResourceType_Instance)); |
f64e3838d6e1
refactoring enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
433
diff
changeset
|
356 } |
567 | 357 |
358 | |
359 void DicomMap::GetMainDicomTagsInternal(std::set<DicomTag>& result, ResourceType level) | |
360 { | |
361 DicomTag *tags = NULL; | |
362 size_t size; | |
363 | |
364 switch (level) | |
365 { | |
366 case ResourceType_Patient: | |
367 tags = patientTags; | |
368 size = sizeof(patientTags) / sizeof(DicomTag); | |
369 break; | |
370 | |
371 case ResourceType_Study: | |
372 tags = studyTags; | |
373 size = sizeof(studyTags) / sizeof(DicomTag); | |
374 break; | |
375 | |
376 case ResourceType_Series: | |
377 tags = seriesTags; | |
378 size = sizeof(seriesTags) / sizeof(DicomTag); | |
379 break; | |
380 | |
381 case ResourceType_Instance: | |
382 tags = instanceTags; | |
383 size = sizeof(instanceTags) / sizeof(DicomTag); | |
384 break; | |
385 | |
386 default: | |
387 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
388 } | |
389 | |
390 for (size_t i = 0; i < size; i++) | |
391 { | |
392 result.insert(tags[i]); | |
393 } | |
394 } | |
395 | |
396 | |
397 void DicomMap::GetMainDicomTags(std::set<DicomTag>& result, ResourceType level) | |
398 { | |
399 result.clear(); | |
400 GetMainDicomTagsInternal(result, level); | |
401 } | |
402 | |
403 | |
404 void DicomMap::GetMainDicomTags(std::set<DicomTag>& result) | |
405 { | |
406 result.clear(); | |
407 GetMainDicomTagsInternal(result, ResourceType_Patient); | |
408 GetMainDicomTagsInternal(result, ResourceType_Study); | |
409 GetMainDicomTagsInternal(result, ResourceType_Series); | |
410 GetMainDicomTagsInternal(result, ResourceType_Instance); | |
411 } | |
1206
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
412 |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
413 |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
414 void DicomMap::Print(FILE* fp) const |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
415 { |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
416 DicomArray a(*this); |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
417 a.Print(fp); |
f5b0207967bc
Fix issue 19 (YBR_FULL are decoded incorrectly)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
418 } |
1360 | 419 |
420 | |
421 void DicomMap::GetTags(std::set<DicomTag>& tags) const | |
422 { | |
423 tags.clear(); | |
424 | |
425 for (Map::const_iterator it = map_.begin(); | |
426 it != map_.end(); ++it) | |
427 { | |
428 tags.insert(it->first); | |
429 } | |
430 } | |
0 | 431 } |