diff 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
line wrap: on
line diff
--- a/OrthancServer/ParsedDicomFile.cpp	Fri Aug 21 11:43:24 2015 +0200
+++ b/OrthancServer/ParsedDicomFile.cpp	Fri Aug 21 13:47:22 2015 +0200
@@ -1134,15 +1134,28 @@
   }
 
 
-  void ParsedDicomFile::EmbedImage(const std::string& dataUriScheme)
+  void ParsedDicomFile::EmbedContent(const std::string& dataUriScheme)
   {
     std::string mime, base64;
     Toolbox::DecodeDataUriScheme(mime, base64, dataUriScheme);
+    Toolbox::ToLowerCase(mime);
 
     std::string content;
     Toolbox::DecodeBase64(content, base64);
 
-    EmbedImage(mime, content);
+    if (mime == "image/png")
+    {
+      EmbedImage(mime, content);
+    }
+    else if (mime == "application/pdf")
+    {
+      EmbedPdf(content);
+    }
+    else
+    {
+      LOG(ERROR) << "Unsupported MIME type for the content of a new DICOM file";
+      throw OrthancException(ErrorCode_NotImplemented);
+    }
   }