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

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 27 Nov 2015 17:56:16 +0100
parents 2faa2abbf311
children 859224214616
line wrap: on
line diff
--- a/Plugins/Samples/GdcmDecoder/GdcmDecoderCache.cpp	Fri Nov 27 17:40:25 2015 +0100
+++ b/Plugins/Samples/GdcmDecoder/GdcmDecoderCache.cpp	Fri Nov 27 17:56:16 2015 +0100
@@ -60,10 +60,10 @@
   }
 
 
-  OrthancPluginImage* GdcmDecoderCache::Decode(OrthancPluginContext* context,
-                                               const void* dicom,
-                                               const uint32_t size,
-                                               uint32_t frameIndex)
+  OrthancImageWrapper* GdcmDecoderCache::Decode(OrthancPluginContext* context,
+                                                const void* dicom,
+                                                const uint32_t size,
+                                                uint32_t frameIndex)
   {
     std::string md5 = ComputeMd5(context, dicom, size);
 
@@ -77,13 +77,13 @@
           md5_ == md5)
       {
         // This is the same image: Reuse the previous decoding
-        return decoder_->Decode(context, frameIndex);
+        return new OrthancImageWrapper(context, *decoder_, frameIndex);
       }
     }
 
     // This is not the same image
     std::auto_ptr<GdcmImageDecoder> decoder(new GdcmImageDecoder(dicom, size));
-    OrthancImageWrapper image(context, *decoder, frameIndex);
+    std::auto_ptr<OrthancImageWrapper> image(new OrthancImageWrapper(context, *decoder, frameIndex));
 
     {
       // Cache the newly created decoder for further use
@@ -93,6 +93,6 @@
       md5_ = md5;
     }
 
-    return image.Release();
+    return image.release();
   }
 }