Mercurial > hg > orthanc-stone
comparison Framework/Toolbox/OrthancSlicesLoader.h @ 266:c9cf95b49a86 am-2
removed OrthancSlicesLoader::ISliceLoaderObserver; now using standard messages instead
author | am@osimis.io |
---|---|
date | Tue, 21 Aug 2018 18:14:22 +0200 |
parents | 77fdab5b5d6e |
children | 89d02de83c03 |
comparison
equal
deleted
inserted
replaced
265:30dc6e383b0b | 266:c9cf95b49a86 |
---|---|
27 | 27 |
28 #include <boost/shared_ptr.hpp> | 28 #include <boost/shared_ptr.hpp> |
29 | 29 |
30 namespace OrthancStone | 30 namespace OrthancStone |
31 { | 31 { |
32 class OrthancSlicesLoader : public boost::noncopyable | 32 class OrthancSlicesLoader : public IObservable |
33 { | 33 { |
34 public: | 34 public: |
35 struct SliceImageReadyMessage : public IMessage | 35 struct SliceImageReadyMessage : public IMessage |
36 { | 36 { |
37 unsigned int sliceIndex_; | 37 unsigned int sliceIndex_; |
66 sliceIndex_(sliceIndex), | 66 sliceIndex_(sliceIndex), |
67 effectiveQuality_(effectiveQuality) | 67 effectiveQuality_(effectiveQuality) |
68 { | 68 { |
69 } | 69 } |
70 }; | 70 }; |
71 | |
72 public: | |
73 class ISliceLoaderObserver : public IObserver | |
74 { | |
75 public: | |
76 | |
77 ISliceLoaderObserver(MessageBroker& broker) | |
78 : IObserver(broker) | |
79 { | |
80 } | |
81 | |
82 virtual ~ISliceLoaderObserver() | |
83 { | |
84 } | |
85 | |
86 virtual void HandleMessage(IObservable& from, const IMessage& message); | |
87 | |
88 virtual void OnSliceGeometryReady(const OrthancSlicesLoader& loader) = 0; | |
89 | |
90 virtual void OnSliceGeometryError(const OrthancSlicesLoader& loader) = 0; | |
91 | |
92 virtual void OnSliceImageReady(const OrthancSlicesLoader& loader, | |
93 unsigned int sliceIndex, | |
94 const Slice& slice, | |
95 std::auto_ptr<Orthanc::ImageAccessor>& image, | |
96 SliceImageQuality effectiveQuality) = 0; | |
97 | |
98 virtual void OnSliceImageError(const OrthancSlicesLoader& loader, | |
99 unsigned int sliceIndex, | |
100 const Slice& slice, | |
101 SliceImageQuality quality) = 0; | |
102 }; | |
103 | 71 |
104 private: | 72 private: |
105 enum State | 73 enum State |
106 { | 74 { |
107 State_Error, | 75 State_Error, |
123 class Operation; | 91 class Operation; |
124 class WebCallback; | 92 class WebCallback; |
125 | 93 |
126 boost::shared_ptr<WebCallback> webCallback_; // This is a PImpl pattern | 94 boost::shared_ptr<WebCallback> webCallback_; // This is a PImpl pattern |
127 | 95 |
128 ISliceLoaderObserver& userCallback_; // TODO: instead of passing a userCallback, use the generic messages | |
129 IWebService& orthanc_; | 96 IWebService& orthanc_; |
130 State state_; | 97 State state_; |
131 SlicesSorter slices_; | 98 SlicesSorter slices_; |
132 | 99 |
133 void NotifySliceImageSuccess(const Operation& operation, | 100 void NotifySliceImageSuccess(const Operation& operation, |
175 | 142 |
176 void SortAndFinalizeSlices(); | 143 void SortAndFinalizeSlices(); |
177 | 144 |
178 public: | 145 public: |
179 OrthancSlicesLoader(MessageBroker& broker, | 146 OrthancSlicesLoader(MessageBroker& broker, |
180 ISliceLoaderObserver& callback, | 147 //ISliceLoaderObserver& callback, |
181 IWebService& orthanc); | 148 IWebService& orthanc); |
182 | 149 |
183 void ScheduleLoadSeries(const std::string& seriesId); | 150 void ScheduleLoadSeries(const std::string& seriesId); |
184 | 151 |
185 void ScheduleLoadInstance(const std::string& instanceId); | 152 void ScheduleLoadInstance(const std::string& instanceId); |
196 bool LookupSlice(size_t& index, | 163 bool LookupSlice(size_t& index, |
197 const CoordinateSystem3D& plane) const; | 164 const CoordinateSystem3D& plane) const; |
198 | 165 |
199 void ScheduleLoadSliceImage(size_t index, | 166 void ScheduleLoadSliceImage(size_t index, |
200 SliceImageQuality requestedQuality); | 167 SliceImageQuality requestedQuality); |
168 | |
169 virtual void HandleMessage(const IObservable& from, const IMessage& message); | |
201 }; | 170 }; |
202 } | 171 } |