comparison 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
comparison
equal deleted inserted replaced
415:c0589c3173fd 417:aee3d7941c9b
59 59
60 // hierarchy 60 // hierarchy
61 mainLayout_->AddWidget(thumbnailsLayout_); 61 mainLayout_->AddWidget(thumbnailsLayout_);
62 mainLayout_->AddWidget(mainWidget_); 62 mainLayout_->AddWidget(mainWidget_);
63 63
64 orthancApiClient_.reset(new OrthancApiClient(IObserver::GetBroker(), context_->GetWebService()));
65
66 // sources 64 // sources
67 smartLoader_.reset(new SmartLoader(IObserver::GetBroker(), *orthancApiClient_)); 65 smartLoader_.reset(new SmartLoader(IObserver::GetBroker(), context->GetOrthancApiClient()));
68 smartLoader_->SetImageQuality(SliceImageQuality_FullPam); 66 smartLoader_->SetImageQuality(SliceImageQuality_FullPam);
69 67
70 mainLayout_->SetTransmitMouseOver(true); 68 mainLayout_->SetTransmitMouseOver(true);
71 mainWidgetInteractor_.reset(new MainWidgetInteractor(*this)); 69 mainWidgetInteractor_.reset(new MainWidgetInteractor(*this));
72 mainWidget_->SetInteractor(*mainWidgetInteractor_); 70 mainWidget_->SetInteractor(*mainWidgetInteractor_);
78 76
79 77
80 if (parameters.count("studyId") < 1) 78 if (parameters.count("studyId") < 1)
81 { 79 {
82 LOG(WARNING) << "The study ID is missing, will take the first studyId found in Orthanc"; 80 LOG(WARNING) << "The study ID is missing, will take the first studyId found in Orthanc";
83 orthancApiClient_->GetJsonAsync("/studies", new Callable<SimpleViewerApplication, OrthancApiClient::JsonResponseReadyMessage>(*this, &SimpleViewerApplication::OnStudyListReceived)); 81 context->GetOrthancApiClient().GetJsonAsync("/studies", new Callable<SimpleViewerApplication, OrthancApiClient::JsonResponseReadyMessage>(*this, &SimpleViewerApplication::OnStudyListReceived));
84 } 82 }
85 else 83 else
86 { 84 {
87 SelectStudy(parameters["studyId"].as<std::string>()); 85 SelectStudy(parameters["studyId"].as<std::string>());
88 } 86 }
116 114
117 if (response.isObject() && response["Series"].isArray()) 115 if (response.isObject() && response["Series"].isArray())
118 { 116 {
119 for (size_t i=0; i < response["Series"].size(); i++) 117 for (size_t i=0; i < response["Series"].size(); i++)
120 { 118 {
121 orthancApiClient_->GetJsonAsync("/series/" + response["Series"][(int)i].asString(), new Callable<SimpleViewerApplication, OrthancApiClient::JsonResponseReadyMessage>(*this, &SimpleViewerApplication::OnSeriesReceived)); 119 context_->GetOrthancApiClient().GetJsonAsync("/series/" + response["Series"][(int)i].asString(), new Callable<SimpleViewerApplication, OrthancApiClient::JsonResponseReadyMessage>(*this, &SimpleViewerApplication::OnSeriesReceived));
122 } 120 }
123 } 121 }
124 } 122 }
125 123
126 void SimpleViewerApplication::OnSeriesReceived(const OrthancApiClient::JsonResponseReadyMessage& message) 124 void SimpleViewerApplication::OnSeriesReceived(const OrthancApiClient::JsonResponseReadyMessage& message)
166 thumbnailWidget->SetInteractor(*thumbnailInteractor_); 164 thumbnailWidget->SetInteractor(*thumbnailInteractor_);
167 } 165 }
168 166
169 void SimpleViewerApplication::SelectStudy(const std::string& studyId) 167 void SimpleViewerApplication::SelectStudy(const std::string& studyId)
170 { 168 {
171 orthancApiClient_->GetJsonAsync("/studies/" + studyId, new Callable<SimpleViewerApplication, OrthancApiClient::JsonResponseReadyMessage>(*this, &SimpleViewerApplication::OnStudyReceived)); 169 context_->GetOrthancApiClient().GetJsonAsync("/studies/" + studyId, new Callable<SimpleViewerApplication, OrthancApiClient::JsonResponseReadyMessage>(*this, &SimpleViewerApplication::OnStudyReceived));
172 } 170 }
173 171
174 void SimpleViewerApplication::OnWidgetGeometryChanged(const SliceViewerWidget::GeometryChangedMessage& message) 172 void SimpleViewerApplication::OnWidgetGeometryChanged(const SliceViewerWidget::GeometryChangedMessage& message)
175 { 173 {
176 // TODO: The "const_cast" could probably be replaced by "mainWidget_" 174 // TODO: The "const_cast" could probably be replaced by "mainWidget_"