[Insight-users] Problem with itk::HistogramMatchingImageFilter

cagatay bilgin bilgincc at gmail.com
Mon Oct 31 14:46:08 EDT 2011


Hi Dario,

In general it gets a little hard to understand the errors when you
have templates. Just by aligning the error and seeing what is
going on will help to understand the cause of the problem.

It looks like you are passing integers to the
computeminmax function whereas it is expecting
float values. My guess is that if you change your
threshold values to float the code should work fine.


Here is how you are calling the function
ITKSeg.cpp:220: error: no matching function for call to

‘itk::HistogramMatchingImageFilter<
        itk::Image<float, 2u>,
        itk::Image<float, 2u>,
        float>::ComputeMinMaxMean(
                itk::Image<float, 2u>*,
                int&,
                int&,
                int&)’

Here is how it expects to be called
itkHistogramMatchingImageFilter.txx:386: note: candidates are: void
itk::HistogramMatchingImageFilter<
        TInputImage,
        TOutputImage,
        THistogramMeasurement>::ComputeMinMaxMean(
                const typename itk::ImageToImageFilter::InputImageType*,
                THistogramMeasurement&,
                THistogramMeasurement&,
                THistogramMeasurement&)

[with TInputImage = itk::Image<float, 2u>,
      TOutputImage =itk::Image<float, 2u>,
      THistogramMeasurement = float]


Regards,
Cagatay

On Sun, Oct 30, 2011 at 3:19 AM, Dario Kassler <majin_clodan at t-online.de>wrote:

> Hello,
>
> i hope i ask the question in the right position. I didn't found any place
> in which I can create a new thread in the mailing list.
>
> Well I want to get the min, max and mean grayscale value from a picture. I
> need the values for the canny algorithm. I want to compute the the
> thresholds in a automatic way and for this I need these values. My Code for
> the computation of the min, max and mean grayscale of the picture looks
> like the following:
>
> int thresholdLower = 0;
> int thresholdUpper = 0;
> int thresholdMean = 0;
>
>
> const unsigned int DimensionHist = 2;
> typedef unsigned short PixelType;
> typedef itk::Image< PixelType, Dimension >  MovingImageType;
> typedef itk::ImageFileReader< MovingImageType > MovingImageReaderType;
> MovingImageReaderType::Pointer movingImageReader =
> MovingImageReaderType::New();
> typedef float InternalPixelType;
> typedef itk::Image< InternalPixelType, DimensionHist > InternalImageType;
>
>
> typedef itk::HistogramMatchingImageFilter< InternalImageType,
> InternalImageType >
> MatchingFilterType;
>
>
> // this class has the method ComputeMinMaxMean
> MatchingFilterType::Pointer matcher = MatchingFilterType::New();
>
>
> typedef itk::ImageFileReader< MovingImageType > MovingImageReaderType;
> movingImageReader->SetFileName( inputPicture);
>
>
> typedef itk::CastImageFilter< MovingImageType, InternalImageType >
> MovingImageCasterType;
> MovingImageCasterType::Pointer movingImageCaster =
> MovingImageCasterType::New();
> movingImageCaster->SetInput( movingImageReader->GetOutput() );
>
>
> matcher->ComputeMinMaxMean(movingImageCaster->GetOutput(), thresholdLower,
> thresholdUpper, thresholdMean);
>
>
>
>
> The "inputPicture" is the path to my picture.
> I get the following error:
> /Users/System/HiwiJob/Ticket 502/ITK/ITKSeg.cpp: In member function ‘int
> ITKSeg::Canny(const char*, float, char*, char*)’:
> /Users/System/HiwiJob/Ticket 502/ITK/ITKSeg.cpp:220: error: no matching
> function for call to ‘itk::HistogramMatchingImageFilter<itk::Image<float,
> 2u>, itk::Image<float, 2u>, float>::ComputeMinMaxMean(itk::Image<float,
> 2u>*, int&, int&, int&)’
> /usr/local/include/InsightToolkit/Algorithms/itkHistogramMatchingImageFilter.txx:386:
> note: candidates are: void itk::HistogramMatchingImageFilter<TInputImage,
> TOutputImage, THistogramMeasurement>::ComputeMinMaxMean(const typename
> itk::ImageToImageFilter<TInputImage, TOutputImage>::InputImageType*,
> THistogramMeasurement&, THistogramMeasurement&, THistogramMeasurement&)
> [with TInputImage = itk::Image<float, 2u>, TOutputImage = itk::Image<float,
> 2u>, THistogramMeasurement = float]
>
>
> Well what can I do to serve this problem? Can anyone give me a example or
> so? :'(
> I will be very cool and I will be very thankful if you help me. :)
>
>
> Greeting, Clodan
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20111031/b098a544/attachment.htm>


More information about the Insight-users mailing list