[Insight-users] ImageToHistogramFilter issue

David Doria daviddoria at gmail.com
Mon Nov 15 15:32:54 EST 2010


I am trying to use the ImageToHistogramFilter. When I create an
iterator to traverse the histogram:

  HistogramType::ConstIterator histogramItr = histogram->Begin();

  while( histogramItr != histogram->End() )
    {
    fout << "Index = " <<
histogram->GetIndex(histogramItr.GetMeasurementVector()) << "Frequency
= " << histogramItr.GetFrequency() << std::endl;
    ++histogramItr;
    }

it seems to only traverse the first component. That is, I see indexes of

0, 256, 0
1, 256, 0
2, 256, 0
...
0, 256, 0 (this repeats exactly from the beginning, rather than
incrementing  the 2nd or 3rd component)
1, 256, 0
....

Also, my query for "how many red pixels are there?" (which is really
what I'm interested in) returns 0, when I would expect 2 (as per my
example input image). I'm assuming these two problems are related.

Here is my demonstration of the problem:
http://www.vtk.org/Wiki/ITK/Examples/Broken/Statistics/ImageToHistogramFilter

Any thoughts?

Thanks,

David


More information about the Insight-users mailing list