diff Plugin/Plugin.cpp @ 102:21123729ac71 refactoring

simplification
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 30 Nov 2015 11:02:50 +0100
parents f5b1a9267da0
children 628697fdfcbd
line wrap: on
line diff
--- a/Plugin/Plugin.cpp	Fri Nov 27 22:05:51 2015 +0100
+++ b/Plugin/Plugin.cpp	Mon Nov 30 11:02:50 2015 +0100
@@ -28,7 +28,7 @@
 #include "ViewerPrefetchPolicy.h"
 #include "DecodedImageAdapter.h"
 #include "SeriesInformationAdapter.h"
-#include "../Orthanc/Plugins/Samples/GdcmDecoder/GdcmImageDecoder.h"
+#include "../Orthanc/Plugins/Samples/GdcmDecoder/GdcmDecoderCache.h"
 #include "../Orthanc/Core/Toolbox.h"
 
 
@@ -64,7 +64,7 @@
   Orthanc::SharedMessageQueue  newInstances_;
   bool stop_;
   boost::thread newInstancesThread_;
-
+  OrthancPlugins::GdcmDecoderCache  decoder_;
 
   static void NewInstancesThread(CacheContext* cache)
   {
@@ -123,6 +123,11 @@
   {
     newInstances_.Enqueue(new DynamicString(instanceId));
   }
+
+  OrthancPlugins::GdcmDecoderCache&  GetDecoder()
+  {
+    return decoder_;
+  }
 };
 
 
@@ -333,8 +338,7 @@
     image.reset(new OrthancPlugins::OrthancImageWrapper(context_, decoder, frameIndex));
 #else
     using namespace OrthancPlugins;
-    ICacheFactory& factory = cache_->GetScheduler().GetFactory(CacheBundle_DecodedImage);
-    image.reset(dynamic_cast<DecodedImageAdapter&>(factory).GetDecoderCache().Decode(context_, dicom, size, frameIndex));
+    image.reset(cache_->GetDecoder().Decode(context_, dicom, size, frameIndex));
 #endif
 
     *target = image->Release();