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);