diff Framework/Toolbox/OrthancSlicesLoader.cpp @ 318:3a4ca166fafa am-2

ImageAccessor refactoring + implemented Image Cache in SmartLoader
author am@osimis.io
date Mon, 08 Oct 2018 17:10:08 +0200
parents b4abaeb783b1
children c34784e5f299
line wrap: on
line diff
--- a/Framework/Toolbox/OrthancSlicesLoader.cpp	Fri Oct 05 11:57:36 2018 +0200
+++ b/Framework/Toolbox/OrthancSlicesLoader.cpp	Mon Oct 08 17:10:08 2018 +0200
@@ -173,7 +173,7 @@
   };
 
   void OrthancSlicesLoader::NotifySliceImageSuccess(const Operation& operation,
-                                                    std::auto_ptr<Orthanc::ImageAccessor>& image)
+                                                    boost::shared_ptr<Orthanc::ImageAccessor> image)
   {
     if (image.get() == NULL)
     {
@@ -341,7 +341,7 @@
   void OrthancSlicesLoader::ParseSliceImagePng(const OrthancApiClient::BinaryResponseReadyMessage& message)
   {
     const Operation& operation = dynamic_cast<const OrthancSlicesLoader::Operation&>(*message.Payload);
-    std::auto_ptr<Orthanc::ImageAccessor>  image;
+    boost::shared_ptr<Orthanc::ImageAccessor>  image;
     
     try
     {
@@ -381,7 +381,7 @@
   void OrthancSlicesLoader::ParseSliceImagePam(const OrthancApiClient::BinaryResponseReadyMessage& message)
   {
     const Operation& operation = dynamic_cast<const OrthancSlicesLoader::Operation&>(*message.Payload);
-    std::auto_ptr<Orthanc::ImageAccessor>  image;
+    boost::shared_ptr<Orthanc::ImageAccessor>  image;
 
     try
     {
@@ -461,7 +461,7 @@
       }
     }
     
-    std::auto_ptr<Orthanc::ImageAccessor> reader;
+    boost::shared_ptr<Orthanc::ImageAccessor> reader;
     
     {
       std::string jpeg;
@@ -548,11 +548,11 @@
     }
     
     // Decode a grayscale JPEG 8bpp image coming from the Web viewer
-    std::auto_ptr<Orthanc::ImageAccessor> image
+    boost::shared_ptr<Orthanc::ImageAccessor> image
         (new Orthanc::Image(expectedFormat, reader->GetWidth(), reader->GetHeight(), false));
 
     Orthanc::ImageProcessing::Convert(*image, *reader);
-    reader.reset(NULL);
+    reader = NULL;
     
     float scaling = static_cast<float>(stretchHigh - stretchLow) / 255.0f;
     
@@ -567,8 +567,7 @@
   
   
   class StringImage :
-      public Orthanc::ImageAccessor,
-      public boost::noncopyable
+      public Orthanc::ImageAccessor
   {
   private:
     std::string  buffer_;
@@ -613,7 +612,7 @@
     {
       // This is the case of RT-DOSE (uint32_t values)
       
-      std::auto_ptr<Orthanc::ImageAccessor> image
+      boost::shared_ptr<Orthanc::ImageAccessor> image
           (new StringImage(Orthanc::PixelFormat_Grayscale32, info.GetWidth(),
                            info.GetHeight(), raw));
       
@@ -637,7 +636,7 @@
              info.GetPhotometricInterpretation() == Orthanc::PhotometricInterpretation_Monochrome2 &&
              raw.size() == info.GetWidth() * info.GetHeight() * 2)
     {
-      std::auto_ptr<Orthanc::ImageAccessor> image
+      boost::shared_ptr<Orthanc::ImageAccessor> image
           (new StringImage(Orthanc::PixelFormat_Grayscale16, info.GetWidth(),
                            info.GetHeight(), raw));