[Insight-users] Strange instantiantion of unused class

Nils H. Busch nilsb at cbs.mpg.de
Thu Sep 15 07:14:41 EDT 2005


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