[Insight-developers] Code Review of BinaryMorphologicalOpening/Closing

Luis Ibanez luis.ibanez at kitware.com
Wed May 11 15:59:59 EDT 2011


Hi Gaetan,

2011/5/11 Gaëtan Lehmann <gaetan.lehmann at jouy.inra.fr>:
>>
>> Why is this option only in the Closing filter
>> and not in the Opening one ?
>>
>> They are supposed to be dual operations, isn't it ?
>>
>> Closening the foreground should produce the
>> same result as Opening the background.
>>
>> That is, I should be able to run an Opening operation
>> by using the Closing filter, and switching the values
>> of Foreground and Background.
>
>
> Yes, you're right.
>
> I've assumed that the erosion can only shrink the object, but it also
> enlarge the background.
> So there should also be a padding in the opening version.
>
-----------------------------------------------------


I'm still missing an explanation of why
the Closing filter has an API:

     SetForegroundValue()
     SetSafeBorder()

and the Opening filter has an API

    SetForegroundValue()
    SetBackgroundValue()


It looks like the API was modeled on the assumption
that the object is rarely touching the border....

---

Here is the argument for duality.

If I have image X, and do Closing on it,
I should get the same image that if I
take X negated, and do Opening on it.

With the current API of these two filters,
there is an asymmetry that doesn't reflect
the duality of the opening/closing operation.


   Why is that there is not
   a SetSafeBorder() method in the Opening filter ?


and


  Why is that there is not
  a SetBackgroundValue() method in the Closing filter ?



   Luis


More information about the Insight-developers mailing list