comparison OrthancServer/ParsedDicomFile.cpp @ 1562:2084b7c20478

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 21 Aug 2015 13:47:22 +0200
parents 124de28b32ed
children 1b7def486e62
comparison
equal deleted inserted replaced
1560:307b9ea6c39b 1562:2084b7c20478
1132 { 1132 {
1133 return new ParsedDicomFile(*this); 1133 return new ParsedDicomFile(*this);
1134 } 1134 }
1135 1135
1136 1136
1137 void ParsedDicomFile::EmbedImage(const std::string& dataUriScheme) 1137 void ParsedDicomFile::EmbedContent(const std::string& dataUriScheme)
1138 { 1138 {
1139 std::string mime, base64; 1139 std::string mime, base64;
1140 Toolbox::DecodeDataUriScheme(mime, base64, dataUriScheme); 1140 Toolbox::DecodeDataUriScheme(mime, base64, dataUriScheme);
1141 Toolbox::ToLowerCase(mime);
1141 1142
1142 std::string content; 1143 std::string content;
1143 Toolbox::DecodeBase64(content, base64); 1144 Toolbox::DecodeBase64(content, base64);
1144 1145
1145 EmbedImage(mime, content); 1146 if (mime == "image/png")
1147 {
1148 EmbedImage(mime, content);
1149 }
1150 else if (mime == "application/pdf")
1151 {
1152 EmbedPdf(content);
1153 }
1154 else
1155 {
1156 LOG(ERROR) << "Unsupported MIME type for the content of a new DICOM file";
1157 throw OrthancException(ErrorCode_NotImplemented);
1158 }
1146 } 1159 }
1147 1160
1148 1161
1149 void ParsedDicomFile::EmbedImage(const std::string& mime, 1162 void ParsedDicomFile::EmbedImage(const std::string& mime,
1150 const std::string& content) 1163 const std::string& content)