comparison OrthancFramework/UnitTestsSources/DicomMapTests.cpp @ 4940:304514ce84ee more-tags

tools/find + C-Find + list-resources now all using the same code (ExpandResource) to build 'computed tags'
author Alain Mazy <am@osimis.io>
date Tue, 15 Mar 2022 15:57:21 +0100
parents 312c6f4da888
children f377d5643538
comparison
equal deleted inserted replaced
4939:e8a2e145c80e 4940:304514ce84ee
553 ASSERT_EQ("D", b.GetValue(DICOM_TAG_NUMBER_OF_FRAMES).GetContent()); 553 ASSERT_EQ("D", b.GetValue(DICOM_TAG_NUMBER_OF_FRAMES).GetContent());
554 ASSERT_EQ("F", b.GetValue(DICOM_TAG_SLICE_THICKNESS).GetContent()); 554 ASSERT_EQ("F", b.GetValue(DICOM_TAG_SLICE_THICKNESS).GetContent());
555 ASSERT_FALSE(b.HasOnlyMainDicomTags()); 555 ASSERT_FALSE(b.HasOnlyMainDicomTags());
556 } 556 }
557 557
558
559 TEST(DicomMap, ComputedTags)
560 {
561 {
562 std::set<DicomTag> tags;
563
564 ASSERT_FALSE(DicomMap::HasOnlyComputedTags(tags));
565 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Instance));
566 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Series));
567 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Study));
568 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Patient));
569 }
570
571 {
572 std::set<DicomTag> tags;
573 tags.insert(DICOM_TAG_ACCESSION_NUMBER);
574
575 ASSERT_FALSE(DicomMap::HasOnlyComputedTags(tags));
576 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Instance));
577 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Series));
578 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Study));
579 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Patient));
580 }
581
582 {
583 std::set<DicomTag> tags;
584 tags.insert(DICOM_TAG_MODALITIES_IN_STUDY);
585
586 ASSERT_TRUE(DicomMap::HasOnlyComputedTags(tags));
587 ASSERT_TRUE(DicomMap::HasComputedTags(tags, ResourceType_Study));
588 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Patient));
589 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Series));
590 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Instance));
591 }
592
593 {
594 std::set<DicomTag> tags;
595 tags.insert(DICOM_TAG_ACCESSION_NUMBER);
596 tags.insert(DICOM_TAG_MODALITIES_IN_STUDY);
597
598 ASSERT_FALSE(DicomMap::HasOnlyComputedTags(tags));
599 ASSERT_TRUE(DicomMap::HasComputedTags(tags, ResourceType_Study));
600 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Patient));
601 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Series));
602 ASSERT_FALSE(DicomMap::HasComputedTags(tags, ResourceType_Instance));
603 }
604
605 }
558 606
559 TEST(DicomMap, RemoveBinary) 607 TEST(DicomMap, RemoveBinary)
560 { 608 {
561 DicomMap b; 609 DicomMap b;
562 b.SetValue(DICOM_TAG_PATIENT_NAME, "A", false); 610 b.SetValue(DICOM_TAG_PATIENT_NAME, "A", false);