comparison Framework/Layers/DicomSeriesVolumeSlicer.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 Framework/Layers/OrthancFrameLayerSource.h@5f13809f3f76
children 72355b637945
comparison
equal deleted inserted replaced
395:5f13809f3f76 396:ed7146fa2c98
1 /**
2 * Stone of Orthanc
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
6 *
7 * This program is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU Affero General Public License
9 * as published by the Free Software Foundation, either version 3 of
10 * the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Affero General Public License for more details.
16 *
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 **/
20
21
22 #pragma once
23
24 #include "VolumeSlicerBase.h"
25 #include "../Toolbox/IWebService.h"
26 #include "../Toolbox/OrthancSlicesLoader.h"
27 #include "../Toolbox/OrthancApiClient.h"
28
29 namespace OrthancStone
30 {
31 // this class is in charge of loading a Frame.
32 // once it's been loaded (first the geometry and then the image),
33 // messages are sent to observers so they can use it
34 class DicomSeriesVolumeSlicer :
35 public VolumeSlicerBase,
36 public IObserver
37 //private OrthancSlicesLoader::ISliceLoaderObserver
38 {
39 public:
40 // TODO: Add "frame" and "instanceId"
41 class FrameReadyMessage : public OriginMessage<MessageType_DicomSeriesVolumeSlicer_FrameReady, DicomSeriesVolumeSlicer>
42 {
43 private:
44 const Orthanc::ImageAccessor& frame_;
45 SliceImageQuality imageQuality_;
46 const Slice& slice_;
47
48 public:
49 FrameReadyMessage(DicomSeriesVolumeSlicer& origin,
50 const Orthanc::ImageAccessor& frame,
51 SliceImageQuality imageQuality,
52 const Slice& slice) :
53 OriginMessage(origin),
54 frame_(frame),
55 imageQuality_(imageQuality),
56 slice_(slice)
57 {
58 }
59
60 const Orthanc::ImageAccessor& GetFrame() const
61 {
62 return frame_;
63 }
64
65 SliceImageQuality GetImageQuality() const
66 {
67 return imageQuality_;
68 }
69
70 const Slice& GetSlice() const
71 {
72 return slice_;
73 }
74 };
75
76
77 private:
78 class RendererFactory;
79
80 OrthancSlicesLoader loader_;
81 SliceImageQuality quality_;
82
83 public:
84 DicomSeriesVolumeSlicer(MessageBroker& broker, OrthancApiClient& orthanc);
85
86 void LoadSeries(const std::string& seriesId);
87
88 void LoadInstance(const std::string& instanceId);
89
90 void LoadFrame(const std::string& instanceId,
91 unsigned int frame);
92
93 void SetImageQuality(SliceImageQuality quality)
94 {
95 quality_ = quality;
96 }
97
98 SliceImageQuality GetImageQuality() const
99 {
100 return quality_;
101 }
102
103 size_t GetSliceCount() const
104 {
105 return loader_.GetSliceCount();
106 }
107
108 const Slice& GetSlice(size_t slice) const
109 {
110 return loader_.GetSlice(slice);
111 }
112
113 virtual bool GetExtent(std::vector<Vector>& points,
114 const CoordinateSystem3D& viewportSlice);
115
116 virtual void ScheduleLayerCreation(const CoordinateSystem3D& viewportSlice);
117
118 protected:
119 void OnSliceGeometryReady(const OrthancSlicesLoader::SliceGeometryReadyMessage& message);
120 void OnSliceGeometryError(const OrthancSlicesLoader::SliceGeometryErrorMessage& message);
121 void OnSliceImageReady(const OrthancSlicesLoader::SliceImageReadyMessage& message);
122 void OnSliceImageError(const OrthancSlicesLoader::SliceImageErrorMessage& message);
123 };
124 }