comparison Applications/Samples/SingleFrameApplication.h @ 396:ed7146fa2c98

rename ILayerSource as IVolumeSlicer, and OrthancFrameLayerSource as as DicomSeriesVolumeSlicer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 10 Nov 2018 09:29:08 +0100
parents e7a494bdd956
children 99e31898910e
comparison
equal deleted inserted replaced
395:5f13809f3f76 396:ed7146fa2c98
21 21
22 #pragma once 22 #pragma once
23 23
24 #include "SampleApplicationBase.h" 24 #include "SampleApplicationBase.h"
25 25
26 #include "../../Framework/Layers/OrthancFrameLayerSource.h" 26 #include "../../Framework/Layers/DicomSeriesVolumeSlicer.h"
27 #include "../../Framework/Widgets/SliceViewerWidget.h" 27 #include "../../Framework/Widgets/SliceViewerWidget.h"
28 28
29 #include <Core/Logging.h> 29 #include <Core/Logging.h>
30 30
31 #include <boost/math/constants/constants.hpp> 31 #include <boost/math/constants/constants.hpp>
180 #endif 180 #endif
181 } 181 }
182 } 182 }
183 183
184 184
185 void OnMainWidgetGeometryReady(const ILayerSource::GeometryReadyMessage& message) 185 void OnMainWidgetGeometryReady(const IVolumeSlicer::GeometryReadyMessage& message)
186 { 186 {
187 // Once the geometry of the series is downloaded from Orthanc, 187 // Once the geometry of the series is downloaded from Orthanc,
188 // display its middle slice, and adapt the viewport to fit this 188 // display its middle slice, and adapt the viewport to fit this
189 // slice 189 // slice
190 if (source_ == &message.GetOrigin()) 190 if (source_ == &message.GetOrigin())
195 GetMainWidget().FitContent(); 195 GetMainWidget().FitContent();
196 } 196 }
197 197
198 std::auto_ptr<Interactor> mainWidgetInteractor_; 198 std::auto_ptr<Interactor> mainWidgetInteractor_;
199 std::auto_ptr<OrthancApiClient> orthancApiClient_; 199 std::auto_ptr<OrthancApiClient> orthancApiClient_;
200 const OrthancFrameLayerSource* source_; 200 const DicomSeriesVolumeSlicer* source_;
201 unsigned int slice_; 201 unsigned int slice_;
202 202
203 public: 203 public:
204 SingleFrameApplication(MessageBroker& broker) : 204 SingleFrameApplication(MessageBroker& broker) :
205 IObserver(broker), 205 IObserver(broker),
243 int frame = parameters["frame"].as<unsigned int>(); 243 int frame = parameters["frame"].as<unsigned int>();
244 244
245 orthancApiClient_.reset(new OrthancApiClient(GetBroker(), context_->GetWebService())); 245 orthancApiClient_.reset(new OrthancApiClient(GetBroker(), context_->GetWebService()));
246 mainWidget_ = new SliceViewerWidget(GetBroker(), "main-widget"); 246 mainWidget_ = new SliceViewerWidget(GetBroker(), "main-widget");
247 247
248 std::auto_ptr<OrthancFrameLayerSource> layer(new OrthancFrameLayerSource(GetBroker(), *orthancApiClient_)); 248 std::auto_ptr<DicomSeriesVolumeSlicer> layer(new DicomSeriesVolumeSlicer(GetBroker(), *orthancApiClient_));
249 source_ = layer.get(); 249 source_ = layer.get();
250 layer->LoadFrame(instance, frame); 250 layer->LoadFrame(instance, frame);
251 layer->RegisterObserverCallback(new Callable<SingleFrameApplication, ILayerSource::GeometryReadyMessage>(*this, &SingleFrameApplication::OnMainWidgetGeometryReady)); 251 layer->RegisterObserverCallback(new Callable<SingleFrameApplication, IVolumeSlicer::GeometryReadyMessage>(*this, &SingleFrameApplication::OnMainWidgetGeometryReady));
252 GetMainWidget().AddLayer(layer.release()); 252 GetMainWidget().AddLayer(layer.release());
253 253
254 RenderStyle s; 254 RenderStyle s;
255 255
256 if (parameters["smooth"].as<bool>()) 256 if (parameters["smooth"].as<bool>())