[Insight-developers] A few minor consistency issues

Zachary Pincus zpincus at stanford.edu
Thu Jan 12 16:37:02 EST 2006


Hmm, no luck -- the same error appears for operator==.

Perhaps the question to be asking is why isn't gcc (I am using gcc4)  
properly providing the implicit comparison operators for the functor  
classes? Any thoughts?

Zach


Here's some test code:
#include "itkTernaryAddImageFilter.h"
#include "itkImage.h"

const unsigned int Dimension = 2;
typedef unsigned short PixelType;
typedef itk::Image<PixelType, Dimension>  ImageType;
typedef itk::TernaryAddImageFilter<ImageType, ImageType, ImageType,  
ImageType> AddImageType;

int main(int argc, char *argv[]) {	
   AddImageType::Pointer adder = AddImageType::New();
   adder->SetFunctor(adder->GetFunctor());

	return 0;
}

For reference, the Add3 functor used by this filter is defined as:
template< class TInput1, class TInput2, class TInput3, class TOutput>
class Add3
{
public:
   Add3() {}
   ~Add3() {}
   inline TOutput operator()( const TInput1 & A,
                              const TInput2 & B,
                              const TInput3 & C)
   { return (TOutput)(A + B + C); }
};


Which generates the following error:
Insight/Code/BasicFilters/itkTernaryFunctorImageFilter.h: In member  
function 'void itk::TernaryFunctorImageFilter<TInputImage1,  
TInputImage2, TInputImage3, TOutputImage, TFunction>::SetFunctor 
(const TFunction&) [with TInputImage1 = ImageType, TInputImage2 =  
ImageType, TInputImage3 = ImageType, TOutputImage = ImageType,  
TFunction = itk::Function::Add3<PixelType, PixelType, PixelType,  
PixelType>]':
/Users/zpincus/Documents/Research/Theriot Lab/Development/Scratch/ 
Ternary Test/writer.cxx:13:   instantiated from here
/Developer/Local/ITK-CVS/Insight/Code/BasicFilters/ 
itkTernaryFunctorImageFilter.h:95: error: no match for 'operator=='  
in 'functor == ((itk::TernaryFunctorImageFilter<ImageType, ImageType,  
ImageType, ImageType, itk::Function::Add3<PixelType, PixelType,  
PixelType, PixelType> >*)this)- 
 >itk::TernaryFunctorImageFilter<ImageType, ImageType, ImageType,  
ImageType, itk::Function::Add3<PixelType, PixelType, PixelType,  
PixelType> >::m_Functor'

This is the same error as when using operator!=.



More information about the Insight-developers mailing list