[Insight-users] ImageHistogram1 example

Mark Rabotnikov mark.rabotnikov at philips.com
Sun Jan 22 01:47:30 EST 2006


Hi Luis,

As I understand, I should add something like

  itk::FixedArray< HistogramMeasurementType, 1 > min_limit;
  min_limit[0] = -0.5;
  itk::FixedArray< HistogramMeasurementType, 1 > max_limit;
  max_limit[0] = -255.5;

  generator->SetHistogramMin(min_limit);
  generator->SetHistogramMax(max_limit);

but HistogramMeasurementType is unsigned char, so floating-point values 
are converted to unsigned char's.
So how should I set the min and max of the histogram ?

By the way, ImageHistogram3 does count both values 0 and 255 (bin 0: 
26069, bit 254: 30728).

Thank you,

Mark Rabotnikov
EBW team
CT Engineering
Philips Medical Systems Technologies LTD
Phone: +972-4-8310646









Luis Ibanez <luis.ibanez at kitware.com> 
Sent by:
insight-users-bounces+mark.rabotnikov=philips.com at itk.org
20/01/2006 14:10

To
Mark Rabotnikov/HFA/MS/PHILIPS at PHILIPS
cc
insight-users at itk.org
Subject
Re: [Insight-users] ImageHistogram1 example
Classification








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

_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20060122/6192ade7/attachment.html


More information about the Insight-users mailing list