changeset 84:a1527502e0eb

read image from memory
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 08 Dec 2015 20:13:36 +0100
parents eab1a2859fa2
children 6ee987d645cd
files Plugin/WadoRs.cpp
diffstat 1 files changed, 3 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Plugin/WadoRs.cpp	Tue Dec 08 18:39:17 2015 +0100
+++ b/Plugin/WadoRs.cpp	Tue Dec 08 20:13:36 2015 +0100
@@ -737,13 +737,6 @@
     if (LocateInstance(output, uri, request) &&
         OrthancPlugins::RestApiGetString(content, context_, uri + "/file"))
     {
-      //OrthancPlugins::ParsedDicomFile dicom(content);
-      {
-        FILE* fp = fopen("/tmp/toto.dcm", "wb");
-        fwrite(content.c_str(), content.size(), 1, fp);
-        fclose(fp);
-      }
-
       printf("RetrieveFrames: [%s] [%s]\n", uri.c_str(), request->groups[3]);
 
       gdcm::ImageChangeTransferSyntax change;
@@ -758,9 +751,10 @@
       //codec.SetLossless(true);
       change.SetUserCodec(&codec);
 
+      std::stringstream stream(content);
+
       gdcm::ImageReader reader;
-      //reader.SetFile(dicom.GetFile());
-      reader.SetFileName("/tmp/toto.dcm");
+      reader.SetStream(stream);
       printf("Read: %d\n", reader.Read());
 
       change.SetInput(reader.GetImage());