[Insight-users] problem when using itkImageToHistogramFilter

David Didierlaurent dadidierlaurent at gmail.com
Thu Nov 29 12:17:57 EST 2012


Hi everybody,

I have problem when using itkImageToHistogramFilter. The compilation is ok
up to the last line:



"const unsigned int Dimension = 3;
  typedef unsigned char PixelType;
  typedef itk::Image< PixelType, Dimension > ImageType;

  const unsigned int MeasurementVectorSize = 1; // Grayscale
  const unsigned int binsPerDimension = 160;

typedef itk::Statistics::ImageToHistogramFilter< ImageType >
    ImageToHistogramFilterType;

  ImageToHistogramFilterType::HistogramType::MeasurementVectorType
    lowerBound(binsPerDimension);
  lowerBound.Fill(0);

  ImageToHistogramFilterType::HistogramType::MeasurementVectorType
    upperBound(binsPerDimension);
  upperBound.Fill(40) ;

  ImageToHistogramFilterType::HistogramType::SizeType
size(MeasurementVectorSize);
  size.Fill(binsPerDimension);

  ImageToHistogramFilterType::Pointer imageToHistogramFilter =
ImageToHistogramFilterType::New();
  imageToHistogramFilter->SetInput( image );
  imageToHistogramFilter->SetHistogramBinMinimum( lowerBound );
  imageToHistogramFilter->SetHistogramBinMaximum( upperBound );
  imageToHistogramFilter->SetHistogramSize( size );
  imageToHistogramFilter->Update();

  ImageToHistogramFilterType::HistogramType* histogram =
imageToHistogramFilter->GetOutput();"


I have this error message:
error: invalid conversion from ‘const itk::Statistics::Histogram<double,
itk::Statistics::DenseFrequencyContainer2>*’ to
‘itk::Statistics::Histogram<double,
itk::Statistics::DenseFrequencyContainer2>*’

Thanks for your help

-- 
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121129/4d675d99/attachment.htm>


More information about the Insight-users mailing list