Mercurial > hg > orthanc-stone
annotate Framework/Radiography/RadiographyWidget.h @ 976:3abc47e051c8
Added tag toa2019083101 for changeset e75fd08d6c75
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Sat, 31 Aug 2019 13:50:11 +0200 |
parents | c35e98d22764 |
children | b537002f83a9 4663f158c748 |
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 | |
732
c35e98d22764
move Deprecated classes to a separate folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
726
diff
changeset
|
24 #include "../Deprecated/Widgets/WorldSceneWidget.h" |
413 | 25 #include "RadiographyScene.h" |
26 | |
27 | |
28 namespace OrthancStone | |
29 { | |
492 | 30 class RadiographyMaskLayer; |
31 | |
413 | 32 class RadiographyWidget : |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
492
diff
changeset
|
33 public Deprecated::WorldSceneWidget, |
413 | 34 public IObserver |
35 { | |
36 private: | |
428
751fb354149e
ability to change the scene of the RadiographyWidget
am@osimis.io
parents:
413
diff
changeset
|
37 boost::shared_ptr<RadiographyScene> scene_; |
413 | 38 std::auto_ptr<Orthanc::ImageAccessor> floatBuffer_; |
39 std::auto_ptr<CairoSurface> cairoBuffer_; | |
40 bool invert_; | |
41 ImageInterpolation interpolation_; | |
42 bool hasSelection_; | |
43 size_t selectedLayer_; | |
44 | |
45 bool RenderInternal(unsigned int width, | |
46 unsigned int height, | |
47 ImageInterpolation interpolation); | |
48 | |
49 protected: | |
50 virtual Extent2D GetSceneExtent() | |
51 { | |
428
751fb354149e
ability to change the scene of the RadiographyWidget
am@osimis.io
parents:
413
diff
changeset
|
52 return scene_->GetSceneExtent(); |
413 | 53 } |
54 | |
55 virtual bool RenderScene(CairoContext& context, | |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
492
diff
changeset
|
56 const Deprecated::ViewportGeometry& view); |
413 | 57 |
432
4eb96c6b4e96
improved handling of MONOCHROME1, background and invertion
am@osimis.io
parents:
428
diff
changeset
|
58 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
|
59 |
4eb96c6b4e96
improved handling of MONOCHROME1, background and invertion
am@osimis.io
parents:
428
diff
changeset
|
60 bool IsInvertedInternal() const; |
4eb96c6b4e96
improved handling of MONOCHROME1, background and invertion
am@osimis.io
parents:
428
diff
changeset
|
61 |
413 | 62 public: |
63 RadiographyWidget(MessageBroker& broker, | |
428
751fb354149e
ability to change the scene of the RadiographyWidget
am@osimis.io
parents:
413
diff
changeset
|
64 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 | 65 const std::string& name); |
66 | |
67 RadiographyScene& GetScene() const | |
68 { | |
428
751fb354149e
ability to change the scene of the RadiographyWidget
am@osimis.io
parents:
413
diff
changeset
|
69 return *scene_; |
413 | 70 } |
71 | |
428
751fb354149e
ability to change the scene of the RadiographyWidget
am@osimis.io
parents:
413
diff
changeset
|
72 void SetScene(boost::shared_ptr<RadiographyScene> scene); |
751fb354149e
ability to change the scene of the RadiographyWidget
am@osimis.io
parents:
413
diff
changeset
|
73 |
413 | 74 void Unselect() |
75 { | |
76 hasSelection_ = false; | |
77 } | |
78 | |
79 void Select(size_t layer); | |
80 | |
492 | 81 bool SelectMaskLayer(size_t index = 0); |
82 | |
413 | 83 bool LookupSelectedLayer(size_t& layer); |
84 | |
85 void OnGeometryChanged(const RadiographyScene::GeometryChangedMessage& message); | |
86 | |
87 void OnContentChanged(const RadiographyScene::ContentChangedMessage& message); | |
88 | |
89 void SetInvert(bool invert); | |
90 | |
91 void SwitchInvert(); | |
92 | |
93 bool IsInverted() const | |
94 { | |
95 return invert_; | |
96 } | |
97 | |
98 void SetInterpolation(ImageInterpolation interpolation); | |
99 | |
100 ImageInterpolation GetInterpolation() const | |
101 { | |
102 return interpolation_; | |
103 } | |
104 }; | |
105 } |