Mercurial > hg > orthanc
comparison UnitTestsSources/FromDcmtkTests.cpp @ 1971:869a87c08673
fix for mingw <= 4.2
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 11 Apr 2016 13:50:44 +0200 |
parents | a1c1c606ce98 |
children | 4b545a8b1f95 |
comparison
equal
deleted
inserted
replaced
1970:a1c1c606ce98 | 1971:869a87c08673 |
---|---|
539 f.Insert(DicomTag(0x7053, 0x1000), "Some private tag", false); // Odd group => private tag | 539 f.Insert(DicomTag(0x7053, 0x1000), "Some private tag", false); // Odd group => private tag |
540 | 540 |
541 Json::Value v; | 541 Json::Value v; |
542 f.ToJson(v, DicomToJsonFormat_Short, DicomToJsonFlags_None, 0); | 542 f.ToJson(v, DicomToJsonFormat_Short, DicomToJsonFlags_None, 0); |
543 ASSERT_EQ(Json::objectValue, v.type()); | 543 ASSERT_EQ(Json::objectValue, v.type()); |
544 ASSERT_EQ(6, v.getMemberNames().size()); | 544 ASSERT_EQ(6u, v.getMemberNames().size()); |
545 ASSERT_FALSE(v.isMember("7052,1000")); | 545 ASSERT_FALSE(v.isMember("7052,1000")); |
546 ASSERT_FALSE(v.isMember("7053,1000")); | 546 ASSERT_FALSE(v.isMember("7053,1000")); |
547 ASSERT_TRUE(v.isMember("7050,1000")); | 547 ASSERT_TRUE(v.isMember("7050,1000")); |
548 ASSERT_EQ(Json::stringValue, v["7050,1000"].type()); | 548 ASSERT_EQ(Json::stringValue, v["7050,1000"].type()); |
549 ASSERT_EQ("Some public tag", v["7050,1000"].asString()); | 549 ASSERT_EQ("Some public tag", v["7050,1000"].asString()); |
550 | 550 |
551 f.ToJson(v, DicomToJsonFormat_Short, static_cast<DicomToJsonFlags>(DicomToJsonFlags_IncludePrivateTags | DicomToJsonFlags_ConvertBinaryToNull), 0); | 551 f.ToJson(v, DicomToJsonFormat_Short, static_cast<DicomToJsonFlags>(DicomToJsonFlags_IncludePrivateTags | DicomToJsonFlags_ConvertBinaryToNull), 0); |
552 ASSERT_EQ(Json::objectValue, v.type()); | 552 ASSERT_EQ(Json::objectValue, v.type()); |
553 ASSERT_EQ(7, v.getMemberNames().size()); | 553 ASSERT_EQ(7u, v.getMemberNames().size()); |
554 ASSERT_FALSE(v.isMember("7052,1000")); | 554 ASSERT_FALSE(v.isMember("7052,1000")); |
555 ASSERT_TRUE(v.isMember("7050,1000")); | 555 ASSERT_TRUE(v.isMember("7050,1000")); |
556 ASSERT_TRUE(v.isMember("7053,1000")); | 556 ASSERT_TRUE(v.isMember("7053,1000")); |
557 ASSERT_EQ("Some public tag", v["7050,1000"].asString()); | 557 ASSERT_EQ("Some public tag", v["7050,1000"].asString()); |
558 ASSERT_EQ(Json::nullValue, v["7053,1000"].type()); | 558 ASSERT_EQ(Json::nullValue, v["7053,1000"].type()); |
559 | 559 |
560 f.ToJson(v, DicomToJsonFormat_Short, DicomToJsonFlags_IncludePrivateTags, 0); | 560 f.ToJson(v, DicomToJsonFormat_Short, DicomToJsonFlags_IncludePrivateTags, 0); |
561 ASSERT_EQ(Json::objectValue, v.type()); | 561 ASSERT_EQ(Json::objectValue, v.type()); |
562 ASSERT_EQ(7, v.getMemberNames().size()); | 562 ASSERT_EQ(7u, v.getMemberNames().size()); |
563 ASSERT_FALSE(v.isMember("7052,1000")); | 563 ASSERT_FALSE(v.isMember("7052,1000")); |
564 ASSERT_TRUE(v.isMember("7050,1000")); | 564 ASSERT_TRUE(v.isMember("7050,1000")); |
565 ASSERT_TRUE(v.isMember("7053,1000")); | 565 ASSERT_TRUE(v.isMember("7053,1000")); |
566 ASSERT_EQ("Some public tag", v["7050,1000"].asString()); | 566 ASSERT_EQ("Some public tag", v["7050,1000"].asString()); |
567 std::string mime, content; | 567 std::string mime, content; |
570 ASSERT_EQ("application/octet-stream", mime); | 570 ASSERT_EQ("application/octet-stream", mime); |
571 ASSERT_EQ("Some private tag", content); | 571 ASSERT_EQ("Some private tag", content); |
572 | 572 |
573 f.ToJson(v, DicomToJsonFormat_Short, static_cast<DicomToJsonFlags>(DicomToJsonFlags_IncludeUnknownTags | DicomToJsonFlags_ConvertBinaryToNull), 0); | 573 f.ToJson(v, DicomToJsonFormat_Short, static_cast<DicomToJsonFlags>(DicomToJsonFlags_IncludeUnknownTags | DicomToJsonFlags_ConvertBinaryToNull), 0); |
574 ASSERT_EQ(Json::objectValue, v.type()); | 574 ASSERT_EQ(Json::objectValue, v.type()); |
575 ASSERT_EQ(7, v.getMemberNames().size()); | 575 ASSERT_EQ(7u, v.getMemberNames().size()); |
576 ASSERT_TRUE(v.isMember("7050,1000")); | 576 ASSERT_TRUE(v.isMember("7050,1000")); |
577 ASSERT_TRUE(v.isMember("7052,1000")); | 577 ASSERT_TRUE(v.isMember("7052,1000")); |
578 ASSERT_FALSE(v.isMember("7053,1000")); | 578 ASSERT_FALSE(v.isMember("7053,1000")); |
579 ASSERT_EQ("Some public tag", v["7050,1000"].asString()); | 579 ASSERT_EQ("Some public tag", v["7050,1000"].asString()); |
580 ASSERT_EQ(Json::nullValue, v["7052,1000"].type()); | 580 ASSERT_EQ(Json::nullValue, v["7052,1000"].type()); |
581 | 581 |
582 f.ToJson(v, DicomToJsonFormat_Short, static_cast<DicomToJsonFlags>(DicomToJsonFlags_IncludeUnknownTags), 0); | 582 f.ToJson(v, DicomToJsonFormat_Short, static_cast<DicomToJsonFlags>(DicomToJsonFlags_IncludeUnknownTags), 0); |
583 ASSERT_EQ(Json::objectValue, v.type()); | 583 ASSERT_EQ(Json::objectValue, v.type()); |
584 ASSERT_EQ(7, v.getMemberNames().size()); | 584 ASSERT_EQ(7u, v.getMemberNames().size()); |
585 ASSERT_TRUE(v.isMember("7050,1000")); | 585 ASSERT_TRUE(v.isMember("7050,1000")); |
586 ASSERT_TRUE(v.isMember("7052,1000")); | 586 ASSERT_TRUE(v.isMember("7052,1000")); |
587 ASSERT_FALSE(v.isMember("7053,1000")); | 587 ASSERT_FALSE(v.isMember("7053,1000")); |
588 ASSERT_EQ("Some public tag", v["7050,1000"].asString()); | 588 ASSERT_EQ("Some public tag", v["7050,1000"].asString()); |
589 ASSERT_EQ(Json::stringValue, v["7052,1000"].type()); | 589 ASSERT_EQ(Json::stringValue, v["7052,1000"].type()); |
591 ASSERT_EQ("application/octet-stream", mime); | 591 ASSERT_EQ("application/octet-stream", mime); |
592 ASSERT_EQ("Some unknown tag", content); | 592 ASSERT_EQ("Some unknown tag", content); |
593 | 593 |
594 f.ToJson(v, DicomToJsonFormat_Short, static_cast<DicomToJsonFlags>(DicomToJsonFlags_IncludeUnknownTags | DicomToJsonFlags_IncludePrivateTags | DicomToJsonFlags_ConvertBinaryToNull), 0); | 594 f.ToJson(v, DicomToJsonFormat_Short, static_cast<DicomToJsonFlags>(DicomToJsonFlags_IncludeUnknownTags | DicomToJsonFlags_IncludePrivateTags | DicomToJsonFlags_ConvertBinaryToNull), 0); |
595 ASSERT_EQ(Json::objectValue, v.type()); | 595 ASSERT_EQ(Json::objectValue, v.type()); |
596 ASSERT_EQ(8, v.getMemberNames().size()); | 596 ASSERT_EQ(8u, v.getMemberNames().size()); |
597 ASSERT_TRUE(v.isMember("7050,1000")); | 597 ASSERT_TRUE(v.isMember("7050,1000")); |
598 ASSERT_TRUE(v.isMember("7052,1000")); | 598 ASSERT_TRUE(v.isMember("7052,1000")); |
599 ASSERT_TRUE(v.isMember("7053,1000")); | 599 ASSERT_TRUE(v.isMember("7053,1000")); |
600 ASSERT_EQ("Some public tag", v["7050,1000"].asString()); | 600 ASSERT_EQ("Some public tag", v["7050,1000"].asString()); |
601 ASSERT_EQ(Json::nullValue, v["7052,1000"].type()); | 601 ASSERT_EQ(Json::nullValue, v["7052,1000"].type()); |
609 f.Insert(DICOM_TAG_PIXEL_DATA, "Pixels", false); | 609 f.Insert(DICOM_TAG_PIXEL_DATA, "Pixels", false); |
610 | 610 |
611 Json::Value v; | 611 Json::Value v; |
612 f.ToJson(v, DicomToJsonFormat_Short, DicomToJsonFlags_None, 0); | 612 f.ToJson(v, DicomToJsonFormat_Short, DicomToJsonFlags_None, 0); |
613 ASSERT_EQ(Json::objectValue, v.type()); | 613 ASSERT_EQ(Json::objectValue, v.type()); |
614 ASSERT_EQ(5, v.getMemberNames().size()); | 614 ASSERT_EQ(5u, v.getMemberNames().size()); |
615 ASSERT_FALSE(v.isMember("7fe0,0010")); | 615 ASSERT_FALSE(v.isMember("7fe0,0010")); |
616 | 616 |
617 f.ToJson(v, DicomToJsonFormat_Short, static_cast<DicomToJsonFlags>(DicomToJsonFlags_IncludePixelData | DicomToJsonFlags_ConvertBinaryToNull), 0); | 617 f.ToJson(v, DicomToJsonFormat_Short, static_cast<DicomToJsonFlags>(DicomToJsonFlags_IncludePixelData | DicomToJsonFlags_ConvertBinaryToNull), 0); |
618 ASSERT_EQ(Json::objectValue, v.type()); | 618 ASSERT_EQ(Json::objectValue, v.type()); |
619 ASSERT_EQ(6, v.getMemberNames().size()); | 619 ASSERT_EQ(6u, v.getMemberNames().size()); |
620 ASSERT_TRUE(v.isMember("7fe0,0010")); | 620 ASSERT_TRUE(v.isMember("7fe0,0010")); |
621 ASSERT_EQ(Json::nullValue, v["7fe0,0010"].type()); | 621 ASSERT_EQ(Json::nullValue, v["7fe0,0010"].type()); |
622 | 622 |
623 f.ToJson(v, DicomToJsonFormat_Short, static_cast<DicomToJsonFlags>(DicomToJsonFlags_IncludePixelData | DicomToJsonFlags_ConvertBinaryToAscii), 0); | 623 f.ToJson(v, DicomToJsonFormat_Short, static_cast<DicomToJsonFlags>(DicomToJsonFlags_IncludePixelData | DicomToJsonFlags_ConvertBinaryToAscii), 0); |
624 ASSERT_EQ(Json::objectValue, v.type()); | 624 ASSERT_EQ(Json::objectValue, v.type()); |
625 ASSERT_EQ(6, v.getMemberNames().size()); | 625 ASSERT_EQ(6u, v.getMemberNames().size()); |
626 ASSERT_TRUE(v.isMember("7fe0,0010")); | 626 ASSERT_TRUE(v.isMember("7fe0,0010")); |
627 ASSERT_EQ(Json::stringValue, v["7fe0,0010"].type()); | 627 ASSERT_EQ(Json::stringValue, v["7fe0,0010"].type()); |
628 ASSERT_EQ("Pixels", v["7fe0,0010"].asString()); | 628 ASSERT_EQ("Pixels", v["7fe0,0010"].asString()); |
629 | 629 |
630 f.ToJson(v, DicomToJsonFormat_Short, DicomToJsonFlags_IncludePixelData, 0); | 630 f.ToJson(v, DicomToJsonFormat_Short, DicomToJsonFlags_IncludePixelData, 0); |
631 ASSERT_EQ(Json::objectValue, v.type()); | 631 ASSERT_EQ(Json::objectValue, v.type()); |
632 ASSERT_EQ(6, v.getMemberNames().size()); | 632 ASSERT_EQ(6u, v.getMemberNames().size()); |
633 ASSERT_TRUE(v.isMember("7fe0,0010")); | 633 ASSERT_TRUE(v.isMember("7fe0,0010")); |
634 ASSERT_EQ(Json::stringValue, v["7fe0,0010"].type()); | 634 ASSERT_EQ(Json::stringValue, v["7fe0,0010"].type()); |
635 std::string mime, content; | 635 std::string mime, content; |
636 Toolbox::DecodeDataUriScheme(mime, content, v["7fe0,0010"].asString()); | 636 Toolbox::DecodeDataUriScheme(mime, content, v["7fe0,0010"].asString()); |
637 ASSERT_EQ("application/octet-stream", mime); | 637 ASSERT_EQ("application/octet-stream", mime); |
805 std::string s; | 805 std::string s; |
806 Orthanc::Toolbox::ReadFile(s, PATH); | 806 Orthanc::Toolbox::ReadFile(s, PATH); |
807 Orthanc::ParsedDicomFile f(s); | 807 Orthanc::ParsedDicomFile f(s); |
808 | 808 |
809 std::auto_ptr<Orthanc::ImageAccessor> decoded(Orthanc::DicomImageDecoder::Decode(f, 0)); | 809 std::auto_ptr<Orthanc::ImageAccessor> decoded(Orthanc::DicomImageDecoder::Decode(f, 0)); |
810 ASSERT_EQ(256, decoded->GetWidth()); | 810 ASSERT_EQ(256u, decoded->GetWidth()); |
811 ASSERT_EQ(256, decoded->GetHeight()); | 811 ASSERT_EQ(256u, decoded->GetHeight()); |
812 ASSERT_EQ(Orthanc::PixelFormat_Grayscale8, decoded->GetFormat()); | 812 ASSERT_EQ(Orthanc::PixelFormat_Grayscale8, decoded->GetFormat()); |
813 | 813 |
814 for (int y = 0; y < 256; y++) | 814 for (int y = 0; y < 256; y++) |
815 { | 815 { |
816 const void* a = image.GetConstRow(y); | 816 const void* a = image.GetConstRow(y); |
867 std::string s; | 867 std::string s; |
868 Orthanc::Toolbox::ReadFile(s, PATH); | 868 Orthanc::Toolbox::ReadFile(s, PATH); |
869 Orthanc::ParsedDicomFile f(s); | 869 Orthanc::ParsedDicomFile f(s); |
870 | 870 |
871 std::auto_ptr<Orthanc::ImageAccessor> decoded(Orthanc::DicomImageDecoder::Decode(f, 0)); | 871 std::auto_ptr<Orthanc::ImageAccessor> decoded(Orthanc::DicomImageDecoder::Decode(f, 0)); |
872 ASSERT_EQ(384, decoded->GetWidth()); | 872 ASSERT_EQ(384u, decoded->GetWidth()); |
873 ASSERT_EQ(256, decoded->GetHeight()); | 873 ASSERT_EQ(256u, decoded->GetHeight()); |
874 ASSERT_EQ(Orthanc::PixelFormat_RGB24, decoded->GetFormat()); | 874 ASSERT_EQ(Orthanc::PixelFormat_RGB24, decoded->GetFormat()); |
875 | 875 |
876 for (int y = 0; y < 256; y++) | 876 for (int y = 0; y < 256; y++) |
877 { | 877 { |
878 const void* a = image.GetConstRow(y); | 878 const void* a = image.GetConstRow(y); |
921 std::string s; | 921 std::string s; |
922 Orthanc::Toolbox::ReadFile(s, PATH); | 922 Orthanc::Toolbox::ReadFile(s, PATH); |
923 Orthanc::ParsedDicomFile f(s); | 923 Orthanc::ParsedDicomFile f(s); |
924 | 924 |
925 std::auto_ptr<Orthanc::ImageAccessor> decoded(Orthanc::DicomImageDecoder::Decode(f, 0)); | 925 std::auto_ptr<Orthanc::ImageAccessor> decoded(Orthanc::DicomImageDecoder::Decode(f, 0)); |
926 ASSERT_EQ(256, decoded->GetWidth()); | 926 ASSERT_EQ(256u, decoded->GetWidth()); |
927 ASSERT_EQ(256, decoded->GetHeight()); | 927 ASSERT_EQ(256u, decoded->GetHeight()); |
928 ASSERT_EQ(Orthanc::PixelFormat_Grayscale16, decoded->GetFormat()); | 928 ASSERT_EQ(Orthanc::PixelFormat_Grayscale16, decoded->GetFormat()); |
929 | 929 |
930 for (int y = 0; y < 256; y++) | 930 for (int y = 0; y < 256; y++) |
931 { | 931 { |
932 const void* a = image.GetConstRow(y); | 932 const void* a = image.GetConstRow(y); |
975 std::string s; | 975 std::string s; |
976 Orthanc::Toolbox::ReadFile(s, PATH); | 976 Orthanc::Toolbox::ReadFile(s, PATH); |
977 Orthanc::ParsedDicomFile f(s); | 977 Orthanc::ParsedDicomFile f(s); |
978 | 978 |
979 std::auto_ptr<Orthanc::ImageAccessor> decoded(Orthanc::DicomImageDecoder::Decode(f, 0)); | 979 std::auto_ptr<Orthanc::ImageAccessor> decoded(Orthanc::DicomImageDecoder::Decode(f, 0)); |
980 ASSERT_EQ(256, decoded->GetWidth()); | 980 ASSERT_EQ(256u, decoded->GetWidth()); |
981 ASSERT_EQ(256, decoded->GetHeight()); | 981 ASSERT_EQ(256u, decoded->GetHeight()); |
982 ASSERT_EQ(Orthanc::PixelFormat_SignedGrayscale16, decoded->GetFormat()); | 982 ASSERT_EQ(Orthanc::PixelFormat_SignedGrayscale16, decoded->GetFormat()); |
983 | 983 |
984 for (int y = 0; y < 256; y++) | 984 for (int y = 0; y < 256; y++) |
985 { | 985 { |
986 const void* a = image.GetConstRow(y); | 986 const void* a = image.GetConstRow(y); |