[Insight-users] Histogram from red component of RGB image

Pablo Arias pariasm at gmail.com
Tue Sep 27 11:52:00 EDT 2005


Hi,
   I am just starting with ITK, and I want to compute the histogram
of the red component of an RGB image. At this time I am doing this by
using the ImageToHistogramGenerator and setting the number of bins in
[255,0,0]. This way my software is too slow, and I thought that
perhaps using the ScalarImageToHistogramGenerator with an appropiate
image adaptor would be faster.

  I found an old message in this mailing list where it said that this
could be done by treating the image adaptor as if it was an actual
image.

  I've done so, but I had some compiling errors when I tried to pass
the adaptor type to the ScalarImageToHistogramGenerator as a template
parameter. The first error is like this:

c:\vap\insighttoolkit-2.0.1-source\code\numerics\statistics\itkimagetolistadaptor.txx(116)
: error C2102: '&' requires l-value

  And my code looks like this:

typedef typename ImageType::PixelType PixelType;
typedef typename PixelType::ValueType ValueType;

typedef itk::ImageAdaptor<ImageType,
RedChannelPixelAccessor<ValueType> >   RedAdaptorType;

typedef itk::Statistics::ScalarImageToHistogramGenerator<RedAdaptorType>
ScalarHistogramGeneratorType;  // this is the line that causes the
error

Thanks

Pablo


More information about the Insight-users mailing list