comparison Samples/Sdl/Loader.cpp @ 803:d61728752790

more docs
author Benjamin Golinvaux <bgo@osimis.io>
date Tue, 28 May 2019 15:31:12 +0200
parents f38c1fc08655
children 6a75f1c03c4e
comparison
equal deleted inserted replaced
802:f38c1fc08655 803:d61728752790
57 #include <EmbeddedResources.h> 57 #include <EmbeddedResources.h>
58 58
59 59
60 namespace OrthancStone 60 namespace OrthancStone
61 { 61 {
62 // Application-configurable, can be shared between 3D/2D 62 /**
63 This interface is implemented by objects able to create an ISceneLayer
64 suitable to display the Orthanc image supplied to the CreateTextureXX
65 factory methods (taking Dicom parameters into account if relevant).
66
67 It can also refresh the style of an existing layer afterwards, to match
68 the configurator settings.
69 */
63 class ILayerStyleConfigurator 70 class ILayerStyleConfigurator
64 { 71 {
65 public: 72 public:
66 virtual ~ILayerStyleConfigurator() 73 virtual ~ILayerStyleConfigurator()
67 { 74 {
75 const DicomInstanceParameters& parameters) const = 0; 82 const DicomInstanceParameters& parameters) const = 0;
76 83
77 virtual void ApplyStyle(ISceneLayer& layer) const = 0; 84 virtual void ApplyStyle(ISceneLayer& layer) const = 0;
78 }; 85 };
79 86
80 87 /**
81 88 This configurator supplies an API to set a display range and a LUT.
89 */
82 class LookupTableStyleConfigurator : public ILayerStyleConfigurator 90 class LookupTableStyleConfigurator : public ILayerStyleConfigurator
83 { 91 {
84 private: 92 private:
85 uint64_t revision_; 93 uint64_t revision_;
86 bool hasLut_; 94 bool hasLut_;
158 l.FitRange(); 166 l.FitRange();
159 } 167 }
160 } 168 }
161 }; 169 };
162 170
163 171 /**
172 Creates layers to display the supplied image in grayscale. No dynamic
173 style is available.
174 */
164 class GrayscaleStyleConfigurator : public ILayerStyleConfigurator 175 class GrayscaleStyleConfigurator : public ILayerStyleConfigurator
165 { 176 {
166 private: 177 private:
167 uint64_t revision_; 178 uint64_t revision_;
168 179
193 } 204 }
194 }; 205 };
195 206
196 /** 207 /**
197 This interface is implemented by objects representing 3D volume data and 208 This interface is implemented by objects representing 3D volume data and
198 that are able to return an object that represent a slice of their data 209 that are able to return an object that:
199 and are able to create the corresponding visual representation. 210 - represent a slice of their data
211 - are able to create the corresponding slice visual representation.
200 */ 212 */
201 class IVolumeSlicer : public boost::noncopyable 213 class IVolumeSlicer : public boost::noncopyable
202 { 214 {
203 public: 215 public:
204 /** 216 /**
230 state). 242 state).
231 This **must** be a cheap call. 243 This **must** be a cheap call.
232 */ 244 */
233 virtual uint64_t GetRevision() = 0; 245 virtual uint64_t GetRevision() = 0;
234 246
235 // This call can take some time 247 /** Creates the slice visual representation */
236 virtual ISceneLayer* CreateSceneLayer(const ILayerStyleConfigurator* configurator, // possibly absent 248 virtual ISceneLayer* CreateSceneLayer(
237 const CoordinateSystem3D& cuttingPlane) = 0; 249 const ILayerStyleConfigurator* configurator, // possibly absent
250 const CoordinateSystem3D& cuttingPlane) = 0;
238 }; 251 };
239 252
240 /** 253 /**
241 See IExtractedSlice.IsValid() 254 See IExtractedSlice.IsValid()
242 */ 255 */
266 } 279 }
267 280
268 /** 281 /**
269 This method is implemented by the objects representing volumetric data 282 This method is implemented by the objects representing volumetric data
270 and must returns an IExtractedSlice subclass that contains all the data 283 and must returns an IExtractedSlice subclass that contains all the data
271 needed to, later one, create its visual representation through 284 needed to, later on, create its visual representation through
272 CreateSceneLayer. 285 CreateSceneLayer.
273 Subclasses a.o.: ExtractedSlice, Slice, InvalidSlice 286 Subclasses a.o.:
287 - InvalidSlice,
288 - DicomVolumeImageMPRSlicer::Slice,
289 - DicomVolumeImageReslicer::Slice
290 - DicomStructureSetLoader::Slice
274 */ 291 */
275 virtual IExtractedSlice* ExtractSlice(const CoordinateSystem3D& cuttingPlane) = 0; 292 virtual IExtractedSlice* ExtractSlice(const CoordinateSystem3D& cuttingPlane) = 0;
276 }; 293 };
277 294
278 /** 295 /**
406 return volume_.GetRevision(); 423 return volume_.GetRevision();
407 } 424 }
408 425
409 public: 426 public:
410 /** 427 /**
428 Represents a slice of a volume image that is parallel to the
429 coordinate system axis.
411 The constructor initializes the type of projection (axial, sagittal or 430 The constructor initializes the type of projection (axial, sagittal or
412 coronal) and the corresponding slice index, from the cutting plane. 431 coronal) and the corresponding slice index, from the cutting plane.
413 */ 432 */
414 Slice(const DicomVolumeImage& volume, 433 Slice(const DicomVolumeImage& volume,
415 const CoordinateSystem3D& cuttingPlane) : 434 const CoordinateSystem3D& cuttingPlane) :
513 DicomVolumeImageMPRSlicer(const boost::shared_ptr<DicomVolumeImage>& volume) : 532 DicomVolumeImageMPRSlicer(const boost::shared_ptr<DicomVolumeImage>& volume) :
514 volume_(volume) 533 volume_(volume)
515 { 534 {
516 } 535 }
517 536
518 virtual IExtractedSlice* ExtractSlice(const CoordinateSystem3D& cuttingPlane) 537 virtual IExtractedSlice* ExtractSlice(const CoordinateSystem3D& cuttingPlane) ORTHANC_OVERRIDE
519 { 538 {
520 if (volume_->HasGeometry()) 539 if (volume_->HasGeometry())
521 { 540 {
522 return new Slice(*volume_, cuttingPlane); 541 return new Slice(*volume_, cuttingPlane);
523 } 542 }
529 }; 548 };
530 549
531 550
532 551
533 552
534 553 /**
554 This class is used to manage the progressive loading of a volume that
555 is stored in a Dicom series.
556
535 // TODO - Refactor using LoaderStateMachine? 557 // TODO - Refactor using LoaderStateMachine?
558 // TODO:
559 */
536 class OrthancSeriesVolumeProgressiveLoader : 560 class OrthancSeriesVolumeProgressiveLoader :
537 public IObserver, 561 public IObserver,
538 public IObservable, 562 public IObservable,
539 public IVolumeSlicer 563 public IVolumeSlicer
540 { 564 {
541 private: 565 private:
542 static const unsigned int LOW_QUALITY = 0; 566 static const unsigned int LOW_QUALITY = 0;
543 static const unsigned int MIDDLE_QUALITY = 1; 567 static const unsigned int MIDDLE_QUALITY = 1;
544 static const unsigned int BEST_QUALITY = 2; 568 static const unsigned int BEST_QUALITY = 2;
545 569
546 570 /** Helper class internal to OrthancSeriesVolumeProgressiveLoader */
547 // Helper class internal to OrthancSeriesVolumeProgressiveLoader
548 class SeriesGeometry : public boost::noncopyable 571 class SeriesGeometry : public boost::noncopyable
549 { 572 {
550 private: 573 private:
551 void CheckSlice(size_t index, 574 void CheckSlice(size_t index,
552 const DicomInstanceParameters& reference) const 575 const DicomInstanceParameters& reference) const
1004 1027
1005 oracle_.Schedule(*this, command.release()); 1028 oracle_.Schedule(*this, command.release());
1006 } 1029 }
1007 } 1030 }
1008 1031
1009 1032 /**
1033 When a slice is requested, the strategy algorithm (that defines the
1034 sequence of resources to be loaded from the server) is modified to
1035 take into account this request (this is done in the ExtractedSlice ctor)
1036 */
1010 virtual IExtractedSlice* ExtractSlice(const CoordinateSystem3D& cuttingPlane) 1037 virtual IExtractedSlice* ExtractSlice(const CoordinateSystem3D& cuttingPlane)
1011 { 1038 {
1012 if (volume_->HasGeometry()) 1039 if (volume_->HasGeometry())
1013 { 1040 {
1014 return new ExtractedSlice(*this, cuttingPlane); 1041 return new ExtractedSlice(*this, cuttingPlane);