Mercurial > hg > orthanc-stone
comparison Framework/Toolbox/DicomInstanceParameters.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 | 2d8ab34c8c91 |
children | 343aa1dfaa90 |
comparison
equal
deleted
inserted
replaced
1286:ddb6676bbcbf | 1287:8e82fdc6200e |
---|---|
22 #include "DicomInstanceParameters.h" | 22 #include "DicomInstanceParameters.h" |
23 | 23 |
24 #include "../Scene2D/ColorTextureSceneLayer.h" | 24 #include "../Scene2D/ColorTextureSceneLayer.h" |
25 #include "../Scene2D/FloatTextureSceneLayer.h" | 25 #include "../Scene2D/FloatTextureSceneLayer.h" |
26 #include "../Toolbox/GeometryToolbox.h" | 26 #include "../Toolbox/GeometryToolbox.h" |
27 #include "../Toolbox/ImageToolbox.h" | |
27 | 28 |
28 #include <Core/Images/Image.h> | 29 #include <Core/Images/Image.h> |
29 #include <Core/Images/ImageProcessing.h> | 30 #include <Core/Images/ImageProcessing.h> |
30 #include <Core/Logging.h> | 31 #include <Core/Logging.h> |
31 #include <Core/OrthancException.h> | 32 #include <Core/OrthancException.h> |
277 | 278 |
278 if (hasRescale_) | 279 if (hasRescale_) |
279 { | 280 { |
280 factor *= rescaleSlope_; | 281 factor *= rescaleSlope_; |
281 offset = rescaleIntercept_; | 282 offset = rescaleIntercept_; |
283 } | |
284 | |
285 if (OrthancStone_Internals_dump_LoadTexture_histogram == 1) | |
286 { | |
287 LOG(ERROR) << "in DicomInstanceParameters::Data::ApplyRescaleAndDoseScaling:"; | |
288 LOG(ERROR) << " doseGridScaling_ = " << doseGridScaling_ | |
289 << " hasRescale_ = " << hasRescale_ | |
290 << " rescaleSlope_ = " << rescaleSlope_ | |
291 << " rescaleIntercept_ = " << rescaleIntercept_; | |
292 LOG(ERROR) << " --> factor = " << factor << " offset = " << offset; | |
282 } | 293 } |
283 | 294 |
284 if ( (factor != 1.0) || (offset != 0.0) ) | 295 if ( (factor != 1.0) || (offset != 0.0) ) |
285 { | 296 { |
286 const unsigned int width = image.GetWidth(); | 297 const unsigned int width = image.GetWidth(); |
373 pixelData.GetWidth(), | 384 pixelData.GetWidth(), |
374 pixelData.GetHeight(), | 385 pixelData.GetHeight(), |
375 false)); | 386 false)); |
376 Orthanc::ImageProcessing::Convert(*converted, pixelData); | 387 Orthanc::ImageProcessing::Convert(*converted, pixelData); |
377 | 388 |
389 if (OrthancStone_Internals_dump_LoadTexture_histogram == 1) | |
390 { | |
391 LOG(ERROR) << "+----------------------------------------+"; | |
392 LOG(ERROR) << "| This is not an error! |"; | |
393 LOG(ERROR) << "+----------------------------------------+"; | |
394 LOG(ERROR) << "Work on the \"invisible slice\" bug"; | |
395 LOG(ERROR) << "in: DicomInstanceParameters::ConvertToFloat()"; | |
396 LOG(ERROR) << "dumping texture hist after conversion from native sliceReader to Float32"; | |
397 LOG(ERROR) << "(source buffer address before conversion is: " << pixelData.GetConstBuffer() << ")"; | |
398 LOG(ERROR) << " target buffer address after conversion is: " << converted->GetConstBuffer(); | |
399 | |
400 LOG(ERROR) << "Target histo:"; | |
401 LOG(ERROR) << "-------------"; | |
402 { | |
403 HistogramData hd; | |
404 double minValue = 0; | |
405 double maxValue = 0; | |
406 ComputeMinMax(*converted, minValue, maxValue); | |
407 double binSize = (maxValue - minValue) * 0.01; | |
408 ComputeHistogram(*converted, hd, binSize); | |
409 std::string s; | |
410 DumpHistogramResult(s, hd); | |
411 LOG(ERROR) << s; | |
412 } | |
413 } | |
414 | |
378 // Correct rescale slope/intercept if need be | 415 // Correct rescale slope/intercept if need be |
379 //data_.ApplyRescaleAndDoseScaling(*converted, (pixelData.GetFormat() == Orthanc::PixelFormat_Grayscale32)); | 416 //data_.ApplyRescaleAndDoseScaling(*converted, (pixelData.GetFormat() == Orthanc::PixelFormat_Grayscale32)); |
380 data_.ApplyRescaleAndDoseScaling(*converted, false); | 417 data_.ApplyRescaleAndDoseScaling(*converted, false); |
381 | 418 |
419 if (OrthancStone_Internals_dump_LoadTexture_histogram == 1) | |
420 { | |
421 | |
422 LOG(ERROR) << "Target histo after data_.ApplyRescaleAndDoseScaling"; | |
423 LOG(ERROR) << "---------------------------------------------------"; | |
424 { | |
425 HistogramData hd; | |
426 double minValue = 0; | |
427 double maxValue = 0; | |
428 ComputeMinMax(*converted, minValue, maxValue); | |
429 double binSize = (maxValue - minValue) * 0.01; | |
430 ComputeHistogram(*converted, hd, binSize); | |
431 std::string s; | |
432 DumpHistogramResult(s, hd); | |
433 LOG(ERROR) << s; | |
434 } | |
435 LOG(ERROR) << "+----------------------------------------+"; | |
436 LOG(ERROR) << "| end of debug dump |"; | |
437 LOG(ERROR) << "+----------------------------------------+"; | |
438 } | |
439 | |
382 return converted.release(); | 440 return converted.release(); |
383 } | 441 } |
384 | 442 |
385 | 443 |
386 TextureBaseSceneLayer* DicomInstanceParameters::CreateTexture | 444 TextureBaseSceneLayer* DicomInstanceParameters::CreateTexture |