413
|
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 "../Widgets/WorldSceneWidget.h"
|
|
25 #include "RadiographyScene.h"
|
|
26
|
|
27
|
|
28 namespace OrthancStone
|
|
29 {
|
|
30 class RadiographyWidget :
|
|
31 public WorldSceneWidget,
|
|
32 public IObserver
|
|
33 {
|
|
34 private:
|
|
35 RadiographyScene& scene_;
|
|
36 std::auto_ptr<Orthanc::ImageAccessor> floatBuffer_;
|
|
37 std::auto_ptr<CairoSurface> cairoBuffer_;
|
|
38 bool invert_;
|
|
39 ImageInterpolation interpolation_;
|
|
40 bool hasSelection_;
|
|
41 size_t selectedLayer_;
|
|
42
|
|
43 bool RenderInternal(unsigned int width,
|
|
44 unsigned int height,
|
|
45 ImageInterpolation interpolation);
|
|
46
|
|
47 protected:
|
|
48 virtual Extent2D GetSceneExtent()
|
|
49 {
|
|
50 return scene_.GetSceneExtent();
|
|
51 }
|
|
52
|
|
53 virtual bool RenderScene(CairoContext& context,
|
|
54 const ViewportGeometry& view);
|
|
55
|
|
56 public:
|
|
57 RadiographyWidget(MessageBroker& broker,
|
|
58 RadiographyScene& scene,
|
|
59 const std::string& name);
|
|
60
|
|
61 RadiographyScene& GetScene() const
|
|
62 {
|
|
63 return scene_;
|
|
64 }
|
|
65
|
|
66 void Unselect()
|
|
67 {
|
|
68 hasSelection_ = false;
|
|
69 }
|
|
70
|
|
71 void Select(size_t layer);
|
|
72
|
|
73 bool LookupSelectedLayer(size_t& layer);
|
|
74
|
|
75 void OnGeometryChanged(const RadiographyScene::GeometryChangedMessage& message);
|
|
76
|
|
77 void OnContentChanged(const RadiographyScene::ContentChangedMessage& message);
|
|
78
|
|
79 void SetInvert(bool invert);
|
|
80
|
|
81 void SwitchInvert();
|
|
82
|
|
83 bool IsInverted() const
|
|
84 {
|
|
85 return invert_;
|
|
86 }
|
|
87
|
|
88 void SetInterpolation(ImageInterpolation interpolation);
|
|
89
|
|
90 ImageInterpolation GetInterpolation() const
|
|
91 {
|
|
92 return interpolation_;
|
|
93 }
|
|
94 };
|
|
95 }
|