Mercurial > hg > orthanc-stone
annotate Framework/Radiography/RadiographyAlphaLayer.h @ 860:238693c3bc51 am-dev
merge default -> am-dev
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Mon, 24 Jun 2019 14:35:00 +0200 |
parents | 77e0eb83ff63 |
children | b537002f83a9 a5f2a6b04a31 |
rev | line source |
---|---|
430 | 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 "RadiographyLayer.h" | |
25 | |
26 namespace OrthancStone | |
27 { | |
28 class RadiographyScene; | |
29 | |
30 // creates a transparent layer whose alpha channel is provided as a UINT8 image to SetAlpha. | |
31 // The color of the "mask" is either defined by a ForegroundValue or by the center value of the | |
32 // windowing from the scene. | |
33 class RadiographyAlphaLayer : public RadiographyLayer | |
34 { | |
35 private: | |
36 std::auto_ptr<Orthanc::ImageAccessor> alpha_; // Grayscale8 | |
37 bool useWindowing_; | |
38 float foreground_; | |
39 | |
40 public: | |
503
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
430
diff
changeset
|
41 RadiographyAlphaLayer(MessageBroker& broker, const RadiographyScene& scene) : |
77e0eb83ff63
layers are now Observable and emitting LayerEdited messages
amazy
parents:
430
diff
changeset
|
42 RadiographyLayer(broker, scene), |
430 | 43 useWindowing_(true), |
44 foreground_(0) | |
45 { | |
46 } | |
47 | |
48 | |
49 void SetForegroundValue(float foreground) | |
50 { | |
51 useWindowing_ = false; | |
52 foreground_ = foreground; | |
53 } | |
54 | |
55 float GetForegroundValue() const | |
56 { | |
57 return foreground_; | |
58 } | |
59 | |
60 bool IsUsingWindowing() const | |
61 { | |
62 return useWindowing_; | |
63 } | |
64 | |
65 void SetAlpha(Orthanc::ImageAccessor* image); | |
66 | |
67 virtual bool GetDefaultWindowing(float& center, | |
68 float& width) const | |
69 { | |
70 return false; | |
71 } | |
72 | |
73 | |
74 virtual void Render(Orthanc::ImageAccessor& buffer, | |
75 const AffineTransform2D& viewTransform, | |
76 ImageInterpolation interpolation) const; | |
77 | |
78 virtual bool GetRange(float& minValue, | |
79 float& maxValue) const; | |
80 | |
81 const Orthanc::ImageAccessor& GetAlpha() const | |
82 { | |
83 return *(alpha_.get()); | |
84 } | |
85 | |
86 | |
87 }; | |
88 } |