diff Plugins/Samples/GdcmDecoder/Plugin.cpp @ 1837:fbc5522023aa

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 27 Nov 2015 17:56:16 +0100
parents b1a6f49b21dd
children 859224214616
line wrap: on
line diff
--- a/Plugins/Samples/GdcmDecoder/Plugin.cpp	Fri Nov 27 17:40:25 2015 +0100
+++ b/Plugins/Samples/GdcmDecoder/Plugin.cpp	Fri Nov 27 17:56:16 2015 +0100
@@ -19,6 +19,7 @@
 
 
 #include "GdcmDecoderCache.h"
+#include "OrthancImageWrapper.h"
 
 #include <orthanc/OrthancCPlugin.h>
 
@@ -33,14 +34,18 @@
 {
   try
   {
+    std::auto_ptr<OrthancPlugins::OrthancImageWrapper> image;
+
 #if 0
     // Do not use the cache
     OrthancPlugins::GdcmImageDecoder decoder(dicom, size);
-    *target = decoder.Decode(context_, frameIndex);
+    image.reset(new OrthancPlugins::OrthancImageWrapper(context_, decoder, frameIndex));
 #else
-    *target = cache_.Decode(context_, dicom, size, frameIndex);
+    image.reset(cache_.Decode(context_, dicom, size, frameIndex));
 #endif
 
+    *target = image->Release();
+
     return OrthancPluginErrorCode_Success;
   }
   catch (std::runtime_error& e)