diff Framework/Deprecated/Toolbox/OrthancSlicesLoader.cpp @ 1066:b537002f83a9 broker

removing broker from deprecated classes
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 15 Oct 2019 15:39:39 +0200
parents 4fe4b221a31f
children 04a95ee91327
line wrap: on
line diff
--- a/Framework/Deprecated/Toolbox/OrthancSlicesLoader.cpp	Tue Oct 15 14:08:15 2019 +0200
+++ b/Framework/Deprecated/Toolbox/OrthancSlicesLoader.cpp	Tue Oct 15 15:39:39 2019 +0200
@@ -639,10 +639,7 @@
   }
   
   
-  OrthancSlicesLoader::OrthancSlicesLoader(OrthancStone::MessageBroker& broker,
-                                           OrthancApiClient& orthanc) :
-    OrthancStone::IObservable(broker),
-    OrthancStone::IObserver(broker),
+  OrthancSlicesLoader::OrthancSlicesLoader(OrthancApiClient& orthanc) :
     orthanc_(orthanc),
     state_(State_Initialization)
   {
@@ -659,8 +656,8 @@
     {
       state_ = State_LoadingGeometry;
       orthanc_.GetJsonAsync("/series/" + seriesId + "/instances-tags",
-                            new OrthancStone::Callable<OrthancSlicesLoader, OrthancApiClient::JsonResponseReadyMessage>(*this, &OrthancSlicesLoader::ParseSeriesGeometry),
-                            new OrthancStone::Callable<OrthancSlicesLoader, IWebService::HttpRequestErrorMessage>(*this, &OrthancSlicesLoader::OnGeometryError),
+                            new OrthancStone::Callable<OrthancSlicesLoader, OrthancApiClient::JsonResponseReadyMessage>(GetSharedObserver(), &OrthancSlicesLoader::ParseSeriesGeometry),
+                            new OrthancStone::Callable<OrthancSlicesLoader, IWebService::HttpRequestErrorMessage>(GetSharedObserver(), &OrthancSlicesLoader::OnGeometryError),
                             NULL);
     }
   }
@@ -678,8 +675,8 @@
       // Tag "3004-000c" is "Grid Frame Offset Vector", which is
       // mandatory to read RT DOSE, but is too long to be returned by default
       orthanc_.GetJsonAsync("/instances/" + instanceId + "/tags?ignore-length=3004-000c",
-                            new OrthancStone::Callable<OrthancSlicesLoader, OrthancApiClient::JsonResponseReadyMessage>(*this, &OrthancSlicesLoader::ParseInstanceGeometry),
-                            new OrthancStone::Callable<OrthancSlicesLoader, IWebService::HttpRequestErrorMessage>(*this, &OrthancSlicesLoader::OnGeometryError),
+                            new OrthancStone::Callable<OrthancSlicesLoader, OrthancApiClient::JsonResponseReadyMessage>(GetSharedObserver(), &OrthancSlicesLoader::ParseInstanceGeometry),
+                            new OrthancStone::Callable<OrthancSlicesLoader, IWebService::HttpRequestErrorMessage>(GetSharedObserver(), &OrthancSlicesLoader::OnGeometryError),
                             Operation::DownloadInstanceGeometry(instanceId));
     }
   }
@@ -697,8 +694,8 @@
       state_ = State_LoadingGeometry;
 
       orthanc_.GetJsonAsync("/instances/" + instanceId + "/tags",
-                            new OrthancStone::Callable<OrthancSlicesLoader, OrthancApiClient::JsonResponseReadyMessage>(*this, &OrthancSlicesLoader::ParseFrameGeometry),
-                            new OrthancStone::Callable<OrthancSlicesLoader, IWebService::HttpRequestErrorMessage>(*this, &OrthancSlicesLoader::OnGeometryError),
+                            new OrthancStone::Callable<OrthancSlicesLoader, OrthancApiClient::JsonResponseReadyMessage>(GetSharedObserver(), &OrthancSlicesLoader::ParseFrameGeometry),
+                            new OrthancStone::Callable<OrthancSlicesLoader, IWebService::HttpRequestErrorMessage>(GetSharedObserver(), &OrthancSlicesLoader::OnGeometryError),
                             Operation::DownloadFrameGeometry(instanceId, frame));
     }
   }
@@ -771,22 +768,22 @@
     }
     
     orthanc_.GetBinaryAsync(uri, "image/png",
-      new OrthancStone::Callable<OrthancSlicesLoader, 
-        OrthancApiClient::BinaryResponseReadyMessage>
-          (*this, &OrthancSlicesLoader::ParseSliceImagePng),
-      new OrthancStone::Callable<OrthancSlicesLoader, 
-        IWebService::HttpRequestErrorMessage>
-          (*this, &OrthancSlicesLoader::OnSliceImageError),
-      Operation::DownloadSliceImage(
-        static_cast<unsigned int>(index), slice, SliceImageQuality_FullPng));
-}
+                            new OrthancStone::Callable<OrthancSlicesLoader, 
+                            OrthancApiClient::BinaryResponseReadyMessage>
+                            (GetSharedObserver(), &OrthancSlicesLoader::ParseSliceImagePng),
+                            new OrthancStone::Callable<OrthancSlicesLoader, 
+                            IWebService::HttpRequestErrorMessage>
+                            (GetSharedObserver(), &OrthancSlicesLoader::OnSliceImageError),
+                            Operation::DownloadSliceImage(
+                              static_cast<unsigned int>(index), slice, SliceImageQuality_FullPng));
+  }
   
   void OrthancSlicesLoader::ScheduleSliceImagePam(const Slice& slice,
                                                   size_t index)
   {
     std::string uri = 
       ("/instances/" + slice.GetOrthancInstanceId() + "/frames/" +
-      boost::lexical_cast<std::string>(slice.GetFrame()));
+       boost::lexical_cast<std::string>(slice.GetFrame()));
 
     switch (slice.GetConverter().GetExpectedPixelFormat())
     {
@@ -807,14 +804,14 @@
     }
 
     orthanc_.GetBinaryAsync(uri, "image/x-portable-arbitrarymap",
-      new OrthancStone::Callable<OrthancSlicesLoader, 
-        OrthancApiClient::BinaryResponseReadyMessage>
-          (*this, &OrthancSlicesLoader::ParseSliceImagePam),
-      new OrthancStone::Callable<OrthancSlicesLoader, 
-        IWebService::HttpRequestErrorMessage>
-          (*this, &OrthancSlicesLoader::OnSliceImageError),
-      Operation::DownloadSliceImage(static_cast<unsigned int>(index), 
-                                    slice, SliceImageQuality_FullPam));
+                            new OrthancStone::Callable<OrthancSlicesLoader, 
+                            OrthancApiClient::BinaryResponseReadyMessage>
+                            (GetSharedObserver(), &OrthancSlicesLoader::ParseSliceImagePam),
+                            new OrthancStone::Callable<OrthancSlicesLoader, 
+                            IWebService::HttpRequestErrorMessage>
+                            (GetSharedObserver(), &OrthancSlicesLoader::OnSliceImageError),
+                            Operation::DownloadSliceImage(static_cast<unsigned int>(index), 
+                                                          slice, SliceImageQuality_FullPam));
   }
 
 
@@ -850,14 +847,14 @@
                        boost::lexical_cast<std::string>(slice.GetFrame()));
 
     orthanc_.GetJsonAsync(uri,
-      new OrthancStone::Callable<OrthancSlicesLoader, 
-        OrthancApiClient::JsonResponseReadyMessage>
-          (*this, &OrthancSlicesLoader::ParseSliceImageJpeg),
-      new OrthancStone::Callable<OrthancSlicesLoader, 
-        IWebService::HttpRequestErrorMessage>
-          (*this, &OrthancSlicesLoader::OnSliceImageError),
-        Operation::DownloadSliceImage(
-          static_cast<unsigned int>(index), slice, quality));
+                          new OrthancStone::Callable<OrthancSlicesLoader, 
+                          OrthancApiClient::JsonResponseReadyMessage>
+                          (GetSharedObserver(), &OrthancSlicesLoader::ParseSliceImageJpeg),
+                          new OrthancStone::Callable<OrthancSlicesLoader, 
+                          IWebService::HttpRequestErrorMessage>
+                          (GetSharedObserver(), &OrthancSlicesLoader::OnSliceImageError),
+                          Operation::DownloadSliceImage(
+                            static_cast<unsigned int>(index), slice, quality));
   }
   
   
@@ -891,14 +888,14 @@
       std::string uri = ("/instances/" + slice.GetOrthancInstanceId() + "/frames/" +
                          boost::lexical_cast<std::string>(slice.GetFrame()) + "/raw.gz");
       orthanc_.GetBinaryAsync(uri, IWebService::HttpHeaders(),
-        new OrthancStone::Callable<OrthancSlicesLoader, 
-          OrthancApiClient::BinaryResponseReadyMessage>
-            (*this, &OrthancSlicesLoader::ParseSliceRawImage),
-        new OrthancStone::Callable<OrthancSlicesLoader,
-          IWebService::HttpRequestErrorMessage>
-            (*this, &OrthancSlicesLoader::OnSliceImageError),
-        Operation::DownloadSliceRawImage(
-          static_cast<unsigned int>(index), slice));
+                              new OrthancStone::Callable<OrthancSlicesLoader, 
+                              OrthancApiClient::BinaryResponseReadyMessage>
+                              (GetSharedObserver(), &OrthancSlicesLoader::ParseSliceRawImage),
+                              new OrthancStone::Callable<OrthancSlicesLoader,
+                              IWebService::HttpRequestErrorMessage>
+                              (GetSharedObserver(), &OrthancSlicesLoader::OnSliceImageError),
+                              Operation::DownloadSliceRawImage(
+                                static_cast<unsigned int>(index), slice));
     }
   }
 }