Mercurial > hg > orthanc-stone
annotate Framework/Scene2D/LookupTableTextureSceneLayer.cpp @ 1081:369050c846a9 toa2019102101
Removed erron. error log
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 21 Oct 2019 20:51:35 +0200 |
parents | 287ec78f63b4 |
children | 640feb146fa8 |
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 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium |
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 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Affero General Public License |
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 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * Affero General Public License for more details. |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Affero General Public License |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 **/ |
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 #include "LookupTableTextureSceneLayer.h" |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #include <Core/Images/Image.h> |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 #include <Core/Images/ImageProcessing.h> |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 #include <Core/OrthancException.h> |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 namespace OrthancStone |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 { |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 LookupTableTextureSceneLayer::LookupTableTextureSceneLayer(const Orthanc::ImageAccessor& texture) |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 { |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 { |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 std::auto_ptr<Orthanc::ImageAccessor> t( |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 new Orthanc::Image(Orthanc::PixelFormat_Float32, |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 texture.GetWidth(), |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 texture.GetHeight(), |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 false)); |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 Orthanc::ImageProcessing::Convert(*t, texture); |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 SetTexture(t.release()); |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 } |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 |
1072
391fb6d6905d
OrthancMultiframeVolumeLoader asks volume image to compute range +
Benjamin Golinvaux <bgo@osimis.io>
parents:
798
diff
changeset
|
43 SetLookupTableGrayscale(); // simple ramp between 0 and 255 |
768
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 SetRange(0, 1); |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 } |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 |
769
4ba8892870a2
improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
48 void LookupTableTextureSceneLayer::SetLookupTableGrayscale() |
768
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 { |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 std::vector<uint8_t> rgb(3 * 256); |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 for (size_t i = 0; i < 256; i++) |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 { |
798 | 54 rgb[3 * i] = static_cast<uint8_t>(i); |
55 rgb[3 * i + 1] = static_cast<uint8_t>(i); | |
56 rgb[3 * i + 2] = static_cast<uint8_t>(i); | |
768
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 } |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 |
769
4ba8892870a2
improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
59 SetLookupTableRgb(rgb); |
768
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 } |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 |
769
4ba8892870a2
improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
63 void LookupTableTextureSceneLayer::SetLookupTableRgb(const std::vector<uint8_t>& lut) |
768
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 if (lut.size() != 3 * 256) |
768
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 { |
769
4ba8892870a2
improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
67 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); |
768
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 } |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 lut_.resize(4 * 256); |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 for (size_t i = 0; i < 256; i++) |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 { |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 // Premultiplied alpha |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 if (i == 0) |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 { |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 // Make zero transparent |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 lut_[4 * i] = 0; // R |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 lut_[4 * i + 1] = 0; // G |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 lut_[4 * i + 2] = 0; // B |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 lut_[4 * i + 3] = 0; // A |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 } |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 else |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 { |
769
4ba8892870a2
improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
86 float a = static_cast<float>(i) / 255.0f; |
4ba8892870a2
improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
87 |
4ba8892870a2
improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
88 float r = static_cast<float>(lut[3 * i]) * a; |
4ba8892870a2
improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
89 float g = static_cast<float>(lut[3 * i + 1]) * a; |
4ba8892870a2
improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
90 float b = static_cast<float>(lut[3 * i + 2]) * a; |
768
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 lut_[4 * i] = static_cast<uint8_t>(std::floor(r)); |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 lut_[4 * i + 1] = static_cast<uint8_t>(std::floor(g)); |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 lut_[4 * i + 2] = static_cast<uint8_t>(std::floor(b)); |
769
4ba8892870a2
improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
95 lut_[4 * i + 3] = static_cast<uint8_t>(std::floor(a * 255.0f)); |
768
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 } |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 } |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 IncrementRevision(); |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 } |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 void LookupTableTextureSceneLayer::SetLookupTable(const std::vector<uint8_t>& lut) |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 { |
769
4ba8892870a2
improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
105 if (lut.size() == 4 * 256) |
4ba8892870a2
improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
106 { |
4ba8892870a2
improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
107 lut_ = lut; |
4ba8892870a2
improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
108 IncrementRevision(); |
4ba8892870a2
improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
109 } |
4ba8892870a2
improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
110 else if (lut.size() == 3 * 256) |
4ba8892870a2
improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
111 { |
4ba8892870a2
improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
112 SetLookupTableRgb(lut); |
4ba8892870a2
improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
113 } |
4ba8892870a2
improved interface for lookup tables
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
768
diff
changeset
|
114 else |
768
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
115 { |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
116 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 } |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 } |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 void LookupTableTextureSceneLayer::SetRange(float minValue, |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 float maxValue) |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 { |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 if (minValue > maxValue) |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
124 { |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
125 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
126 } |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
127 else |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
128 { |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
129 minValue_ = minValue; |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
130 maxValue_ = maxValue; |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
131 IncrementRevision(); |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
132 } |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
133 } |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
135 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 void LookupTableTextureSceneLayer::FitRange() |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
137 { |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
138 Orthanc::ImageProcessing::GetMinMaxFloatValue(minValue_, maxValue_, GetTexture()); |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 assert(minValue_ <= maxValue_); |
1072
391fb6d6905d
OrthancMultiframeVolumeLoader asks volume image to compute range +
Benjamin Golinvaux <bgo@osimis.io>
parents:
798
diff
changeset
|
140 // TODO: debug to be removed |
1081
369050c846a9
Removed erron. error log
Benjamin Golinvaux <bgo@osimis.io>
parents:
1080
diff
changeset
|
141 if (fabs(maxValue_ - minValue_) < 0.0001) { |
369050c846a9
Removed erron. error log
Benjamin Golinvaux <bgo@osimis.io>
parents:
1080
diff
changeset
|
142 LOG(INFO) << "LookupTableTextureSceneLayer::FitRange(): minValue_ = " << minValue_ << " maxValue_ = " << maxValue_; |
369050c846a9
Removed erron. error log
Benjamin Golinvaux <bgo@osimis.io>
parents:
1080
diff
changeset
|
143 } |
768
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
144 IncrementRevision(); |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 } |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
146 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
147 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
148 ISceneLayer* LookupTableTextureSceneLayer::Clone() const |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
149 { |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
150 std::auto_ptr<LookupTableTextureSceneLayer> cloned |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
151 (new LookupTableTextureSceneLayer(GetTexture())); |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
152 |
1072
391fb6d6905d
OrthancMultiframeVolumeLoader asks volume image to compute range +
Benjamin Golinvaux <bgo@osimis.io>
parents:
798
diff
changeset
|
153 |
391fb6d6905d
OrthancMultiframeVolumeLoader asks volume image to compute range +
Benjamin Golinvaux <bgo@osimis.io>
parents:
798
diff
changeset
|
154 // TODO: why is windowing_ not copied?????? |
768
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
155 cloned->CopyParameters(*this); |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
156 cloned->minValue_ = minValue_; |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 cloned->maxValue_ = maxValue_; |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
158 cloned->lut_ = lut_; |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
159 |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
160 return cloned.release(); |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
161 } |
55411e7da2f7
LookupTableTextureSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
162 } |