[Insight-users] itk set\get macro

Zachary Pincus zpincus at stanford.edu
Mon Aug 1 13:57:00 EDT 2005


The ITK set/get macros are specifically geared toward subclasses of  
itk::Object (and sub-subclasses, etc. of course), which maintain  
modified-time information (important for pipeline updates, etc.), and  
which have "debug" methods where you can see every change to an object.

Also I think you'll need to use the itkTypeMacro to provide the  
"GetNameOfClass" method that the getters and setters use.

I suggest looking at these macro definitions in itkMacro.h

Zach

On Aug 1, 2005, at 10:39 AM, 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