comparison Framework/Toolbox/DicomInstanceParameters.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
262 262
263 return (CoordinateSystem3D::ComputeDistance(distance, tmp, plane) && 263 return (CoordinateSystem3D::ComputeDistance(distance, tmp, plane) &&
264 distance <= thickness_ / 2.0); 264 distance <= thickness_ / 2.0);
265 } 265 }
266 266
267
268 void DicomInstanceParameters::Data::ApplyRescaleAndDoseScaling(Orthanc::ImageAccessor& image, 267 void DicomInstanceParameters::Data::ApplyRescaleAndDoseScaling(Orthanc::ImageAccessor& image,
269 bool useDouble) const 268 bool useDouble) const
270 { 269 {
271 if (image.GetFormat() != Orthanc::PixelFormat_Float32) 270 if (image.GetFormat() != Orthanc::PixelFormat_Float32)
272 { 271 {
282 offset = rescaleIntercept_; 281 offset = rescaleIntercept_;
283 } 282 }
284 283
285 if (OrthancStone_Internals_dump_LoadTexture_histogram == 1) 284 if (OrthancStone_Internals_dump_LoadTexture_histogram == 1)
286 { 285 {
287 LOG(ERROR) << "in DicomInstanceParameters::Data::ApplyRescaleAndDoseScaling:"; 286 LOG(INFO) << "in DicomInstanceParameters::Data::ApplyRescaleAndDoseScaling:";
288 LOG(ERROR) << " doseGridScaling_ = " << doseGridScaling_ 287 LOG(INFO) << " doseGridScaling_ = " << doseGridScaling_
289 << " hasRescale_ = " << hasRescale_ 288 << " hasRescale_ = " << hasRescale_
290 << " rescaleSlope_ = " << rescaleSlope_ 289 << " rescaleSlope_ = " << rescaleSlope_
291 << " rescaleIntercept_ = " << rescaleIntercept_; 290 << " rescaleIntercept_ = " << rescaleIntercept_;
292 LOG(ERROR) << " --> factor = " << factor << " offset = " << offset; 291 LOG(INFO) << " --> factor = " << factor << " offset = " << offset;
293 } 292 }
294 293
295 if ( (factor != 1.0) || (offset != 0.0) ) 294 if ( (factor != 1.0) || (offset != 0.0) )
296 { 295 {
297 const unsigned int width = image.GetWidth(); 296 const unsigned int width = image.GetWidth();
386 false)); 385 false));
387 Orthanc::ImageProcessing::Convert(*converted, pixelData); 386 Orthanc::ImageProcessing::Convert(*converted, pixelData);
388 387
389 if (OrthancStone_Internals_dump_LoadTexture_histogram == 1) 388 if (OrthancStone_Internals_dump_LoadTexture_histogram == 1)
390 { 389 {
391 LOG(ERROR) << "+----------------------------------------+"; 390 LOG(INFO) << "+----------------------------------------+";
392 LOG(ERROR) << "| This is not an error! |"; 391 LOG(INFO) << "| This is not an error! |";
393 LOG(ERROR) << "+----------------------------------------+"; 392 LOG(INFO) << "+----------------------------------------+";
394 LOG(ERROR) << "Work on the \"invisible slice\" bug"; 393 LOG(INFO) << "Work on the \"invisible slice\" bug";
395 LOG(ERROR) << "in: DicomInstanceParameters::ConvertToFloat()"; 394 LOG(INFO) << "in: DicomInstanceParameters::ConvertToFloat()";
396 LOG(ERROR) << "dumping texture hist after conversion from native sliceReader to Float32"; 395 LOG(INFO) << "dumping texture hist after conversion from native sliceReader to Float32";
397 LOG(ERROR) << "(source buffer address before conversion is: " << pixelData.GetConstBuffer() << ")"; 396 LOG(INFO) << "(source buffer address before conversion is: " << pixelData.GetConstBuffer() << ")";
398 LOG(ERROR) << " target buffer address after conversion is: " << converted->GetConstBuffer(); 397 LOG(INFO) << " target buffer address after conversion is: " << converted->GetConstBuffer();
399 398
400 LOG(ERROR) << "Target histo:"; 399 LOG(INFO) << "Target histo:";
401 LOG(ERROR) << "-------------"; 400 LOG(INFO) << "-------------";
402 { 401 {
403 HistogramData hd; 402 HistogramData hd;
404 double minValue = 0; 403 double minValue = 0;
405 double maxValue = 0; 404 double maxValue = 0;
406 ComputeMinMax(*converted, minValue, maxValue); 405 ComputeMinMax(*converted, minValue, maxValue);
407 double binSize = (maxValue - minValue) * 0.01; 406 double binSize = (maxValue - minValue) * 0.01;
408 ComputeHistogram(*converted, hd, binSize); 407 ComputeHistogram(*converted, hd, binSize);
409 std::string s; 408 std::string s;
410 DumpHistogramResult(s, hd); 409 DumpHistogramResult(s, hd);
411 LOG(ERROR) << s; 410 LOG(INFO) << s;
412 } 411 }
413 } 412 }
414 413
415 // Correct rescale slope/intercept if need be 414 // Correct rescale slope/intercept if need be
416 //data_.ApplyRescaleAndDoseScaling(*converted, (pixelData.GetFormat() == Orthanc::PixelFormat_Grayscale32)); 415 //data_.ApplyRescaleAndDoseScaling(*converted, (pixelData.GetFormat() == Orthanc::PixelFormat_Grayscale32));
417 data_.ApplyRescaleAndDoseScaling(*converted, false); 416 data_.ApplyRescaleAndDoseScaling(*converted, false);
418 417
419 if (OrthancStone_Internals_dump_LoadTexture_histogram == 1) 418 if (OrthancStone_Internals_dump_LoadTexture_histogram == 1)
420 { 419 {
421 420
422 LOG(ERROR) << "Target histo after data_.ApplyRescaleAndDoseScaling"; 421 LOG(INFO) << "Target histo after data_.ApplyRescaleAndDoseScaling";
423 LOG(ERROR) << "---------------------------------------------------"; 422 LOG(INFO) << "---------------------------------------------------";
424 { 423 {
425 HistogramData hd; 424 HistogramData hd;
426 double minValue = 0; 425 double minValue = 0;
427 double maxValue = 0; 426 double maxValue = 0;
428 ComputeMinMax(*converted, minValue, maxValue); 427 ComputeMinMax(*converted, minValue, maxValue);
429 double binSize = (maxValue - minValue) * 0.01; 428 double binSize = (maxValue - minValue) * 0.01;
430 ComputeHistogram(*converted, hd, binSize); 429 ComputeHistogram(*converted, hd, binSize);
431 std::string s; 430 std::string s;
432 DumpHistogramResult(s, hd); 431 DumpHistogramResult(s, hd);
433 LOG(ERROR) << s; 432 LOG(INFO) << s;
434 } 433 }
435 LOG(ERROR) << "+----------------------------------------+"; 434 LOG(INFO) << "+----------------------------------------+";
436 LOG(ERROR) << "| end of debug dump |"; 435 LOG(INFO) << "| end of debug dump |";
437 LOG(ERROR) << "+----------------------------------------+"; 436 LOG(INFO) << "+----------------------------------------+";
438 } 437 }
439 438
440 return converted.release(); 439 return converted.release();
441 } 440 }
442 441