]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/Histogram.cxx
#2490 creaMaracasVisu Feature New High - Histogram Interaction
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / pPlotter / Histogram.cxx
index d9134e4fca6b9df7db1f0aaff8db3cead9758af1..459cc18a40b73ffb2f507ab48a7325824642900e 100644 (file)
@@ -95,7 +95,7 @@ END_EVENT_TABLE()
 
        }
 
-    void Histogram::Configure(vtkImageData* imageData)
+   void Histogram::Configure(vtkImageData* imageData)
        {
                histogram= new pHistogram(imageData);
                drawHistogram();
@@ -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);
@@ -160,6 +166,7 @@ END_EVENT_TABLE()
                int scrX,scrY;
                GetClientSize(&scrX,&scrY);
                plotter->SetSize(scrX,scrY);
+
                /*
                pGraphicalFunction* actual=plotter->getFunction(idTransferenceFunction);
                actual->setScreens(scrX,scrY);
@@ -186,4 +193,15 @@ END_EVENT_TABLE()
                return histogramSize;
        }
 
+       wxWindow* Histogram::GetWindow()
+       {
+               return this;
+       }
+
+       pPlotterWindow* Histogram::GetPlotterWindow()
+       {
+               return plotter;
+       } 
+
+