Mercurial > hg > orthanc
comparison Core/DicomFormat/DicomMap.cpp @ 3647:5120e4985153 storage-commitment
more emphasis on the definition of the main DICOM tags
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 04 Feb 2020 15:44:12 +0100 |
parents | 94f4a18a79cc |
children | 05df4860aea6 |
comparison
equal
deleted
inserted
replaced
3646:5faf76511931 | 3647:5120e4985153 |
---|---|
44 #include "DicomArray.h" | 44 #include "DicomArray.h" |
45 | 45 |
46 | 46 |
47 namespace Orthanc | 47 namespace Orthanc |
48 { | 48 { |
49 static DicomTag patientTags[] = | 49 static const DicomTag PATIENT_MAIN_DICOM_TAGS[] = |
50 { | 50 { |
51 //DicomTag(0x0010, 0x1010), // PatientAge | 51 //DicomTag(0x0010, 0x1010), // PatientAge |
52 //DicomTag(0x0010, 0x1040) // PatientAddress | 52 //DicomTag(0x0010, 0x1040) // PatientAddress |
53 DicomTag(0x0010, 0x0010), // PatientName | 53 DicomTag(0x0010, 0x0010), // PatientName |
54 DicomTag(0x0010, 0x0030), // PatientBirthDate | 54 DicomTag(0x0010, 0x0030), // PatientBirthDate |
55 DicomTag(0x0010, 0x0040), // PatientSex | 55 DicomTag(0x0010, 0x0040), // PatientSex |
56 DicomTag(0x0010, 0x1000), // OtherPatientIDs | 56 DicomTag(0x0010, 0x1000), // OtherPatientIDs |
57 DICOM_TAG_PATIENT_ID | 57 DICOM_TAG_PATIENT_ID |
58 }; | 58 }; |
59 | 59 |
60 static DicomTag studyTags[] = | 60 static const DicomTag STUDY_MAIN_DICOM_TAGS[] = |
61 { | 61 { |
62 //DicomTag(0x0010, 0x1020), // PatientSize | 62 //DicomTag(0x0010, 0x1020), // PatientSize |
63 //DicomTag(0x0010, 0x1030) // PatientWeight | 63 //DicomTag(0x0010, 0x1030) // PatientWeight |
64 DICOM_TAG_STUDY_DATE, | 64 DICOM_TAG_STUDY_DATE, |
65 DicomTag(0x0008, 0x0030), // StudyTime | 65 DicomTag(0x0008, 0x0030), // StudyTime |
71 DICOM_TAG_INSTITUTION_NAME, // New in db v6 | 71 DICOM_TAG_INSTITUTION_NAME, // New in db v6 |
72 DICOM_TAG_REQUESTING_PHYSICIAN, // New in db v6 | 72 DICOM_TAG_REQUESTING_PHYSICIAN, // New in db v6 |
73 DICOM_TAG_REFERRING_PHYSICIAN_NAME // New in db v6 | 73 DICOM_TAG_REFERRING_PHYSICIAN_NAME // New in db v6 |
74 }; | 74 }; |
75 | 75 |
76 static DicomTag seriesTags[] = | 76 static const DicomTag SERIES_MAIN_DICOM_TAGS[] = |
77 { | 77 { |
78 //DicomTag(0x0010, 0x1080), // MilitaryRank | 78 //DicomTag(0x0010, 0x1080), // MilitaryRank |
79 DicomTag(0x0008, 0x0021), // SeriesDate | 79 DicomTag(0x0008, 0x0021), // SeriesDate |
80 DicomTag(0x0008, 0x0031), // SeriesTime | 80 DicomTag(0x0008, 0x0031), // SeriesTime |
81 DICOM_TAG_MODALITY, | 81 DICOM_TAG_MODALITY, |
98 DICOM_TAG_PERFORMED_PROCEDURE_STEP_DESCRIPTION, // New in db v6 | 98 DICOM_TAG_PERFORMED_PROCEDURE_STEP_DESCRIPTION, // New in db v6 |
99 DICOM_TAG_ACQUISITION_DEVICE_PROCESSING_DESCRIPTION, // New in db v6 | 99 DICOM_TAG_ACQUISITION_DEVICE_PROCESSING_DESCRIPTION, // New in db v6 |
100 DICOM_TAG_CONTRAST_BOLUS_AGENT // New in db v6 | 100 DICOM_TAG_CONTRAST_BOLUS_AGENT // New in db v6 |
101 }; | 101 }; |
102 | 102 |
103 static DicomTag instanceTags[] = | 103 static const DicomTag INSTANCE_MAIN_DICOM_TAGS[] = |
104 { | 104 { |
105 DicomTag(0x0008, 0x0012), // InstanceCreationDate | 105 DicomTag(0x0008, 0x0012), // InstanceCreationDate |
106 DicomTag(0x0008, 0x0013), // InstanceCreationTime | 106 DicomTag(0x0008, 0x0013), // InstanceCreationTime |
107 DicomTag(0x0020, 0x0012), // AcquisitionNumber | 107 DicomTag(0x0020, 0x0012), // AcquisitionNumber |
108 DICOM_TAG_IMAGE_INDEX, | 108 DICOM_TAG_IMAGE_INDEX, |
129 ResourceType level) | 129 ResourceType level) |
130 { | 130 { |
131 switch (level) | 131 switch (level) |
132 { | 132 { |
133 case ResourceType_Patient: | 133 case ResourceType_Patient: |
134 tags = patientTags; | 134 tags = PATIENT_MAIN_DICOM_TAGS; |
135 size = sizeof(patientTags) / sizeof(DicomTag); | 135 size = sizeof(PATIENT_MAIN_DICOM_TAGS) / sizeof(DicomTag); |
136 break; | 136 break; |
137 | 137 |
138 case ResourceType_Study: | 138 case ResourceType_Study: |
139 tags = studyTags; | 139 tags = STUDY_MAIN_DICOM_TAGS; |
140 size = sizeof(studyTags) / sizeof(DicomTag); | 140 size = sizeof(STUDY_MAIN_DICOM_TAGS) / sizeof(DicomTag); |
141 break; | 141 break; |
142 | 142 |
143 case ResourceType_Series: | 143 case ResourceType_Series: |
144 tags = seriesTags; | 144 tags = SERIES_MAIN_DICOM_TAGS; |
145 size = sizeof(seriesTags) / sizeof(DicomTag); | 145 size = sizeof(SERIES_MAIN_DICOM_TAGS) / sizeof(DicomTag); |
146 break; | 146 break; |
147 | 147 |
148 case ResourceType_Instance: | 148 case ResourceType_Instance: |
149 tags = instanceTags; | 149 tags = INSTANCE_MAIN_DICOM_TAGS; |
150 size = sizeof(instanceTags) / sizeof(DicomTag); | 150 size = sizeof(INSTANCE_MAIN_DICOM_TAGS) / sizeof(DicomTag); |
151 break; | 151 break; |
152 | 152 |
153 default: | 153 default: |
154 throw OrthancException(ErrorCode_ParameterOutOfRange); | 154 throw OrthancException(ErrorCode_ParameterOutOfRange); |
155 } | 155 } |
210 } | 210 } |
211 | 211 |
212 | 212 |
213 void DicomMap::ExtractPatientInformation(DicomMap& result) const | 213 void DicomMap::ExtractPatientInformation(DicomMap& result) const |
214 { | 214 { |
215 ExtractTags(result, patientTags, sizeof(patientTags) / sizeof(DicomTag)); | 215 ExtractTags(result, PATIENT_MAIN_DICOM_TAGS, sizeof(PATIENT_MAIN_DICOM_TAGS) / sizeof(DicomTag)); |
216 } | 216 } |
217 | 217 |
218 void DicomMap::ExtractStudyInformation(DicomMap& result) const | 218 void DicomMap::ExtractStudyInformation(DicomMap& result) const |
219 { | 219 { |
220 ExtractTags(result, studyTags, sizeof(studyTags) / sizeof(DicomTag)); | 220 ExtractTags(result, STUDY_MAIN_DICOM_TAGS, sizeof(STUDY_MAIN_DICOM_TAGS) / sizeof(DicomTag)); |
221 } | 221 } |
222 | 222 |
223 void DicomMap::ExtractSeriesInformation(DicomMap& result) const | 223 void DicomMap::ExtractSeriesInformation(DicomMap& result) const |
224 { | 224 { |
225 ExtractTags(result, seriesTags, sizeof(seriesTags) / sizeof(DicomTag)); | 225 ExtractTags(result, SERIES_MAIN_DICOM_TAGS, sizeof(SERIES_MAIN_DICOM_TAGS) / sizeof(DicomTag)); |
226 } | 226 } |
227 | 227 |
228 void DicomMap::ExtractInstanceInformation(DicomMap& result) const | 228 void DicomMap::ExtractInstanceInformation(DicomMap& result) const |
229 { | 229 { |
230 ExtractTags(result, instanceTags, sizeof(instanceTags) / sizeof(DicomTag)); | 230 ExtractTags(result, INSTANCE_MAIN_DICOM_TAGS, sizeof(INSTANCE_MAIN_DICOM_TAGS) / sizeof(DicomTag)); |
231 } | 231 } |
232 | 232 |
233 | 233 |
234 | 234 |
235 DicomMap* DicomMap::Clone() const | 235 DicomMap* DicomMap::Clone() const |
309 } | 309 } |
310 } | 310 } |
311 | 311 |
312 void DicomMap::SetupFindPatientTemplate(DicomMap& result) | 312 void DicomMap::SetupFindPatientTemplate(DicomMap& result) |
313 { | 313 { |
314 SetupFindTemplate(result, patientTags, sizeof(patientTags) / sizeof(DicomTag)); | 314 SetupFindTemplate(result, PATIENT_MAIN_DICOM_TAGS, sizeof(PATIENT_MAIN_DICOM_TAGS) / sizeof(DicomTag)); |
315 } | 315 } |
316 | 316 |
317 void DicomMap::SetupFindStudyTemplate(DicomMap& result) | 317 void DicomMap::SetupFindStudyTemplate(DicomMap& result) |
318 { | 318 { |
319 SetupFindTemplate(result, studyTags, sizeof(studyTags) / sizeof(DicomTag)); | 319 SetupFindTemplate(result, STUDY_MAIN_DICOM_TAGS, sizeof(STUDY_MAIN_DICOM_TAGS) / sizeof(DicomTag)); |
320 result.SetValue(DICOM_TAG_ACCESSION_NUMBER, "", false); | 320 result.SetValue(DICOM_TAG_ACCESSION_NUMBER, "", false); |
321 result.SetValue(DICOM_TAG_PATIENT_ID, "", false); | 321 result.SetValue(DICOM_TAG_PATIENT_ID, "", false); |
322 | 322 |
323 // These main DICOM tags are only indirectly related to the | 323 // These main DICOM tags are only indirectly related to the |
324 // General Study Module, remove them | 324 // General Study Module, remove them |
327 result.Remove(DICOM_TAG_REQUESTED_PROCEDURE_DESCRIPTION); | 327 result.Remove(DICOM_TAG_REQUESTED_PROCEDURE_DESCRIPTION); |
328 } | 328 } |
329 | 329 |
330 void DicomMap::SetupFindSeriesTemplate(DicomMap& result) | 330 void DicomMap::SetupFindSeriesTemplate(DicomMap& result) |
331 { | 331 { |
332 SetupFindTemplate(result, seriesTags, sizeof(seriesTags) / sizeof(DicomTag)); | 332 SetupFindTemplate(result, SERIES_MAIN_DICOM_TAGS, sizeof(SERIES_MAIN_DICOM_TAGS) / sizeof(DicomTag)); |
333 result.SetValue(DICOM_TAG_ACCESSION_NUMBER, "", false); | 333 result.SetValue(DICOM_TAG_ACCESSION_NUMBER, "", false); |
334 result.SetValue(DICOM_TAG_PATIENT_ID, "", false); | 334 result.SetValue(DICOM_TAG_PATIENT_ID, "", false); |
335 result.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, "", false); | 335 result.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, "", false); |
336 | 336 |
337 // These tags are considered as "main" by Orthanc, but are not in the Series module | 337 // These tags are considered as "main" by Orthanc, but are not in the Series module |
349 result.Remove(DICOM_TAG_CONTRAST_BOLUS_AGENT); | 349 result.Remove(DICOM_TAG_CONTRAST_BOLUS_AGENT); |
350 } | 350 } |
351 | 351 |
352 void DicomMap::SetupFindInstanceTemplate(DicomMap& result) | 352 void DicomMap::SetupFindInstanceTemplate(DicomMap& result) |
353 { | 353 { |
354 SetupFindTemplate(result, instanceTags, sizeof(instanceTags) / sizeof(DicomTag)); | 354 SetupFindTemplate(result, INSTANCE_MAIN_DICOM_TAGS, sizeof(INSTANCE_MAIN_DICOM_TAGS) / sizeof(DicomTag)); |
355 result.SetValue(DICOM_TAG_ACCESSION_NUMBER, "", false); | 355 result.SetValue(DICOM_TAG_ACCESSION_NUMBER, "", false); |
356 result.SetValue(DICOM_TAG_PATIENT_ID, "", false); | 356 result.SetValue(DICOM_TAG_PATIENT_ID, "", false); |
357 result.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, "", false); | 357 result.SetValue(DICOM_TAG_STUDY_INSTANCE_UID, "", false); |
358 result.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, "", false); | 358 result.SetValue(DICOM_TAG_SERIES_INSTANCE_UID, "", false); |
359 } | 359 } |
369 } | 369 } |
370 | 370 |
371 | 371 |
372 bool DicomMap::IsMainDicomTag(const DicomTag& tag, ResourceType level) | 372 bool DicomMap::IsMainDicomTag(const DicomTag& tag, ResourceType level) |
373 { | 373 { |
374 DicomTag *tags = NULL; | 374 const DicomTag *tags = NULL; |
375 size_t size; | 375 size_t size; |
376 | 376 |
377 switch (level) | 377 switch (level) |
378 { | 378 { |
379 case ResourceType_Patient: | 379 case ResourceType_Patient: |
380 tags = patientTags; | 380 tags = PATIENT_MAIN_DICOM_TAGS; |
381 size = sizeof(patientTags) / sizeof(DicomTag); | 381 size = sizeof(PATIENT_MAIN_DICOM_TAGS) / sizeof(DicomTag); |
382 break; | 382 break; |
383 | 383 |
384 case ResourceType_Study: | 384 case ResourceType_Study: |
385 tags = studyTags; | 385 tags = STUDY_MAIN_DICOM_TAGS; |
386 size = sizeof(studyTags) / sizeof(DicomTag); | 386 size = sizeof(STUDY_MAIN_DICOM_TAGS) / sizeof(DicomTag); |
387 break; | 387 break; |
388 | 388 |
389 case ResourceType_Series: | 389 case ResourceType_Series: |
390 tags = seriesTags; | 390 tags = SERIES_MAIN_DICOM_TAGS; |
391 size = sizeof(seriesTags) / sizeof(DicomTag); | 391 size = sizeof(SERIES_MAIN_DICOM_TAGS) / sizeof(DicomTag); |
392 break; | 392 break; |
393 | 393 |
394 case ResourceType_Instance: | 394 case ResourceType_Instance: |
395 tags = instanceTags; | 395 tags = INSTANCE_MAIN_DICOM_TAGS; |
396 size = sizeof(instanceTags) / sizeof(DicomTag); | 396 size = sizeof(INSTANCE_MAIN_DICOM_TAGS) / sizeof(DicomTag); |
397 break; | 397 break; |
398 | 398 |
399 default: | 399 default: |
400 throw OrthancException(ErrorCode_ParameterOutOfRange); | 400 throw OrthancException(ErrorCode_ParameterOutOfRange); |
401 } | 401 } |
420 } | 420 } |
421 | 421 |
422 | 422 |
423 void DicomMap::GetMainDicomTagsInternal(std::set<DicomTag>& result, ResourceType level) | 423 void DicomMap::GetMainDicomTagsInternal(std::set<DicomTag>& result, ResourceType level) |
424 { | 424 { |
425 DicomTag *tags = NULL; | 425 const DicomTag *tags = NULL; |
426 size_t size; | 426 size_t size; |
427 | 427 |
428 switch (level) | 428 switch (level) |
429 { | 429 { |
430 case ResourceType_Patient: | 430 case ResourceType_Patient: |
431 tags = patientTags; | 431 tags = PATIENT_MAIN_DICOM_TAGS; |
432 size = sizeof(patientTags) / sizeof(DicomTag); | 432 size = sizeof(PATIENT_MAIN_DICOM_TAGS) / sizeof(DicomTag); |
433 break; | 433 break; |
434 | 434 |
435 case ResourceType_Study: | 435 case ResourceType_Study: |
436 tags = studyTags; | 436 tags = STUDY_MAIN_DICOM_TAGS; |
437 size = sizeof(studyTags) / sizeof(DicomTag); | 437 size = sizeof(STUDY_MAIN_DICOM_TAGS) / sizeof(DicomTag); |
438 break; | 438 break; |
439 | 439 |
440 case ResourceType_Series: | 440 case ResourceType_Series: |
441 tags = seriesTags; | 441 tags = SERIES_MAIN_DICOM_TAGS; |
442 size = sizeof(seriesTags) / sizeof(DicomTag); | 442 size = sizeof(SERIES_MAIN_DICOM_TAGS) / sizeof(DicomTag); |
443 break; | 443 break; |
444 | 444 |
445 case ResourceType_Instance: | 445 case ResourceType_Instance: |
446 tags = instanceTags; | 446 tags = INSTANCE_MAIN_DICOM_TAGS; |
447 size = sizeof(instanceTags) / sizeof(DicomTag); | 447 size = sizeof(INSTANCE_MAIN_DICOM_TAGS) / sizeof(DicomTag); |
448 break; | 448 break; |
449 | 449 |
450 default: | 450 default: |
451 throw OrthancException(ErrorCode_ParameterOutOfRange); | 451 throw OrthancException(ErrorCode_ParameterOutOfRange); |
452 } | 452 } |