annotate OrthancStone/Sources/Scene2D/LookupTableTextureSceneLayer.h @ 1640:52b8b96cb55f

cleaning namespaces
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 10 Nov 2020 16:55:22 +0100
parents 8563ea5d8ae4
children 9ac2a65d4172
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
768
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
1270
2d8ab34c8c91 upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1080
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
768
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
8 * modify it under the terms of the GNU Lesser General Public License
768
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
15 * Lesser General Public License for more details.
1596
4fb8fdf03314 removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1571
diff changeset
16 *
1598
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
18 * License along with this program. If not, see
8563ea5d8ae4 relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1596
diff changeset
19 * <http://www.gnu.org/licenses/>.
768
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 **/
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 #pragma once
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include "TextureBaseSceneLayer.h"
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 namespace OrthancStone
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 {
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 class LookupTableTextureSceneLayer : public TextureBaseSceneLayer
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 {
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 private:
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 ImageWindowing windowing_;
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 float minValue_;
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 float maxValue_;
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 std::vector<uint8_t> lut_;
1179
177e7d431cd1 log scale in textures, remove redundant code for LUTs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1080
diff changeset
36 bool applyLog_;
768
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37
769
4ba8892870a2 improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 768
diff changeset
38 void SetLookupTableRgb(const std::vector<uint8_t>& lut);
4ba8892870a2 improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 768
diff changeset
39
768
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 public:
769
4ba8892870a2 improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 768
diff changeset
41 // The pixel format must be convertible to Float32
1571
85e117739eca cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
42 explicit LookupTableTextureSceneLayer(const Orthanc::ImageAccessor& texture);
768
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
769
4ba8892870a2 improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 768
diff changeset
44 void SetLookupTableGrayscale();
768
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
769
4ba8892870a2 improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 768
diff changeset
46 // The vector must contain either 3 * 256 values (RGB), or 4 * 256
4ba8892870a2 improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 768
diff changeset
47 // (RGBA). In the RGB case, an alpha channel will be automatically added.
768
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 void SetLookupTable(const std::vector<uint8_t>& lut);
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 void SetRange(float minValue,
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 float maxValue);
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 void FitRange();
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 float GetMinValue() const
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 {
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 return minValue_;
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 }
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 float GetMaxValue() const
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 {
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 return maxValue_;
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 }
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64
769
4ba8892870a2 improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 768
diff changeset
65 // This returns a vector of 4 * 256 values between 0 and 255, in RGBA.
768
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 const std::vector<uint8_t>& GetLookupTable() const
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 {
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 return lut_;
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 }
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70
1179
177e7d431cd1 log scale in textures, remove redundant code for LUTs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1080
diff changeset
71 void SetApplyLog(bool apply);
177e7d431cd1 log scale in textures, remove redundant code for LUTs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1080
diff changeset
72
177e7d431cd1 log scale in textures, remove redundant code for LUTs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1080
diff changeset
73 bool IsApplyLog() const
177e7d431cd1 log scale in textures, remove redundant code for LUTs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1080
diff changeset
74 {
177e7d431cd1 log scale in textures, remove redundant code for LUTs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1080
diff changeset
75 return applyLog_;
177e7d431cd1 log scale in textures, remove redundant code for LUTs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1080
diff changeset
76 }
177e7d431cd1 log scale in textures, remove redundant code for LUTs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1080
diff changeset
77
1571
85e117739eca cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
78 virtual ISceneLayer* Clone() const ORTHANC_OVERRIDE;
768
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79
1571
85e117739eca cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1512
diff changeset
80 virtual Type GetType() const ORTHANC_OVERRIDE
768
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 {
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 return Type_LookupTableTexture;
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 }
1179
177e7d431cd1 log scale in textures, remove redundant code for LUTs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1080
diff changeset
84
177e7d431cd1 log scale in textures, remove redundant code for LUTs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1080
diff changeset
85 // Render the texture to a color image of format BGRA32 (Cairo
177e7d431cd1 log scale in textures, remove redundant code for LUTs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1080
diff changeset
86 // surfaces) or RGBA32 (OpenGL)
177e7d431cd1 log scale in textures, remove redundant code for LUTs
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1080
diff changeset
87 void Render(Orthanc::ImageAccessor& target) const;
768
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 };
55411e7da2f7 LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 }