[Insight-users] ImageHistogram1 example

Luis Ibanez luis.ibanez at kitware.com
Fri Jan 20 07:10:42 EST 2006


Hi Mark,

The labeling of histogram bins is done based on the value that 
corresponds to the middle of the bin.

This is natural when the intensities are seen as float numbers,
but becomes disconcerting when the intensities are integer.
(as you just pointed out)

In practice, when you want a bin to capture the 255 values,
you will have to make sure that the range of the bin goes from

               min-bin  = 254.5
               max-bin  = 255.5

This may require you to play a bit with the min and max of
the total histogram, as well as with the settings of the
number of bins. For an image that have 8 bits pixels, you
may want to have a histogram with bins from

               min-histogram-bin =   -0.5
               max-histogram-bin =  255.5

In that way, the actual integer values of the pixels in your
image will fall squarely inside the bins, and you will get
the bins counting that you expect.

What you want to avoid is to tell the histogram to use limits
such as:

               min-histogram-bin =    0.0
               max-histogram-bin =  255.0

because then the pixels with values = 255 will not be included
in the last bin, since they are just in the boundary of the bin.



Please let us know if you manage to set up the bins in the way
you want, or if you continue experiencing any problems.


   Thanks


     Luis


-------------------------
Mark Rabotnikov wrote:
> 
> Hello,
> 
> I have the following problem. When I run ImageHistogram1 example on the 
> binary image
> Examples\Data\BrainProtonDensitySliceBorder20Mask.png of size 56797 
> pixels, all having values 0 or 255, I get the following result:
> 
> Histogram size 255
> bin = 0 frequency = 26069
> bin = 1 frequency = 0
> bin = 2 frequency = 0
> ...................................
> 
> bin = 254 frequency = 0
> 
> Where are the pixels with value 255 ?
> 
> Thank you,
> 
> Mark Rabotnikov
> EBW team
> CT Engineering
> Philips Medical Systems Technologies LTD
> Phone: +972-4-8310646
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users



More information about the Insight-users mailing list