Mercurial > hg > orthanc-stone
annotate Framework/Radiography/RadiographyAlphaLayer.h @ 1255:c1c83c1fb837 broker
GetOrthancImageCommand: handling of unsupported formats
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 08 Jan 2020 15:22:13 +0100 |
parents | 54cbffabdc45 |
children | 68579a31eeb4 |
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: | |
1196
a5f2a6b04a31
RadiographyScene: windowing is now only applied to the Dicom layer
Alain Mazy <alain@mazy.be>
parents:
503
diff
changeset
|
36 std::auto_ptr<Orthanc::ImageAccessor> alpha_; // Grayscale8 in the range [0, 255] 0 = transparent, 255 = opaque -> the foreground value will be displayed |
a5f2a6b04a31
RadiographyScene: windowing is now only applied to the Dicom layer
Alain Mazy <alain@mazy.be>
parents:
503
diff
changeset
|
37 float foreground_; // in the range [0.0, 65535.0] |
430 | 38 |
39 public: | |
1066
b537002f83a9
removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
40 RadiographyAlphaLayer(const RadiographyScene& scene) : |
b537002f83a9
removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
41 RadiographyLayer(scene), |
430 | 42 foreground_(0) |
43 { | |
44 } | |
45 | |
46 | |
47 void SetForegroundValue(float foreground) | |
48 { | |
49 foreground_ = foreground; | |
50 } | |
51 | |
52 float GetForegroundValue() const | |
53 { | |
54 return foreground_; | |
55 } | |
56 | |
57 void SetAlpha(Orthanc::ImageAccessor* image); | |
58 | |
59 virtual bool GetDefaultWindowing(float& center, | |
60 float& width) const | |
61 { | |
62 return false; | |
63 } | |
64 | |
65 | |
66 virtual void Render(Orthanc::ImageAccessor& buffer, | |
67 const AffineTransform2D& viewTransform, | |
1196
a5f2a6b04a31
RadiographyScene: windowing is now only applied to the Dicom layer
Alain Mazy <alain@mazy.be>
parents:
503
diff
changeset
|
68 ImageInterpolation interpolation, |
a5f2a6b04a31
RadiographyScene: windowing is now only applied to the Dicom layer
Alain Mazy <alain@mazy.be>
parents:
503
diff
changeset
|
69 float windowCenter, |
a5f2a6b04a31
RadiographyScene: windowing is now only applied to the Dicom layer
Alain Mazy <alain@mazy.be>
parents:
503
diff
changeset
|
70 float windowWidth, |
a5f2a6b04a31
RadiographyScene: windowing is now only applied to the Dicom layer
Alain Mazy <alain@mazy.be>
parents:
503
diff
changeset
|
71 bool applyWindowing) const; |
430 | 72 |
73 virtual bool GetRange(float& minValue, | |
74 float& maxValue) const; | |
75 | |
76 const Orthanc::ImageAccessor& GetAlpha() const | |
77 { | |
78 return *(alpha_.get()); | |
79 } | |
80 | |
81 | |
82 }; | |
83 } |