]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx
creaButtonContainer & creaPanelButtonContainer: Updates in doxygen documentation...
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / pPlotter / pHistogram.cxx
index 7a395e05affc5afac18ac93dcf9c78af7dff39e8..19a2af26fdd5a52a5382221e5367b1cebb286b3e 100644 (file)
@@ -149,6 +149,7 @@ void pHistogram::setPoints(vtkImageData* imageData)
        */
        maxLevelOfGrey=(int)range[1];
        minLevelOfGrey=(int)range[0];
+       //std::cout<<"maxLevelOfGrey "<<maxLevelOfGrey<<" minLevelOfGrey "<<minLevelOfGrey<<std::endl;
        /*
         Image Size
        */
@@ -184,6 +185,7 @@ void pHistogram::setPoints(vtkImageData* imageData)
                //j=p*k;
                
                j=getIndex(*dataImagePointer);
+               //std::cout<<j<<std::endl;
                dataHistogramPointer[j]++;
                dataImagePointer++;
        }
@@ -213,8 +215,10 @@ image
 */
 int pHistogram::getIndex(int gValue)
 {
-       double p=((float)gValue-minLevelOfGrey)/(maxLevelOfGrey-minLevelOfGrey);
+
+       double p=((double)gValue-minLevelOfGrey)/(maxLevelOfGrey-minLevelOfGrey);
        double k=p*(size-1);
+       //std::cout<<"gValue "<<gValue<<" k "<<k<<std::endl;
        return (int)k;
 }
 /*
@@ -258,8 +262,8 @@ int pHistogram::getMinimumLevelOfGrey()
 */
 int pHistogram::getHistogramPoint(int gValue)
 {
-       double p=((float)gValue-minLevelOfGrey)/(maxLevelOfGrey-minLevelOfGrey);
-       double k=p*size;
+       //double p=((float)gValue-minLevelOfGrey)/(maxLevelOfGrey-minLevelOfGrey); // JPRx
+       //double k=p*size;
 
        unsigned short* dataHistogramPointer=NULL;
        dataHistogramPointer=(unsigned short*)points->GetScalarPointer(0,0,0);