Mercurial > hg > orthanc-stone
annotate Framework/Radiography/RadiographyWidget.h @ 448:cc47e6eaefb0 bgo-commands-codegen
Fixed dummy change
author | bgo-osimis |
---|---|
date | Wed, 16 Jan 2019 21:08:38 +0100 |
parents | a750f11892ec |
children | 64d90190a08c |
rev | line source |
---|---|
413 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
439 | 5 * Copyright (C) 2017-2019 Osimis S.A., Belgium |
413 | 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: | |
428
751fb354149e
ability to change the scene of the RadiographyWidget
am@osimis.io
parents:
413
diff
changeset
|
35 boost::shared_ptr<RadiographyScene> scene_; |
413 | 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 { | |
428
751fb354149e
ability to change the scene of the RadiographyWidget
am@osimis.io
parents:
413
diff
changeset
|
50 return scene_->GetSceneExtent(); |
413 | 51 } |
52 | |
53 virtual bool RenderScene(CairoContext& context, | |
54 const ViewportGeometry& view); | |
55 | |
432
4eb96c6b4e96
improved handling of MONOCHROME1, background and invertion
am@osimis.io
parents:
428
diff
changeset
|
56 virtual void RenderBackground(Orthanc::ImageAccessor& image, float minValue, float maxValue); |
4eb96c6b4e96
improved handling of MONOCHROME1, background and invertion
am@osimis.io
parents:
428
diff
changeset
|
57 |
4eb96c6b4e96
improved handling of MONOCHROME1, background and invertion
am@osimis.io
parents:
428
diff
changeset
|
58 bool IsInvertedInternal() const; |
4eb96c6b4e96
improved handling of MONOCHROME1, background and invertion
am@osimis.io
parents:
428
diff
changeset
|
59 |
413 | 60 public: |
61 RadiographyWidget(MessageBroker& broker, | |
428
751fb354149e
ability to change the scene of the RadiographyWidget
am@osimis.io
parents:
413
diff
changeset
|
62 boost::shared_ptr<RadiographyScene> scene, // TODO: check how we can avoid boost::shared_ptr here since we don't want them in the public API (app is keeping a boost::shared_ptr to this right now) |
413 | 63 const std::string& name); |
64 | |
65 RadiographyScene& GetScene() const | |
66 { | |
428
751fb354149e
ability to change the scene of the RadiographyWidget
am@osimis.io
parents:
413
diff
changeset
|
67 return *scene_; |
413 | 68 } |
69 | |
428
751fb354149e
ability to change the scene of the RadiographyWidget
am@osimis.io
parents:
413
diff
changeset
|
70 void SetScene(boost::shared_ptr<RadiographyScene> scene); |
751fb354149e
ability to change the scene of the RadiographyWidget
am@osimis.io
parents:
413
diff
changeset
|
71 |
413 | 72 void Unselect() |
73 { | |
74 hasSelection_ = false; | |
75 } | |
76 | |
77 void Select(size_t layer); | |
78 | |
79 bool LookupSelectedLayer(size_t& layer); | |
80 | |
81 void OnGeometryChanged(const RadiographyScene::GeometryChangedMessage& message); | |
82 | |
83 void OnContentChanged(const RadiographyScene::ContentChangedMessage& message); | |
84 | |
85 void SetInvert(bool invert); | |
86 | |
87 void SwitchInvert(); | |
88 | |
89 bool IsInverted() const | |
90 { | |
91 return invert_; | |
92 } | |
93 | |
94 void SetInterpolation(ImageInterpolation interpolation); | |
95 | |
96 ImageInterpolation GetInterpolation() const | |
97 { | |
98 return interpolation_; | |
99 } | |
100 }; | |
101 } |