comparison Framework/Layers/OrthancFrameLayerSource.cpp @ 89:f244018a4e4b wasm

BUGGY- trying to remove IVolumeSlicesObserver
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 26 May 2017 18:27:59 +0200
parents 02c3a7a4938f
children 64e60018943f
comparison
equal deleted inserted replaced
88:90bf4116a23c 89:f244018a4e4b
28 #include "../Toolbox/DicomFrameConverter.h" 28 #include "../Toolbox/DicomFrameConverter.h"
29 29
30 #include <boost/lexical_cast.hpp> 30 #include <boost/lexical_cast.hpp>
31 31
32 32
33 // TODO REMOVE THIS
34 #include "../Widgets/LayerWidget.h"
35
33 namespace OrthancStone 36 namespace OrthancStone
34 { 37 {
35 void OrthancFrameLayerSource::NotifyGeometryReady(const OrthancSlicesLoader& loader) 38 void OrthancFrameLayerSource::NotifyGeometryReady(const OrthancSlicesLoader& loader)
36 { 39 {
40 #if 0
37 if (loader.GetSliceCount() > 0) 41 if (loader.GetSliceCount() > 0)
38 { 42 {
39 // Make sure all the slices are parallel. TODO Alleviate this constraint 43 // Make sure all the slices are parallel. TODO Alleviate this constraint
40 for (size_t i = 1; i < loader.GetSliceCount(); i++) 44 for (size_t i = 1; i < loader.GetSliceCount(); i++)
41 { 45 {
47 } 51 }
48 } 52 }
49 } 53 }
50 54
51 LayerSourceBase::NotifyGeometryReady(); 55 LayerSourceBase::NotifyGeometryReady();
56 #endif
52 57
53 if (observer2_ != NULL) 58 // TODO REMOVE THIS
59 /*if (GetObserver() != NULL)
54 { 60 {
55 ParallelSlices slices; 61 dynamic_cast<LayerWidget*>(GetObserver())->SetSlice(loader.GetSlice(0).GetGeometry());
56 62 }*/
57 for (size_t i = 0; i < loader.GetSliceCount(); i++)
58 {
59 slices.AddSlice(loader.GetSlice(i).GetGeometry());
60 }
61
62 observer2_->NotifySlicesAvailable(slices);
63 }
64 } 63 }
65 64
66 void OrthancFrameLayerSource::NotifyGeometryError(const OrthancSlicesLoader& loader) 65 void OrthancFrameLayerSource::NotifyGeometryError(const OrthancSlicesLoader& loader)
67 { 66 {
67 #if 0
68 LayerSourceBase::NotifyGeometryError(); 68 LayerSourceBase::NotifyGeometryError();
69 #endif
69 } 70 }
70 71
71 void OrthancFrameLayerSource::NotifySliceImageReady(const OrthancSlicesLoader& loader, 72 void OrthancFrameLayerSource::NotifySliceImageReady(const OrthancSlicesLoader& loader,
72 unsigned int sliceIndex, 73 unsigned int sliceIndex,
73 const Slice& slice, 74 const Slice& slice,
86 OrthancFrameLayerSource::OrthancFrameLayerSource(IWebService& orthanc, 87 OrthancFrameLayerSource::OrthancFrameLayerSource(IWebService& orthanc,
87 const std::string& instanceId, 88 const std::string& instanceId,
88 unsigned int frame) : 89 unsigned int frame) :
89 instanceId_(instanceId), 90 instanceId_(instanceId),
90 frame_(frame), 91 frame_(frame),
91 loader_(*this, orthanc), 92 loader_(*this, orthanc)
92 observer2_(NULL)
93 { 93 {
94 loader_.ScheduleLoadInstance(instanceId_, frame_); 94 loader_.ScheduleLoadInstance(instanceId_, frame_);
95 } 95 }
96 96
97 97
98 void OrthancFrameLayerSource::SetObserver(IVolumeSlicesObserver& observer)
99 {
100 if (observer2_ == NULL)
101 {
102 observer2_ = &observer;
103 }
104 else
105 {
106 // Cannot add more than one observer
107 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
108 }
109 }
110
111
112 bool OrthancFrameLayerSource::GetExtent(double& x1, 98 bool OrthancFrameLayerSource::GetExtent(double& x1,
113 double& y1, 99 double& y1,
114 double& x2, 100 double& x2,
115 double& y2, 101 double& y2,
116 const SliceGeometry& viewportSlice) 102 const SliceGeometry& viewportSlice)