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

Luis Ibanez luis.ibanez at kitware.com
Wed Sep 28 13:18:58 EDT 2005


Hi Pablo,

Please read the ITK Software Guide

    http://www.itk.org/ItkSoftwareGuide.pdf



In particular section 10.3.1, "Image Histograms"
in pdf-page 671.


The examples in this section describe how to
compute histograms for Scalar and RGB images,
and in particular how to get the Histogram for
only one of the RGB components.


   Regards,


      Luis


---------------------
Pablo Arias wrote:
> 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
> _______________________________________________
> 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