Mercurial > hg > orthanc-stone
comparison Framework/dev.h @ 252:40b21c1f8b8d am-2
more usage of IObservable/IObserver
author | am@osimis.io |
---|---|
date | Tue, 03 Jul 2018 10:26:56 +0200 |
parents | 192e6e349e69 |
children | c9cf95b49a86 |
comparison
equal
deleted
inserted
replaced
251:192e6e349e69 | 252:40b21c1f8b8d |
---|---|
41 namespace OrthancStone | 41 namespace OrthancStone |
42 { | 42 { |
43 // TODO: Handle errors while loading | 43 // TODO: Handle errors while loading |
44 class OrthancVolumeImage : | 44 class OrthancVolumeImage : |
45 public SlicedVolumeBase, | 45 public SlicedVolumeBase, |
46 private OrthancSlicesLoader::ICallback | 46 private OrthancSlicesLoader::ISliceLoaderObserver |
47 { | 47 { |
48 private: | 48 private: |
49 OrthancSlicesLoader loader_; | 49 OrthancSlicesLoader loader_; |
50 std::auto_ptr<ImageBuffer3D> image_; | 50 std::auto_ptr<ImageBuffer3D> image_; |
51 std::auto_ptr<DownloadStack> downloadStack_; | 51 std::auto_ptr<DownloadStack> downloadStack_; |
104 return fabs(a.GetGeometry().ProjectAlongNormal(a.GetGeometry().GetOrigin()) - | 104 return fabs(a.GetGeometry().ProjectAlongNormal(a.GetGeometry().GetOrigin()) - |
105 a.GetGeometry().ProjectAlongNormal(b.GetGeometry().GetOrigin())); | 105 a.GetGeometry().ProjectAlongNormal(b.GetGeometry().GetOrigin())); |
106 } | 106 } |
107 | 107 |
108 | 108 |
109 virtual void NotifyGeometryReady(const OrthancSlicesLoader& loader) | 109 virtual void OnSliceGeometryReady(const OrthancSlicesLoader& loader) |
110 { | 110 { |
111 if (loader.GetSliceCount() == 0) | 111 if (loader.GetSliceCount() == 0) |
112 { | 112 { |
113 LOG(ERROR) << "Empty volume image"; | 113 LOG(ERROR) << "Empty volume image"; |
114 SlicedVolumeBase::NotifyGeometryError(); | 114 SlicedVolumeBase::NotifyGeometryError(); |
171 // TODO Check the DicomFrameConverter are constant | 171 // TODO Check the DicomFrameConverter are constant |
172 | 172 |
173 SlicedVolumeBase::NotifyGeometryReady(); | 173 SlicedVolumeBase::NotifyGeometryReady(); |
174 } | 174 } |
175 | 175 |
176 virtual void NotifyGeometryError(const OrthancSlicesLoader& loader) | 176 virtual void OnSliceGeometryError(const OrthancSlicesLoader& loader) |
177 { | 177 { |
178 LOG(ERROR) << "Unable to download a volume image"; | 178 LOG(ERROR) << "Unable to download a volume image"; |
179 SlicedVolumeBase::NotifyGeometryError(); | 179 SlicedVolumeBase::NotifyGeometryError(); |
180 } | 180 } |
181 | 181 |
182 virtual void NotifySliceImageReady(const OrthancSlicesLoader& loader, | 182 virtual void OnSliceImageReady(const OrthancSlicesLoader& loader, |
183 unsigned int sliceIndex, | 183 unsigned int sliceIndex, |
184 const Slice& slice, | 184 const Slice& slice, |
185 std::auto_ptr<Orthanc::ImageAccessor>& image, | 185 std::auto_ptr<Orthanc::ImageAccessor>& image, |
186 SliceImageQuality quality) | 186 SliceImageQuality quality) |
187 { | 187 { |
203 } | 203 } |
204 | 204 |
205 ScheduleSliceDownload(); | 205 ScheduleSliceDownload(); |
206 } | 206 } |
207 | 207 |
208 virtual void NotifySliceImageError(const OrthancSlicesLoader& loader, | 208 virtual void OnSliceImageError(const OrthancSlicesLoader& loader, |
209 unsigned int sliceIndex, | 209 unsigned int sliceIndex, |
210 const Slice& slice, | 210 const Slice& slice, |
211 SliceImageQuality quality) | 211 SliceImageQuality quality) |
212 { | 212 { |
213 LOG(ERROR) << "Cannot download slice " << sliceIndex << " in a volume image"; | 213 LOG(ERROR) << "Cannot download slice " << sliceIndex << " in a volume image"; |
216 | 216 |
217 public: | 217 public: |
218 OrthancVolumeImage(MessageBroker& broker, | 218 OrthancVolumeImage(MessageBroker& broker, |
219 IWebService& orthanc, | 219 IWebService& orthanc, |
220 bool computeRange) : | 220 bool computeRange) : |
221 OrthancSlicesLoader::ISliceLoaderObserver(broker), | |
221 loader_(broker, *this, orthanc), | 222 loader_(broker, *this, orthanc), |
222 computeRange_(computeRange), | 223 computeRange_(computeRange), |
223 pendingSlices_(0) | 224 pendingSlices_(0) |
224 { | 225 { |
225 } | 226 } |