MantisBT - ITK
View Issue Details
0010205ITKpublic2010-01-29 16:422010-10-21 12:31
Hans Johnson 
Luis Ibanez 
highmajoralways
closedfixed 
ITK-3-16 
 
0010205: Recent changes to itkBayesianClassifierImageFilter.txx cause WrapITK failures
Karthik,

Your recent changes to itkBayesianClassifierImageFilter.h have exposed a template dependancy that was causing compile time failures when using WrapIT
K. I've posted the compiler errors below, and committed code in the testing directory that can be used to force the compile time error.

It looks like a type mis-match when floating point types are used.

I can make this fail in the itkBayesianClassifierImageFilterTest.cxx

#if 1
    {
    const unsigned int TestDimension = 2;
    typedef unsigned char TestLabelType;
    typedef float TestPosteriorType;
    
    //This is a failing test case!!!
    typedef float TestPriorType;·
    typedef itk::VectorImage< double ,TestDimension > TestInitialLabelImageType; //The element type MUST be the PriorType
    
    typedef itk::BayesianClassifierImageFilter<
      TestInitialLabelImageType, TestLabelType, TestPosteriorType, TestPriorType > TestClassifierFilterType;
    TestClassifierFilterType::Pointer test=TestClassifierFilterType::New();
    }
#endif


Hans

/Users/hjohnson/src/BRAINS-COMPILE/Darwin/FAST_64-lib/Insight/Code/Algorithms/itkBayesianClassifierImageFilter.txx: In member function ‘void itk::Bay
esianClassifierImageFilter<TInputVectorImage, TLabelsType, TPosteriorsPrecisionType, TPriorsPrecisionType>::SetPriors(const itk::VectorImage<TPriorsP
recisionType, itk::BayesianClassifierImageFilter<TInputVectorImage,TLabelsType,TPosteriorsPrecisionType,TPriorsPrecisionType>::Dimension>*) [with TIn
putVectorImage = itk::VectorImage<double, 2u>, TLabelsType = unsigned char, TPosteriorsPrecisionType = float, TPriorsPrecisionType = float]’:
/Users/hjohnson/src/BRAINS-COMPILE/Darwin/FAST_64-lib/Insight/Testing/Code/Algorithms/itkBayesianClassifierImageFilterTest.cxx:218: instantiated fr
om here
/Users/hjohnson/src/BRAINS-COMPILE/Darwin/FAST_64-lib/Insight/Code/Algorithms/itkBayesianClassifierImageFilter.txx:264: error: no matching function f
or call to ‘itk::BayesianClassifierImageFilter<itk::VectorImage<double, 2u>, unsigned char, float, float>::SetInput(int, const itk::VectorImage<float
, 2u>*&)’
/Users/hjohnson/src/BRAINS-COMPILE/Darwin/FAST_64-lib/Insight/Code/Common/itkImageToImageFilter.txx:55: note: candidates are: void itk::ImageToImageF
ilter<TInputImage, TOutputImage>::SetInput(const TInputImage*) [with TInputImage = itk::VectorImage<double, 2u>, TOutputImage = itk::Image<unsigned c
har, 2u>]
/Users/hjohnson/src/BRAINS-COMPILE/Darwin/FAST_64-lib/Insight/Code/Common/itkImageToImageFilter.txx:69: note: void itk::ImageToImageF
ilter<TInputImage, TOutputImage>::SetInput(unsigned int, const TInputImage*) [with TInputImage = itk::VectorImage<double, 2u>, TOutputImage = itk::Im
age<unsigned char, 2u>]
make[2]: *** [Testing/Code/Algorithms/CMakeFiles/itkAlgorithmsTests4.dir/itkBayesianClassifierImageFilterTest.o] Error 1
make[1]: *** [Testing/Code/Algorithms/CMakeFiles/itkAlgorithmsTests4.dir/all] Error 2
make: *** [all] Error 2
No tags attached.
Issue History
2010-01-29 16:42Hans JohnsonNew Issue
2010-01-29 16:42Hans JohnsonStatusnew => assigned
2010-01-29 16:42Hans JohnsonAssigned To => Karthik Krishnan
2010-01-30 16:02Luis IbanezAssigned ToKarthik Krishnan => Luis Ibanez
2010-01-30 16:08Luis IbanezNote Added: 0019370
2010-01-30 16:09Luis IbanezNote Added: 0019371
2010-01-30 16:09Luis IbanezStatusassigned => resolved
2010-01-30 16:09Luis IbanezResolutionopen => fixed
2010-10-21 12:31Gabe HartStatusresolved => closed

Notes
(0019370)
Luis Ibanez   
2010-01-30 16:08   
A fix has been committed:

http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/Algorithms/itkBayesianClassifierImageFilter.txx?root=Insight&r1=1.11&r2=1.12&sortby=date [^]

http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/Algorithms/itkBayesianClassifierImageFilter.h?root=Insight&r1=1.16&r2=1.17&sortby=date [^]

Two errors were fixed:

A) SetPriors() should take a const pointer as argument.

B) instead of calling the SetInput(n, image *) method of ImageToImageFilter,
   the .txx file should call the SetNthInput method of the ProcessObject,
   because the Priors are not necessarily of the same type as the input image.
(0019371)
Luis Ibanez   
2010-01-30 16:09   
The test case that was failing, has been enabled, and it is compiling now.

http://public.kitware.com/cgi-bin/viewcvs.cgi/Testing/Code/Algorithms/itkBayesianClassifierImageFilterTest.cxx?root=Insight&r1=1.9&r2=1.10&sortby=date [^]