diff Framework/Volumes/DicomVolumeImageMPRSlicer.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
line wrap: on
line diff
--- a/Framework/Volumes/DicomVolumeImageMPRSlicer.cpp	Fri Feb 14 14:59:32 2020 +0100
+++ b/Framework/Volumes/DicomVolumeImageMPRSlicer.cpp	Fri Feb 14 15:00:54 2020 +0100
@@ -23,6 +23,8 @@
 
 #include "../StoneException.h"
 
+#include "../Toolbox/ImageToolbox.h"
+
 #include <Core/OrthancException.h>
 //#include <Core/Images/PngWriter.h>
 #include <Core/Images/JpegWriter.h>
@@ -80,6 +82,33 @@
     {
       const DicomInstanceParameters& parameters = volume_.GetDicomParameters();
       ImageBuffer3D::SliceReader reader(volume_.GetPixelData(), projection_, sliceIndex_);
+
+      if (OrthancStone_Internals_dump_LoadTexture_histogram == 1)
+      {
+        LOG(ERROR) << "+----------------------------------------+";
+        LOG(ERROR) << "|        This is not an error!           |";
+        LOG(ERROR) << "+----------------------------------------+";
+        LOG(ERROR) << "Work on the \"invisible slice\" bug";
+        LOG(ERROR) << "InvisibleSlice -- about to dump histogram (100 buckets) for volume_ "
+          << "with OrthancId: " << parameters.GetOrthancInstanceIdentifier()
+          << " and SopInstanceUid: " << parameters.GetSopInstanceUid()
+          << " for projection_ (AxiCorSag): projection_ "
+          << " and slice: " << sliceIndex_;
+
+        HistogramData hd;
+        double minValue = 0;
+        double maxValue = 0;
+        ComputeMinMax(reader.GetAccessor(), minValue, maxValue);
+        double binSize = (maxValue - minValue) * 0.01;
+        ComputeHistogram(reader.GetAccessor(), hd, binSize);
+        std::string s;
+        DumpHistogramResult(s, hd);
+        LOG(ERROR) << s;
+        LOG(ERROR) << "+----------------------------------------+";
+        LOG(ERROR) << "|        end of debug dump               |";
+        LOG(ERROR) << "+----------------------------------------+";
+      }
+
       texture.reset(dynamic_cast<TextureBaseSceneLayer*>
                     (configurator->CreateTextureFromDicom(reader.GetAccessor(), parameters)));