[Insight-users] itk set\get macro

Karthik Krishnan Karthik.Krishnan at kitware.com
Mon Aug 1 14:02:37 EDT 2005


Did you subclass from itk::Object ? Lots of macros optionally print out 
debug messages  and it is printed if the option GetDebug() is true. This 
method will be inherited if you subclass from itk::Object. In other 
words, you can use most Get/Set macros only if you subclass from itk::Object

l franz wrote:

> Hi everybody,
>
> I have create a class in which I have to set (and get) a parameter, 
> the brightness threshold. For that,  I used itk set/get macro:
>
>   itkSetMacro(BrightnessThreshold, int);
>   itkGetConstReferenceMacro(BrightnessThreshold, int);
>
> But the program doesn't want to compile. The errors given are:
>
> /home/gally/susan/itkUsanWeightFunction.h: In method `void
> itk::UsanWeightFunction<TOperator>::SetBrightnessThreshold (int) [with 
> TOperator = FloatType]':
> /home/gally/susan/itkFSLSusanImageFilter.txx:159:   instantiated from 
> `itk::FSLSusanImageFilter<TInputImage, 
> TOutputImage>::ThreadedGenerateData (typename TOutputImage::RegionType 
> &, int) [with TInputImage = main (int, char **)::InputImageType, 
> TOutputImage = main (int, char **)::OutputImageType]'
> /home/gally/programmes/itk/InsightToolkit-1.8.1/Code/IO/itkImageFileWriter.txx:158:   
> instantiated from here
> /home/gally/susan/itkUsanWeightFunction.h:93: no matching function for 
> call to
> `itk::UsanWeightFunction<FloatType>::GetDebug ()'
> /home/gally/susan/itkFSLSusanImageFilter.txx:159:   instantiated from 
> `itk::FSLSusanImageFilter<TInputImage, 
> TOutputImage>::ThreadedGenerateData (typename TOutputImage::RegionType 
> &, int) [with TInputImage = main (int, char **)::InputImageType, 
> TOutputImage = main (int, char **)::OutputImageType]'
> /home/gally/programmes/itk/InsightToolkit-1.8.1/Code/IO/itkImageFileWriter.txx:158:   
> instantiated from here
> /home/gally/susan/itkUsanWeightFunction.h:93: no matching function for 
> call to
> `itk::UsanWeightFunction<FloatType>::Modified ()'
> /home/gally/susan/itkUsanWeightFunction.h: In method `const int
> &itk::UsanWeightFunction<TOperator>::GetBrightnessThreshold () const 
> [with TOperator = FloatType]':
> /home/gally/programmes/itk/InsightToolkit-1.8.1/Code/Common/itkPoint.h:97:   
> instantiated from here
> /home/gally/susan/itkUsanWeightFunction.h:94: no matching function for 
> call to
> `itk::UsanWeightFunction<FloatType>::GetDebug () const'
> /home/gally/susan/itkUsanWeightFunction.h:94: passing `const 
> itk::UsanWeightFunction<FloatType>' as
> `this' argument of `const char 
> *itk::UsanWeightFunction<TOperator>::GetNameOfClass () [with TOperator =
> FloatType]' discards qualifiers
>
> I understand that I need GetDebug() and Modified() method, but I don't 
> know why... Does my class needs inheritance of something??
>
> Thanks for advices,
>
> Regards,
>
> Franz
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Insight-users mailing list
>Insight-users at itk.org
>http://www.itk.org/mailman/listinfo/insight-users
>  
>


More information about the Insight-users mailing list