[Insight-users] Strange instantiantion of unused class

Nils H. Busch nilsb at cbs.mpg.de
Mon Sep 19 08:24:01 EDT 2005


Hi,


>
> Miller, James V (Research) wrote:
>

>>This class is a baseclass for binary and grayscale morphology.  There are
>>several subclasses of this filter BinaryDilateImageFilter,
>> BinaryErodeImageFilter,
>>GrayscaleDilateImageFilter, GrayscaleFunctionDilateImageFilter,
>> GrayscaleErodeImageFilter,
>>GrayscaleFunctionErodeImageFilter.  Plus several algorithms use these
>> filters internally,
>>things like OpeningByReconstructionImageFilter,
>> GrayscaleMorphologicalOpeningImageFilter,
>>and SignedDanielssonDistanceMapImageFilter.
>>
>>
> There was a bug in the SignedDanielssonDistanceMapImageFilter a while
> ago. And the unmatched function call you have:
>
> ...
> itkMorpholgyImageFilter.txx 62 error no matching function for call to
> itk:ImageRegion<3>::PadByRadius(const itk::Size<2>);
> ...
>
> The bug was that binaryball structuring element was hardcoded for 2D
> rather than use the input image dimention.....
> And this filter derives form MorphologyImageFilter
>
Yes, this is indeed the cause of the compilation error (stumbled upon it
after a sleepless night ...).

> cvs diff -r 1.6 -r 1.5
> Code/Algorithms/itkSignedDanielssonDistanceMapImageFilter.txx
>
> Can you please check on this. Most likely this is not the reason cause I
> put this filter in *after* ITK-1-8. (the version you seem to be using ! ).
> So I wonder if similar bugs have lingered around in other filters...
>
I grabbed the itkSignedDanielssonDistanceMapImageFilter from the cvs
repository (around the itk 2.0.1 release) which had the bug. I was puzzled
because the error did not point to the instantiation in my code.

>
>>Are you using any of these?

Yes.

Now, everything is fine.
Thanks.

>>-----Original Message-----
>>From: insight-users-bounces+millerjv=crd.ge.com at itk.org
>>[mailto:insight-users-bounces+millerjv=crd.ge.com at itk.org]On Behalf Of
>>Nils H. Busch
>>Sent: Thursday, September 15, 2005 7:15 AM
>>To: insight-users at itk.org
>>Subject: [Insight-users] Strange instantiantion of unused class
>>
>>
>>Hi,
>>
>>I am encountering a strange error when compiling a custom class (derived
>> from
>>itk::ImageToImageFilter).
>>The compiler complains it cannot find a matching function.
>>The error message is (shortened) something like this:
>>/usr/local/include/InsightToolkit/BasicFilters/itkMorphologyImageFilter.txx
>>In member function
>>  void itk::MorphologyImageFilter<TInputImage,TOutputImage,TKernel::
>>    GenerateInputRequestedRegion()  [with TInputImage =
>>  test_main::InternalImageType, TOutputImage = InternalImageType, TKernel
>> =
>>    itk::BinaryBallStructuringElement<OutputPixelType,2>,
>>    itk::NeighborhoodAllocator<OutputPixelType > > ]
>>/usr/local/include/itkPoint.h : 97 instantiated from here
>>...
>>itkMorpholgyImageFilter.txx 62 error no matching function for call to
>>itk:ImageRegion<3>::PadByRadius(const itk::Size<2>);
>>...
>>
>>Similar errors follow.
>>
>>Apparantly, there is a mismatch in the Dimension argument (which explains
>>why I get this error only when I instantiate my class with Dim = 3.
>>
>>The strange thing is, I never use the itkMorphologyImageFilter class in
>> my
>>code. Absolutely nowhere.
>>
>>I wrote some test programs where I instantiate my custom classes for
>> various
>>Dim arguments. One only instantiates those classes. Works. A second uses
>>some member functions. Above error appears. I then stripped the second
>>test to a single instantiation like in my other test program. The error
>>persists.
>>
>>I started from fresh working directories, compared the CMakeLists.txt
>>files (they link to the same libraries). Nothtinhg helped. Now, I am at a
>>loss.
>>
>>How can it happen that a class gets instantiated (and most of all
>> wrongly)
>>I never reference. Is this class (manually) instantiated in the ITK
>>library itself ?
>>
>>I know this is rather obscure, and I don't really expect anyone can make
>>much of this, but maybe someone else experienced such strange behaviour
>>and knows how he got rid of it. Or someone can tell me a little more
>> about
>>template instantiation in ITK and under what circumstances such conflicts
>>could happen.
>>
>>I am using ITK v 1.8.1,
>>gcc 3.3.3,
>>cmake 1.9
>>
>>Thanks,
>>
>>
>>
>
>


-- 
  Nils H. Busch


More information about the Insight-users mailing list