[Insight-users] Bug reporting for basic filter implementation

Luis Ibanez luis.ibanez at kitware.com
Tue Oct 12 08:45:00 EDT 2004


Hi Quan,

The reason to not use the Set macros for Arrays is that
that the macro first compares the new value with the
existing one, in order to avoid modifications in case
both values are already the same.


You may want to take a look at the definition of the
itkSetMacro() in lines 102-111 of

Insight/Code/Common/itkMacro.h

> /** Set built-in type.  Creates member Set"name"() (e.g., SetVisibility()); */
> #define itkSetMacro(name,type) \
>   virtual void Set##name (const type _arg) \
>   { \
>     itkDebugMacro("setting " #name " to " << _arg); \
>     if (this->m_##name != _arg) \
>       { \
>       this->m_##name = _arg; \
>       this->Modified(); \
>       } \
>   } 
> 


This comparision requires the type to provide an operator==.
The itkArray class lacks such an operator.


Please let us know if you find any trouble while logging
the bug for the need to add the this->Modified() call, into
the bugtracker.


    Thanks


       Luis


--------------------
Quan Chen wrote:
> The setMacro take care of the Modified() and debug macro issue, so the
> problem only restricted to those set functions declared without using
> setMacro.
> 
> I am wondering why in CannyEdgeDetection function, the setVariance and
> setMaximumError is first declared with setMacro and then overided ???
> Is that the copy constructor = of ArrayType is not defined? i.e. the
> m_Variance=v doesn't work?
> 
> 
> 
> On Sat, 09 Oct 2004 18:45:56 -0400, Luis Ibanez <luis.ibanez at kitware.com> wrote:
> 
>>Hi Quan,
>>
>>Thanks for pointing this out.
>>
>>You are right, these Set() methods are missing the
>>invocation to Modified(). They are also missing
>>the invocation for the Debug macros.
>>
>>Could you please log this as a bug entry ?
>>
>>You can do this in the following link
>>
>>     http://www.itk.org/Bug/
>>
>>You can open an account by using your email.
>>After that you can login in the system and
>>"Add a new Bug" entry.
>>
>>Please let us know if you encounter any problem
>>while logging the bug entry.
>>
>>   Thanks
>>
>>     Luis
>>
>>---------------------
>>
>>
>>Quan Chen wrote:
>>
>>>Well, I am not sure if it can be termed as a bug or just inconsistency in
>>>programming.  However, I tryed CannyEdgeDetectionImageFilter, In the
>>>itkCannyEdgeDetectionImageFilter.h, there are several function definitions:
>>>
>>>  /** Standard get/set macros for filter parameters. */
>>>  itkSetMacro(Variance, ArrayType);
>>>  itkGetMacro(Variance, const ArrayType);
>>>  itkSetMacro(MaximumError, ArrayType);
>>>  itkGetMacro(MaximumError, const ArrayType);
>>>
>>>  /** Set/Get the Variance parameter used by the Gaussian smoothing
>>>      filter in this algorithm */
>>>  void SetVariance(const typename ArrayType::ValueType v)
>>>  {
>>>    m_Variance.Fill(v);
>>>  }
>>>
>>>  /** Set/Get the MaximumError paramter used by the Gaussian smoothing
>>>filter
>>>      in this algorithm */
>>>  void SetMaximumError(const typename ArrayType::ValueType v)
>>>  {
>>>    m_MaximumError.Fill(v);
>>>  }
>>>
>>>However, shouldn't there be a
>>>this->Modified();
>>>in each functions?  I know several other filter functions are implemented
>>>that way, e.g. itkGradientMagnitudeRecursiveGaussianImageFilter.  As far as
>>>I understand, the itk use those pipe line structures, so if you changed on
>>>components in the pipe line, you should inform those behind you.
>>>Also, there are lines like this
>>> itkSetMacro(Threshold, OutputImagePixelType );
>>>  itkGetMacro(Threshold, OutputImagePixelType);
>>>  itkSetMacro(OutsideValue, OutputImagePixelType);
>>>  itkGetMacro(OutsideValue, OutputImagePixelType);
>>>I believe we should expand those and add that modified() call too.
>>>
>>>I didn't check other filters, my guess is there will be other filters
>>>implemented that miss this line.
>>>
>>>I found this problem when I modify the application example
>>>"GeodesicActiveContour".  I replace the gradient filter with the Canny
>>>filter.  However, I noticed that when I change the sigma value (which I
>>>modified to reflect variance in cannyfilter), I find that the program
>>>doesn't react to this change and even if I click the button trying to ask
>>>the program to recalculate, it fail to do anything.
>>>
>>>BTW, the version I am using is the 1.8.0 version, which I believe is the
>>>up-to-date one.
>>>_______________________________________________
>>>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