Mercurial > hg > orthanc-stone
diff Framework/Scene2D/Internals/OpenGLLookupTableTextureRenderer.cpp @ 1287:8e82fdc6200e bugs/2020-02-invisible-slice
Heavy (temporary) logging in the path that leads
from multiframe volume to slice (rendered texture)
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Fri, 14 Feb 2020 15:00:54 +0100 |
parents | 29cdd73d9477 |
children | 343aa1dfaa90 |
line wrap: on
line diff
--- a/Framework/Scene2D/Internals/OpenGLLookupTableTextureRenderer.cpp Fri Feb 14 14:59:32 2020 +0100 +++ b/Framework/Scene2D/Internals/OpenGLLookupTableTextureRenderer.cpp Fri Feb 14 15:00:54 2020 +0100 @@ -21,6 +21,9 @@ #include "OpenGLLookupTableTextureRenderer.h" +#include "../../Toolbox/ImageToolbox.h" + + #include <Core/OrthancException.h> @@ -89,7 +92,6 @@ } } - for (unsigned int y = 0; y < height; y++) { const float* p = reinterpret_cast<const float*>(source.GetConstRow(y)); @@ -109,9 +111,10 @@ uint8_t vv = static_cast<uint8_t>(v); - if(OrthancStone_Internals_dump_LoadTexture_histogram == 1) + if (OrthancStone_Internals_dump_LoadTexture_histogram == 1) debugHistogram[vv] += 1; + q[0] = lut[4 * vv + 0]; // R q[1] = lut[4 * vv + 1]; // G q[2] = lut[4 * vv + 2]; // B @@ -124,21 +127,60 @@ if (OrthancStone_Internals_dump_LoadTexture_histogram == 1) { - uint8_t vv; - LOG(INFO) << "Dumping texture loaded with OpenGLLookupTableTextureRenderer::LoadTexture"; - for (int i = 0; i <= 255; ++i) + LOG(ERROR) << "+----------------------------------------+"; + LOG(ERROR) << "| This is not an error! |"; + LOG(ERROR) << "+----------------------------------------+"; + LOG(ERROR) << "Work on the \"invisible slice\" bug"; + LOG(ERROR) << "--> in OpenGLLookupTableTextureRenderer::LoadTexture():"; + LOG(ERROR) << "layer.GetMinValue() = " << layer.GetMinValue() << " | layer.GetMaxValue() = " << layer.GetMaxValue(); + LOG(ERROR) << "a = " << a << " | slope = " << slope; + + LOG(ERROR) << "SOURCE gets scaled and offset, this yields --> TEMP that gets through the lut to yield RESULT"; + LOG(ERROR) << "The SOURCE (layer.GetTexture()) will be dumped below (format is Float32)"; + LOG(ERROR) << ""; + HistogramData hd; + double minValue = 0; + double maxValue = 0; + ComputeMinMax(source, minValue, maxValue); + double binSize = (maxValue - minValue) * 0.01; // split in 100 bins + ComputeHistogram(source, hd, binSize); + std::string s; + DumpHistogramResult(s, hd); + LOG(ERROR) << s; + LOG(ERROR) << ""; + + + LOG(ERROR) << "TEMP will be dumped below (format is uint8_t)"; + LOG(ERROR) << ""; + { - vv = static_cast<uint8_t>(i); - int ivv = vv; - int count = debugHistogram[vv]; - int lutr = lut[4 * vv + 0]; - int lutg = lut[4 * vv + 1]; - int lutb = lut[4 * vv + 2]; - int luta = lut[4 * vv + 3]; + uint8_t vv = 0; + do + { + LOG(ERROR) << " TEMP. Pixel " << (int)vv << " is present " + << debugHistogram[vv] << " times"; + } while (vv++ != 255); + } + + LOG(ERROR) << "\nThe LUT will be dumped below"; + LOG(ERROR) << "----------------------------"; + LOG(ERROR) << ""; - LOG(ERROR) << "This is no error! Y= " << ivv << " count= " << count - << " lut R= " << lutr << " lut G= " << lutg << " lut B= " << lutb << " lut A= " << luta; + { + uint8_t vv = 0; + // proper way to loop on all unsigned values is a do while loop + do + { + LOG(ERROR) << " LUT[" << (int)vv << "] =" + << " R:" << (int)lut[4 * vv + 0] + << " G:" << (int)lut[4 * vv + 1] + << " B:" << (int)lut[4 * vv + 2] + << " A:" << (int)lut[4 * vv + 3]; + } while (vv++ != 255); } + LOG(ERROR) << "+----------------------------------------+"; + LOG(ERROR) << "| end of debug dump |"; + LOG(ERROR) << "+----------------------------------------+"; } }