[Insight-developers] Code Review of BinaryMorphologicalOpening/Closing

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Fri May 13 04:27:08 EDT 2011


Hi Luis,


Le 11 mai 11 à 21:59, Luis Ibanez a écrit :

> 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 ?
>
>

We agreed that here should be a pad and crop in that filter as well,  
so there should also be a SetSafeBorder() method.

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


This is because:

* the foreground is defined has a single value, while the background  
can have many values;
* the closing can only add foreground pixels, while the opening can  
only add background pixels.

The closing doesn't require to define the background value - it is  
defined as anything which is not the foreground.
The opening requires to define the background value, because this is  
the value which will be used to add background pixels.

But if you fill more comfortable with a SetBackgroundValue() in the  
opening filter, I'm ok with that.
The important features for me are the safe border and the preservation  
of the background values.

Gaëtan

-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr  http://www.itk.org
http://www.mandriva.org  http://www.bepo.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20110513/17e7683f/attachment.pgp>


More information about the Insight-developers mailing list