comparison Core/Enumerations.cpp @ 2281:e002430baa41

Fix issue #44 (Bad interpretation of photometric interpretation MONOCHROME1)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 09 Jun 2017 16:14:52 +0200
parents a3a65de1840f
children b8969010b534
comparison
equal deleted inserted replaced
2280:2e7a8ce24be2 2281:e002430baa41
634 { 634 {
635 case PhotometricInterpretation_RGB: 635 case PhotometricInterpretation_RGB:
636 return "RGB"; 636 return "RGB";
637 637
638 case PhotometricInterpretation_Monochrome1: 638 case PhotometricInterpretation_Monochrome1:
639 return "Monochrome1"; 639 return "MONOCHROME1";
640 640
641 case PhotometricInterpretation_Monochrome2: 641 case PhotometricInterpretation_Monochrome2:
642 return "Monochrome2"; 642 return "MONOCHROME2";
643 643
644 case PhotometricInterpretation_ARGB: 644 case PhotometricInterpretation_ARGB:
645 return "ARGB"; 645 return "ARGB";
646 646
647 case PhotometricInterpretation_CMYK: 647 case PhotometricInterpretation_CMYK:
649 649
650 case PhotometricInterpretation_HSV: 650 case PhotometricInterpretation_HSV:
651 return "HSV"; 651 return "HSV";
652 652
653 case PhotometricInterpretation_Palette: 653 case PhotometricInterpretation_Palette:
654 return "Palette color"; 654 return "PALETTE COLOR";
655 655
656 case PhotometricInterpretation_YBRFull: 656 case PhotometricInterpretation_YBRFull:
657 return "YBR full"; 657 return "YBR_FULL";
658 658
659 case PhotometricInterpretation_YBRFull422: 659 case PhotometricInterpretation_YBRFull422:
660 return "YBR full 422"; 660 return "YBR_FULL_422";
661 661
662 case PhotometricInterpretation_YBRPartial420: 662 case PhotometricInterpretation_YBRPartial420:
663 return "YBR partial 420"; 663 return "YBR_PARTIAL_420";
664 664
665 case PhotometricInterpretation_YBRPartial422: 665 case PhotometricInterpretation_YBRPartial422:
666 return "YBR partial 422"; 666 return "YBR_PARTIAL_422";
667 667
668 case PhotometricInterpretation_YBR_ICT: 668 case PhotometricInterpretation_YBR_ICT:
669 return "YBR ICT"; 669 return "YBR_ICT";
670 670
671 case PhotometricInterpretation_YBR_RCT: 671 case PhotometricInterpretation_YBR_RCT:
672 return "YBR RCT"; 672 return "YBR_RCT";
673 673
674 case PhotometricInterpretation_Unknown: 674 case PhotometricInterpretation_Unknown:
675 return "Unknown"; 675 return "Unknown";
676 676
677 default: 677 default:
1050 return ValueRepresentation_NotSupported; 1050 return ValueRepresentation_NotSupported;
1051 } 1051 }
1052 } 1052 }
1053 } 1053 }
1054 1054
1055
1056 PhotometricInterpretation StringToPhotometricInterpretation(const char* value)
1057 {
1058 // http://dicom.nema.org/medical/dicom/2017a/output/chtml/part03/sect_C.7.6.3.html#sect_C.7.6.3.1.2
1059 std::string s(value);
1060
1061 if (s == "MONOCHROME1")
1062 {
1063 return PhotometricInterpretation_Monochrome1;
1064 }
1065
1066 if (s == "MONOCHROME2")
1067 {
1068 return PhotometricInterpretation_Monochrome2;
1069 }
1070
1071 if (s == "PALETTE COLOR")
1072 {
1073 return PhotometricInterpretation_Palette;
1074 }
1075
1076 if (s == "RGB")
1077 {
1078 return PhotometricInterpretation_RGB;
1079 }
1080
1081 if (s == "HSV")
1082 {
1083 return PhotometricInterpretation_HSV;
1084 }
1085
1086 if (s == "ARGB")
1087 {
1088 return PhotometricInterpretation_ARGB;
1089 }
1090
1091 if (s == "CMYK")
1092 {
1093 return PhotometricInterpretation_CMYK;
1094 }
1095
1096 if (s == "YBR_FULL")
1097 {
1098 return PhotometricInterpretation_YBRFull;
1099 }
1100
1101 if (s == "YBR_FULL_422")
1102 {
1103 return PhotometricInterpretation_YBRFull422;
1104 }
1105
1106 if (s == "YBR_PARTIAL_422")
1107 {
1108 return PhotometricInterpretation_YBRPartial422;
1109 }
1110
1111 if (s == "YBR_PARTIAL_420")
1112 {
1113 return PhotometricInterpretation_YBRPartial420;
1114 }
1115
1116 if (s == "YBR_ICT")
1117 {
1118 return PhotometricInterpretation_YBR_ICT;
1119 }
1120
1121 if (s == "YBR_RCT")
1122 {
1123 return PhotometricInterpretation_YBR_RCT;
1124 }
1125
1126 throw OrthancException(ErrorCode_ParameterOutOfRange);
1127 }
1128
1055 1129
1056 unsigned int GetBytesPerPixel(PixelFormat format) 1130 unsigned int GetBytesPerPixel(PixelFormat format)
1057 { 1131 {
1058 switch (format) 1132 switch (format)
1059 { 1133 {