]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/Histogram.cxx
#2482 creaMaracasVisu Bug New High - ColorLayer refresh missing. The MPR is not...
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / pPlotter / Histogram.cxx
index d9134e4fca6b9df7db1f0aaff8db3cead9758af1..8526658a8478c34a4e991edcecb798e204b59d73 100644 (file)
@@ -119,13 +119,19 @@ END_EVENT_TABLE()
                xValues=(double*)malloc(NUM_POINTS*sizeof(double));
                yValues=(double*)malloc(NUM_POINTS*sizeof(double));
                
-               unsigned short* histogramPointer=(unsigned short*)histogramImageData->GetScalarPointer(0,0,0);
+               double* histogramPointer=(double*)histogramImageData->GetScalarPointer(0,0,0);
                
-               for(int i=0; i< histogramSize; i++)
+               int i;
+               for(i=0; i< histogramSize; i++)
                {
                        xValues[i]=i;
-                       yValues[i]=log( (double) histogramPointer[i])*10;
-               }
+                       if (histogramPointer[i]==0)
+                       {
+                               yValues[i]=0;
+                       } else {
+                               yValues[i]=log(histogramPointer[i])*10;
+                       } // if histogramPointer
+               } // for i
 
                
                pGraphicalFunction* histogramFunction=plotter->getFunctionForVectors(xValues,histogramSize,yValues,histogramSize);