[Insight-users] Re: Histogram: empty bins

Julien Jomier jjomier at cs.unc.edu
Wed, 25 Feb 2004 11:13:57 -0500


Hi David,

SetHistogramMin() and SetHistogramMax() functions were not implemented =
in
itkImageToHistogramGenerator (only in =
itkListSampleToHistogramGenerator). I
just added these two functions in the CVS repository. Please update your =
cvs
version of Insight.

Let us know if that solves your problem,

Regards,

Julien

> -----Original Message-----
> From: insight-users-admin at itk.org=20
> [mailto:insight-users-admin at itk.org] On Behalf Of David Llanos
> Sent: Wednesday, February 25, 2004 10:41 AM
> To: Luis Ibanez; Insight-users at itk.org
> Subject: [Insight-users] Re: Histogram: empty bins
>=20
>=20
> Hi Luis
>=20
> I read the solution of Julien, but I don't resolve my=20
> problem. This is my
> code:
>=20
> --------------------------------------------------------------
> --------------
> typedef enum{ROJO,VERDE,AZUL} colorRGB;
> typedef itk::Statistics::ImageToHistogramGenerator< RGBImageType >
>               HistogramGeneratorType;
> typedef HistogramGeneratorType::SizeType   SizeType;
> typedef HistogramGeneratorType::HistogramType  HistogramType;
>=20
>=20
> unsigned long * ProcesadorImagenEspermas::imhist (const=20
> RGBImageType * ImagenEntrada, colorRGB color) {
>   SizeType size;
>   unsigned int channel =3D 0;
>   if (color=3D=3DVERDE) {
>   channel =3D 1 ;  // Canal Verde
>   size[0] =3D   1;  // Numero de bins del canal Rojo
>   size[1] =3D 255;  // Numero de bins del canal Verde
>   size[2] =3D   1;  // Numero de bins del canal Azul
>   }
>   if (color=3D=3DAZUL) {
>   channel =3D 2 ;  // Canal Azul
>   size[0] =3D   1;  // Numero de bins del canal Rojo
>   size[1] =3D   1;  // Numero de bins del canal Verde
>   size[2] =3D 255;  // Numero de bins del canal Azul
>   }
>=20
>   HistogramGeneratorType::Pointer histogramGenerator =3D=20
> HistogramGeneratorType::New();
>=20
>   histogramGenerator->SetInput(ImagenEntrada);
>=20
>   histogramGenerator->SetNumberOfBins( size );
>   histogramGenerator->SetMarginalScale( 10.0 );
>   histogramGenerator->Compute();
>=20
>=20
>   //SetHistogramMin() and SetHistogramMax()        =20
> ...........as the use?
>=20
>   const HistogramType * histogram =3D histogramGenerator->GetOutput();
>   const unsigned int histogramSize =3D histogram->Size();
>=20
>   std::cout << "Tamano del histograma " << histogramSize << std::endl;
>=20
>   for( unsigned int bin=3D0; bin <=3D histogramSize; bin++ )
>      Histograma[bin]=3Dhistogram->GetFrequency( bin, channel );
>   return(Histograma);
> }
> --------------------------------------------------------------
> --------------
> ----
>=20
> thanks and regards,
>=20
> David
>=20
>=20
> ----- Original Message -----=20
> From: "Luis Ibanez" <luis.ibanez at kitware.com>
> To: "David Llanos" <gva02 at elai.upm.es>; <Insight-users at itk.org>
> Sent: Wednesday, February 25, 2004 2:21 AM
> Subject: Re: Histogram: empty bins
>=20
>=20
> >
> >
> > Hi David,
> >
> > What is the typedef that you used for defining
> > the type HistogramGeneratorType  ?
> >
> > ----
> >
> > Please read the messages that Julien Jomier
> > posted to the users-list regarding the solution
> > to your problem.
> >
> > The user-list is indexed by Google:
> >
> >
> http://www.google.com/advanced_search?as_sitesearch=3Dwww.itk.or
> g&as_epq=3Dinsight%2Dusers
> >
> > If you search for the words:
> >
> >                histogram, empty, bins
> >
> > in 0.19 seconds Google will find the following link for you:
> >
> > http://www.itk.org/pipermail/insight-users/2004-January/006408.html
> >
> >
> >
> > Regards,
> >
> >
> >     Luis
> >
> >
> > --------------------
> > David Llanos wrote:
> >
> > > hi Luis,
> > >
> > > Do you renember the problem of the empty bins in the=20
> histogram? I a=20
> > > lot of time have been outside and I have not been able to=20
> read your=20
> > > messages up to now.
> > >
> > > I have just download the last cvs ITK release yesterday,=20
> but I don't
> > > know how to use the next functions correctly:    =20
> SetHistogramMin() and
> > > SetHistogramMax()
> > >
> > > the following code is erroneous:
> > >
> > > --------------------------
> > >  HistogramGeneratorType::Pointer histogramGenerator =3D=20
> > > HistogramGeneratorType::New(); =20
> > > histogramGenerator->SetInput(ImagenEntrada);
> > >  histogramGenerator->SetNumberOfBins( size ); =20
> > > histogramGenerator->SetHistogramMin(0);
> > >                             ...
> > >  ----------------------------------------------------
> > > C:\Documents and Settings\dllanos.LABSISWS09\Mis
> > > documentos\CLASESESPERMA\procesadorImagenEsperma.cpp(61) : error=20
> > > C2039: 'SetHistogramMin' : is not a member of=20
> > > 'ImageToHistogramGenerator<class itk::Image<class=20
> > > itk::RGBPixel<unsigned char>,2> >'
> > > ------------------------------------------------------
> > >
> > >
> > > Thanks in advange and regards;
> > >
> > > David
> >
> >
> >
> >
>=20
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org=20
> http://www.itk.org/mailman/listinfo/insight-> users
>=20