comparison OrthancStone/Samples/Common/RtViewerView.h @ 1512:244ad1e4e76a

reorganization of folders
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 07 Jul 2020 16:21:02 +0200
parents Samples/Common/RtViewerView.h@828a9b4ee1b7
children 301571299212
comparison
equal deleted inserted replaced
1511:9dfeee74c1e6 1512:244ad1e4e76a
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-2020 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 "../../Sources/Loaders/DicomStructureSetLoader.h"
25 #include "../../Sources/Loaders/ILoadersContext.h"
26 #include "../../Sources/Loaders/OrthancMultiframeVolumeLoader.h"
27 #include "../../Sources/Loaders/OrthancSeriesVolumeProgressiveLoader.h"
28 #include "../../Sources/Messages/IMessageEmitter.h"
29 #include "../../Sources/Messages/IObserver.h"
30 #include "../../Sources/Messages/ObserverBase.h"
31 #include "../../Sources/Oracle/OracleCommandExceptionMessage.h"
32 #include "../../Sources/Scene2DViewport/ViewportController.h"
33 #include "../../Sources/Viewport/IViewport.h"
34 #include "../../Sources/Volumes/DicomVolumeImage.h"
35 #include "../../Sources/Volumes/VolumeSceneLayerSource.h"
36
37 #include <boost/enable_shared_from_this.hpp>
38 #include <boost/thread.hpp>
39 #include <boost/noncopyable.hpp>
40
41 namespace OrthancStone
42 {
43 class RtViewerApp;
44
45 class RtViewerView : public ObserverBase<RtViewerView>
46 {
47 public:
48 RtViewerView(boost::weak_ptr<RtViewerApp> app,
49 const std::string& canvasId,
50 VolumeProjection projection)
51 : app_(app)
52 , currentPlane_(0)
53 , projection_(projection)
54 {
55 viewport_ = CreateViewport(canvasId);
56 FLOATING_INFOTEXT_LAYER_ZINDEX = 6;
57 FIXED_INFOTEXT_LAYER_ZINDEX = 7;
58 }
59
60 /**
61 This method is called when the scene transform changes. It allows to
62 recompute the visual elements whose content depend upon the scene transform
63 */
64 void OnSceneTransformChanged(
65 const ViewportController::SceneTransformChanged& message);
66
67 /**
68 This method will ask the VolumeSceneLayerSource, that are responsible to
69 generated 2D content based on a volume and a cutting plane, to regenerate
70 it. This is required if the volume itself changes (during loading) or if
71 the cutting plane is changed
72 */
73 void UpdateLayers();
74
75 void Refresh();
76
77 void TakeScreenshot(
78 const std::string& target,
79 unsigned int canvasWidth,
80 unsigned int canvasHeight);
81
82 void Scroll(int delta);
83
84 void Invalidate();
85 void FitContent();
86 void RetrieveGeometry();
87 void PrepareViewport();
88 void RegisterMessages();
89
90 #if ORTHANC_ENABLE_SDL == 1
91 void EnableGLDebugOutput();
92 #endif
93
94 void CreateLayers(boost::shared_ptr<OrthancSeriesVolumeProgressiveLoader> ctLoader,
95 boost::shared_ptr<OrthancMultiframeVolumeLoader> doseLoader,
96 boost::shared_ptr<DicomVolumeImage> doseVolume,
97 boost::shared_ptr<DicomStructureSetLoader> rtstructLoader);
98
99 boost::shared_ptr<IViewport> GetViewport()
100 {
101 return viewport_;
102 }
103
104 private:
105 void SetInfoDisplayMessage(std::string key, std::string value);
106 boost::shared_ptr<RtViewerApp> GetApp();
107 boost::shared_ptr<IViewport> CreateViewport(const std::string& canvasId);
108 void DisplayInfoText();
109 void HideInfoText();
110 void DisplayFloatingCtrlInfoText(const PointerEvent& e);
111
112 void SetCtVolumeSlicer(const boost::shared_ptr<IVolumeSlicer>& volume,
113 ILayerStyleConfigurator* style);
114
115 void SetDoseVolumeSlicer(const boost::shared_ptr<IVolumeSlicer>& volume,
116 ILayerStyleConfigurator* style);
117
118 void SetStructureSet(const boost::shared_ptr<DicomStructureSetLoader>& volume);
119
120 private:
121 boost::weak_ptr<RtViewerApp> app_;
122 boost::shared_ptr<VolumeSceneLayerSource> ctVolumeLayerSource_, doseVolumeLayerSource_, structLayerSource_;
123
124 // collection of cutting planes for this particular view
125 std::vector<OrthancStone::CoordinateSystem3D> planes_;
126 size_t currentPlane_;
127
128 VolumeProjection projection_;
129
130 std::map<std::string, std::string> infoTextMap_;
131
132 int FLOATING_INFOTEXT_LAYER_ZINDEX;
133 int FIXED_INFOTEXT_LAYER_ZINDEX;
134 boost::shared_ptr<IViewport> viewport_;
135 };
136 }