comparison Framework/Scene2D/Internals/OpenGLLookupTableTextureRenderer.cpp @ 1289:343aa1dfaa90 bugs/2020-02-invisible-slice

Ongoing work on invisible slice bug (logging + removed unused function)
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 19 Feb 2020 17:05:08 +0100
parents 8e82fdc6200e
children ea6c2254536d
comparison
equal deleted inserted replaced
1288:d8c42e5e5843 1289:343aa1dfaa90
125 } 125 }
126 } 126 }
127 127
128 if (OrthancStone_Internals_dump_LoadTexture_histogram == 1) 128 if (OrthancStone_Internals_dump_LoadTexture_histogram == 1)
129 { 129 {
130 LOG(ERROR) << "+----------------------------------------+"; 130 LOG(INFO) << "+----------------------------------------+";
131 LOG(ERROR) << "| This is not an error! |"; 131 LOG(INFO) << "| This is not an error! |";
132 LOG(ERROR) << "+----------------------------------------+"; 132 LOG(INFO) << "+----------------------------------------+";
133 LOG(ERROR) << "Work on the \"invisible slice\" bug"; 133 LOG(INFO) << "Work on the \"invisible slice\" bug";
134 LOG(ERROR) << "--> in OpenGLLookupTableTextureRenderer::LoadTexture():"; 134 LOG(INFO) << "--> in OpenGLLookupTableTextureRenderer::LoadTexture():";
135 LOG(ERROR) << "layer.GetMinValue() = " << layer.GetMinValue() << " | layer.GetMaxValue() = " << layer.GetMaxValue(); 135 LOG(INFO) << "layer.GetMinValue() = " << layer.GetMinValue() << " | layer.GetMaxValue() = " << layer.GetMaxValue();
136 LOG(ERROR) << "a = " << a << " | slope = " << slope; 136 LOG(INFO) << "a = " << a << " | slope = " << slope;
137 137
138 LOG(ERROR) << "SOURCE gets scaled and offset, this yields --> TEMP that gets through the lut to yield RESULT"; 138 LOG(INFO) << "SOURCE gets scaled and offset, this yields --> TEMP that gets through the lut to yield RESULT";
139 LOG(ERROR) << "The SOURCE (layer.GetTexture()) will be dumped below (format is Float32)"; 139 LOG(INFO) << "The SOURCE (layer.GetTexture()) will be dumped below (format is Float32)";
140 LOG(ERROR) << ""; 140 LOG(INFO) << "";
141 HistogramData hd; 141 HistogramData hd;
142 double minValue = 0; 142 double minValue = 0;
143 double maxValue = 0; 143 double maxValue = 0;
144 ComputeMinMax(source, minValue, maxValue); 144 ComputeMinMax(source, minValue, maxValue);
145 double binSize = (maxValue - minValue) * 0.01; // split in 100 bins 145 double binSize = (maxValue - minValue) * 0.01; // split in 100 bins
146 ComputeHistogram(source, hd, binSize); 146 ComputeHistogram(source, hd, binSize);
147 std::string s; 147 std::string s;
148 DumpHistogramResult(s, hd); 148 DumpHistogramResult(s, hd);
149 LOG(ERROR) << s; 149 LOG(INFO) << s;
150 LOG(ERROR) << ""; 150 LOG(INFO) << "";
151 151
152 152
153 LOG(ERROR) << "TEMP will be dumped below (format is uint8_t)"; 153 LOG(INFO) << "TEMP will be dumped below (format is uint8_t)";
154 LOG(ERROR) << ""; 154 LOG(INFO) << "";
155 155
156 { 156 {
157 uint8_t vv = 0; 157 uint8_t vv = 0;
158 do 158 do
159 { 159 {
160 LOG(ERROR) << " TEMP. Pixel " << (int)vv << " is present " 160 LOG(INFO) << " TEMP. Pixel " << (int)vv << " is present "
161 << debugHistogram[vv] << " times"; 161 << debugHistogram[vv] << " times";
162 } while (vv++ != 255); 162 } while (vv++ != 255);
163 } 163 }
164 164
165 LOG(ERROR) << "\nThe LUT will be dumped below"; 165 LOG(INFO) << "\nThe LUT will be dumped below";
166 LOG(ERROR) << "----------------------------"; 166 LOG(INFO) << "----------------------------";
167 LOG(ERROR) << ""; 167 LOG(INFO) << "bgotag-2020-02-18-20-26";
168 LOG(INFO) << "";
168 169
169 { 170 {
170 uint8_t vv = 0; 171 uint8_t vv = 0;
171 // proper way to loop on all unsigned values is a do while loop 172 // proper way to loop on all unsigned values is a do while loop
172 do 173 do
173 { 174 {
174 LOG(ERROR) << " LUT[" << (int)vv << "] =" 175 LOG(INFO) << " LUT[" << (int)vv << "] ="
175 << " R:" << (int)lut[4 * vv + 0] 176 << " R:" << (int)lut[4 * vv + 0]
176 << " G:" << (int)lut[4 * vv + 1] 177 << " G:" << (int)lut[4 * vv + 1]
177 << " B:" << (int)lut[4 * vv + 2] 178 << " B:" << (int)lut[4 * vv + 2]
178 << " A:" << (int)lut[4 * vv + 3]; 179 << " A:" << (int)lut[4 * vv + 3];
179 } while (vv++ != 255); 180 } while (vv++ != 255);
180 } 181 }
181 LOG(ERROR) << "+----------------------------------------+"; 182 LOG(INFO) << "+----------------------------------------+";
182 LOG(ERROR) << "| end of debug dump |"; 183 LOG(INFO) << "| end of debug dump |";
183 LOG(ERROR) << "+----------------------------------------+"; 184 LOG(INFO) << "+----------------------------------------+";
184 } 185 }
185 } 186 }
186 187
187 context_.MakeCurrent(); 188 context_.MakeCurrent();
188 glTexture_.reset(new OpenGL::OpenGLTexture(context_)); 189 glTexture_.reset(new OpenGL::OpenGLTexture(context_));