Mercurial > hg > orthanc-stone
comparison Applications/Samples/SimpleViewerApplicationSingleFile.h @ 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 |
comparison
equal
deleted
inserted
replaced
415:c0589c3173fd | 417:aee3d7941c9b |
---|---|
245 OrthancStone::WidgetViewport* wasmViewport1_; | 245 OrthancStone::WidgetViewport* wasmViewport1_; |
246 OrthancStone::WidgetViewport* wasmViewport2_; | 246 OrthancStone::WidgetViewport* wasmViewport2_; |
247 | 247 |
248 IStatusBar* statusBar_; | 248 IStatusBar* statusBar_; |
249 std::auto_ptr<SmartLoader> smartLoader_; | 249 std::auto_ptr<SmartLoader> smartLoader_; |
250 std::auto_ptr<OrthancApiClient> orthancApiClient_; | |
251 | 250 |
252 Orthanc::Font font_; | 251 Orthanc::Font font_; |
253 | 252 |
254 public: | 253 public: |
255 SimpleViewerApplication(MessageBroker& broker) : | 254 SimpleViewerApplication(MessageBroker& broker) : |
302 | 301 |
303 // hierarchy | 302 // hierarchy |
304 mainLayout_->AddWidget(thumbnailsLayout_); | 303 mainLayout_->AddWidget(thumbnailsLayout_); |
305 mainLayout_->AddWidget(mainWidget_); | 304 mainLayout_->AddWidget(mainWidget_); |
306 | 305 |
307 orthancApiClient_.reset(new OrthancApiClient(GetBroker(), context_->GetWebService())); | |
308 | |
309 // sources | 306 // sources |
310 smartLoader_.reset(new SmartLoader(GetBroker(), *orthancApiClient_)); | 307 smartLoader_.reset(new SmartLoader(GetBroker(), context->GetOrthancApiClient())); |
311 smartLoader_->SetImageQuality(SliceImageQuality_FullPam); | 308 smartLoader_->SetImageQuality(SliceImageQuality_FullPam); |
312 | 309 |
313 mainLayout_->SetTransmitMouseOver(true); | 310 mainLayout_->SetTransmitMouseOver(true); |
314 mainWidgetInteractor_.reset(new MainWidgetInteractor(*this)); | 311 mainWidgetInteractor_.reset(new MainWidgetInteractor(*this)); |
315 mainWidget_->SetInteractor(*mainWidgetInteractor_); | 312 mainWidget_->SetInteractor(*mainWidgetInteractor_); |
321 | 318 |
322 | 319 |
323 if (parameters.count("studyId") < 1) | 320 if (parameters.count("studyId") < 1) |
324 { | 321 { |
325 LOG(WARNING) << "The study ID is missing, will take the first studyId found in Orthanc"; | 322 LOG(WARNING) << "The study ID is missing, will take the first studyId found in Orthanc"; |
326 orthancApiClient_->GetJsonAsync( | 323 context->GetOrthancApiClient().GetJsonAsync( |
327 "/studies", | 324 "/studies", |
328 new Callable<SimpleViewerApplication, OrthancApiClient::JsonResponseReadyMessage> | 325 new Callable<SimpleViewerApplication, OrthancApiClient::JsonResponseReadyMessage> |
329 (*this, &SimpleViewerApplication::OnStudyListReceived)); | 326 (*this, &SimpleViewerApplication::OnStudyListReceived)); |
330 } | 327 } |
331 else | 328 else |
351 | 348 |
352 if (response.isObject() && response["Series"].isArray()) | 349 if (response.isObject() && response["Series"].isArray()) |
353 { | 350 { |
354 for (size_t i=0; i < response["Series"].size(); i++) | 351 for (size_t i=0; i < response["Series"].size(); i++) |
355 { | 352 { |
356 orthancApiClient_->GetJsonAsync( | 353 context_->GetOrthancApiClient().GetJsonAsync( |
357 "/series/" + response["Series"][(int)i].asString(), | 354 "/series/" + response["Series"][(int)i].asString(), |
358 new Callable<SimpleViewerApplication, OrthancApiClient::JsonResponseReadyMessage> | 355 new Callable<SimpleViewerApplication, OrthancApiClient::JsonResponseReadyMessage> |
359 (*this, &SimpleViewerApplication::OnSeriesReceived)); | 356 (*this, &SimpleViewerApplication::OnSeriesReceived)); |
360 } | 357 } |
361 } | 358 } |
403 } | 400 } |
404 | 401 |
405 void SelectStudy(const std::string& studyId) | 402 void SelectStudy(const std::string& studyId) |
406 { | 403 { |
407 LOG(INFO) << "Selecting study: " << studyId; | 404 LOG(INFO) << "Selecting study: " << studyId; |
408 orthancApiClient_->GetJsonAsync("/studies/" + studyId, new Callable<SimpleViewerApplication, OrthancApiClient::JsonResponseReadyMessage>(*this, &SimpleViewerApplication::OnStudyReceived)); | 405 context_->GetOrthancApiClient().GetJsonAsync( |
406 "/studies/" + studyId, new Callable<SimpleViewerApplication, OrthancApiClient::JsonResponseReadyMessage> | |
407 (*this, &SimpleViewerApplication::OnStudyReceived)); | |
409 } | 408 } |
410 | 409 |
411 void OnWidgetGeometryChanged(const SliceViewerWidget::GeometryChangedMessage& message) | 410 void OnWidgetGeometryChanged(const SliceViewerWidget::GeometryChangedMessage& message) |
412 { | 411 { |
413 // TODO: The "const_cast" could probably be replaced by "mainWidget" | 412 // TODO: The "const_cast" could probably be replaced by "mainWidget" |