[Insight-users] ScalarImageToHistogramGenerator returns const output

Luis Ibanez luis . ibanez at kitware . com
Tue, 09 Dec 2003 10:51:45 -0500


Hi Benjamin,

Thanks for pointing this out.

You are right, a "const" version of the Iterator
was missing in the Histogram class.

We just added one (called ConstIterator) to the
CVS version. You may have to update your CVS checkout
in order to get this modification.

It is important for the Generators to return "const"
classes in their outputs. Otherwise, the recipient
of the Histogram would be allowed to change the values
of the frequency in the bins.

We will add const iterators to the rest of classes in
the family of the Statistics::Sample class.

An example on how to visit the histogram using Iterators
was added to


    Insight/Examples/Statistics/ImageHistogram2.cxx


Please let us know if you find any other problem.


Thanks


   Luis


------------------------
Benjamin King wrote:

> Hello,
> 
> ScalarImageToHistogramGenerator::GetOutput() returns a const object (in 
> contrast to for example ListSampleToHistogramGenerator).
> This is a problem when one wants to access the histogram with an 
> iterator because there is no const version of 
> itk::Statistics::Histogram::Iterator.
> 
> cheers,
>  Benjamin
>