diff Applications/Samples/SimpleViewer/SimpleViewerApplication.cpp @ 417:aee3d7941c9b

preparing to load images using DICOMweb
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 15 Nov 2018 17:28:15 +0100
parents 3aa058dcd5fb
children b70e9be013e4
line wrap: on
line diff
--- a/Applications/Samples/SimpleViewer/SimpleViewerApplication.cpp	Tue Nov 13 10:36:53 2018 +0100
+++ b/Applications/Samples/SimpleViewer/SimpleViewerApplication.cpp	Thu Nov 15 17:28:15 2018 +0100
@@ -61,10 +61,8 @@
       mainLayout_->AddWidget(thumbnailsLayout_);
       mainLayout_->AddWidget(mainWidget_);
 
-      orthancApiClient_.reset(new OrthancApiClient(IObserver::GetBroker(), context_->GetWebService()));
-
       // sources
-      smartLoader_.reset(new SmartLoader(IObserver::GetBroker(), *orthancApiClient_));
+      smartLoader_.reset(new SmartLoader(IObserver::GetBroker(), context->GetOrthancApiClient()));
       smartLoader_->SetImageQuality(SliceImageQuality_FullPam);
 
       mainLayout_->SetTransmitMouseOver(true);
@@ -80,7 +78,7 @@
     if (parameters.count("studyId") < 1)
     {
       LOG(WARNING) << "The study ID is missing, will take the first studyId found in Orthanc";
-      orthancApiClient_->GetJsonAsync("/studies", new Callable<SimpleViewerApplication, OrthancApiClient::JsonResponseReadyMessage>(*this, &SimpleViewerApplication::OnStudyListReceived));
+      context->GetOrthancApiClient().GetJsonAsync("/studies", new Callable<SimpleViewerApplication, OrthancApiClient::JsonResponseReadyMessage>(*this, &SimpleViewerApplication::OnStudyListReceived));
     }
     else
     {
@@ -118,7 +116,7 @@
     {
       for (size_t i=0; i < response["Series"].size(); i++)
       {
-        orthancApiClient_->GetJsonAsync("/series/" + response["Series"][(int)i].asString(), new Callable<SimpleViewerApplication, OrthancApiClient::JsonResponseReadyMessage>(*this, &SimpleViewerApplication::OnSeriesReceived));
+        context_->GetOrthancApiClient().GetJsonAsync("/series/" + response["Series"][(int)i].asString(), new Callable<SimpleViewerApplication, OrthancApiClient::JsonResponseReadyMessage>(*this, &SimpleViewerApplication::OnSeriesReceived));
       }
     }
   }
@@ -168,7 +166,7 @@
 
   void SimpleViewerApplication::SelectStudy(const std::string& studyId)
   {
-    orthancApiClient_->GetJsonAsync("/studies/" + studyId, new Callable<SimpleViewerApplication, OrthancApiClient::JsonResponseReadyMessage>(*this, &SimpleViewerApplication::OnStudyReceived));
+    context_->GetOrthancApiClient().GetJsonAsync("/studies/" + studyId, new Callable<SimpleViewerApplication, OrthancApiClient::JsonResponseReadyMessage>(*this, &SimpleViewerApplication::OnStudyReceived));
   }
 
   void SimpleViewerApplication::OnWidgetGeometryChanged(const SliceViewerWidget::GeometryChangedMessage& message)