comparison UnitTestsSources/DicomMapTests.cpp @ 3015:abe49ca61cd5

On C-FIND, avoid accessing the storage area whenever possible
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 14 Dec 2018 12:10:03 +0100
parents 0e1755e5efd0
children 07ab06af90ed
comparison
equal deleted inserted replaced
3014:b9f0b0c0b36f 3015:abe49ca61cd5
509 509
510 TEST(DicomMap, ExtractMainDicomTags) 510 TEST(DicomMap, ExtractMainDicomTags)
511 { 511 {
512 DicomMap b; 512 DicomMap b;
513 b.SetValue(DICOM_TAG_PATIENT_NAME, "E", false); 513 b.SetValue(DICOM_TAG_PATIENT_NAME, "E", false);
514 ASSERT_TRUE(b.HasOnlyMainDicomTags());
514 515
515 { 516 {
516 DicomMap a; 517 DicomMap a;
517 a.SetValue(DICOM_TAG_PATIENT_NAME, "A", false); 518 a.SetValue(DICOM_TAG_PATIENT_NAME, "A", false);
518 a.SetValue(DICOM_TAG_STUDY_DESCRIPTION, "B", false); 519 a.SetValue(DICOM_TAG_STUDY_DESCRIPTION, "B", false);
519 a.SetValue(DICOM_TAG_SERIES_DESCRIPTION, "C", false); 520 a.SetValue(DICOM_TAG_SERIES_DESCRIPTION, "C", false);
520 a.SetValue(DICOM_TAG_NUMBER_OF_FRAMES, "D", false); 521 a.SetValue(DICOM_TAG_NUMBER_OF_FRAMES, "D", false);
521 a.SetValue(DICOM_TAG_SLICE_THICKNESS, "F", false); 522 a.SetValue(DICOM_TAG_SLICE_THICKNESS, "F", false);
523 ASSERT_FALSE(a.HasOnlyMainDicomTags());
522 b.ExtractMainDicomTags(a); 524 b.ExtractMainDicomTags(a);
523 } 525 }
524 526
525 ASSERT_EQ(4u, b.GetSize()); 527 ASSERT_EQ(4u, b.GetSize());
526 ASSERT_EQ("A", b.GetValue(DICOM_TAG_PATIENT_NAME).GetContent()); 528 ASSERT_EQ("A", b.GetValue(DICOM_TAG_PATIENT_NAME).GetContent());
527 ASSERT_EQ("B", b.GetValue(DICOM_TAG_STUDY_DESCRIPTION).GetContent()); 529 ASSERT_EQ("B", b.GetValue(DICOM_TAG_STUDY_DESCRIPTION).GetContent());
528 ASSERT_EQ("C", b.GetValue(DICOM_TAG_SERIES_DESCRIPTION).GetContent()); 530 ASSERT_EQ("C", b.GetValue(DICOM_TAG_SERIES_DESCRIPTION).GetContent());
529 ASSERT_EQ("D", b.GetValue(DICOM_TAG_NUMBER_OF_FRAMES).GetContent()); 531 ASSERT_EQ("D", b.GetValue(DICOM_TAG_NUMBER_OF_FRAMES).GetContent());
530 ASSERT_FALSE(b.HasTag(DICOM_TAG_SLICE_THICKNESS)); 532 ASSERT_FALSE(b.HasTag(DICOM_TAG_SLICE_THICKNESS));
533 ASSERT_TRUE(b.HasOnlyMainDicomTags());
531 534
532 b.SetValue(DICOM_TAG_PATIENT_NAME, "G", false); 535 b.SetValue(DICOM_TAG_PATIENT_NAME, "G", false);
533 536
534 { 537 {
535 DicomMap a; 538 DicomMap a;
536 a.SetValue(DICOM_TAG_PATIENT_NAME, "A", false); 539 a.SetValue(DICOM_TAG_PATIENT_NAME, "A", false);
537 a.SetValue(DICOM_TAG_SLICE_THICKNESS, "F", false); 540 a.SetValue(DICOM_TAG_SLICE_THICKNESS, "F", false);
541 ASSERT_FALSE(a.HasOnlyMainDicomTags());
538 b.Merge(a); 542 b.Merge(a);
539 } 543 }
540 544
541 ASSERT_EQ(5u, b.GetSize()); 545 ASSERT_EQ(5u, b.GetSize());
542 ASSERT_EQ("G", b.GetValue(DICOM_TAG_PATIENT_NAME).GetContent()); 546 ASSERT_EQ("G", b.GetValue(DICOM_TAG_PATIENT_NAME).GetContent());
543 ASSERT_EQ("B", b.GetValue(DICOM_TAG_STUDY_DESCRIPTION).GetContent()); 547 ASSERT_EQ("B", b.GetValue(DICOM_TAG_STUDY_DESCRIPTION).GetContent());
544 ASSERT_EQ("C", b.GetValue(DICOM_TAG_SERIES_DESCRIPTION).GetContent()); 548 ASSERT_EQ("C", b.GetValue(DICOM_TAG_SERIES_DESCRIPTION).GetContent());
545 ASSERT_EQ("D", b.GetValue(DICOM_TAG_NUMBER_OF_FRAMES).GetContent()); 549 ASSERT_EQ("D", b.GetValue(DICOM_TAG_NUMBER_OF_FRAMES).GetContent());
546 ASSERT_EQ("F", b.GetValue(DICOM_TAG_SLICE_THICKNESS).GetContent()); 550 ASSERT_EQ("F", b.GetValue(DICOM_TAG_SLICE_THICKNESS).GetContent());
547 } 551 ASSERT_FALSE(b.HasOnlyMainDicomTags());
552 }