[scikit-image] scikit-image Digest, Vol 19, Issue 5

Alexandre de Siqueira afdesiqueira at protonmail.com
Tue Apr 10 12:33:18 EDT 2018


Dear Yann,
thank you for that. This looks really interesting; I think I faced this issue myself these months in [1]. I solved it using a terrible workaround...
Could you please submit a new issue in https://github.com/scikit-image/scikit-image/issues? Meanwhile, I'll try to find Soille's book and read it, ok? Then we can start to investigate it.
Thank you again. Kind regards,

Alex

[1] https://arxiv.org/abs/1706.03282v1
--------------------------------------------------
Dr. Alexandre 'Jaguar' Fioravante de Siqueira
Grupo de Cronologia - Sala S13
Departamento de Raios Cósmicos e Cronologia - DRCC
Instituto de Física "Gleb Wataghin" - IFGW
Unicamp - Universidade Estadual de Campinas
Rua Sérgio Buarque de Holanda, 777
Cidade Universitária Zeferino Vaz - CEP 13083-859
Campinas - SP - Brazil

Phone: +55(19)3521-5362
ORCID: http://orcid.org/0000-0003-1320-4347
Personal site: http://programmingscience.org
Github: http://github.com/alexandrejaguar
Skype: alexandrejaguar
--------------------------------------------------

Sent with [ProtonMail](https://protonmail.com) Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On April 10, 2018 1:00 PM, <scikit-image-request at python.org> wrote:

> Dear all,
>
> I have been playing around with the watershed segmentation by markers with the code proposed as example:
>
> http://scikit-image.org/docs/dev/auto_examples/segmentation/plot_watershed.html
>
> Unfortunately, if we use for example floating values for the radii of the circles (like r1, r2 = 20.7, 24.7), the separation is not perfect, as it gives 4 labels.
>
> If we use the chamfer distance transform instead of the Euclidean distance transform, it is even worse.
>
> It appears that the markers detection by regional maximum (peak_local_max) fails in the presence of plateaus. Its algorithm is basically D(I)==I, where D is the morphological dilation.
>
> A better algorithm would be to use morphological reconstruction (see SOILLE, Pierre. Morphological image analysis: principles and applications. Springer Science & Business Media, 2003, p202, Eq 6.13). A proposition of the code can be the following (it should deal with float values):
>
> import numpy as np
>
> from skimage import morphology
>
> def rmax(I):
>
> """
>
> This avoids plateaus problems of peak_local_max
>
> I: original image, float values
>
> returns: binary array, with True for the maxima
>
> """
>
> I = I.astype('float');
>
> I = I / np.max(I) * 2**31;
>
> I = I.astype('int32');
>
> rec = morphology.reconstruction(I-1, I);
>
> maxima = I - rec;
>
> return maxima>0
>
> This code is relatively fast. Notice that the matlab function imregionalmax seem to work the same way (the help is not explicit, but the results on a few tests seem to be similar).
>
> I am afraid I do not have time to integrate it on gitlab, but this should be a good start if someone wants to work on it. If you see any problem with this code, please correct it.
>
> thank you
>
> best regards
>
> --
> Yann
>
> First mistake, this should work, but the discretization of the 'continuous' values should be handled with care.
>
> def rmax(I):
>
> """
>
> Own version of regional maximum
>
> This avoids plateaus problems of peak_local_max
>
> I: original image, int values
>
> returns: binary array, with 1 for the maxima
>
> """
>
> I = I.astype('float');
>
> I = I / np.max(I) * (2**31 -2);
>
> I = I.astype('int32');
>
> h = 1;
>
> rec = morphology.reconstruction(I, I+h);
>
> maxima = I + h - rec;
>
> return maxima
>
> Le 10/04/2018 à 15:35, Yann GAVET a écrit :
>
>> Dear all,
>>
>> I have been playing around with the watershed segmentation by markers with the code proposed as example:
>>
>> http://scikit-image.org/docs/dev/auto_examples/segmentation/plot_watershed.html
>>
>> Unfortunately, if we use for example floating values for the radii of the circles (like r1, r2 = 20.7, 24.7), the separation is not perfect, as it gives 4 labels.
>>
>> If we use the chamfer distance transform instead of the Euclidean distance transform, it is even worse.
>>
>> It appears that the markers detection by regional maximum (peak_local_max) fails in the presence of plateaus. Its algorithm is basically D(I)==I, where D is the morphological dilation.
>>
>> A better algorithm would be to use morphological reconstruction (see SOILLE, Pierre. Morphological image analysis: principles and applications. Springer Science & Business Media, 2003, p202, Eq 6.13). A proposition of the code can be the following (it should deal with float values):
>>
>> import numpy as np
>>
>> from skimage import morphology
>>
>> def rmax(I):
>>
>> """
>>
>> This avoids plateaus problems of peak_local_max
>>
>> I: original image, float values
>>
>> returns: binary array, with True for the maxima
>>
>> """
>>
>> I = I.astype('float');
>>
>> I = I / np.max(I) * 2**31;
>>
>> I = I.astype('int32');
>>
>> rec = morphology.reconstruction(I-1, I);
>>
>> maxima = I - rec;
>>
>> return maxima>0
>>
>> This code is relatively fast. Notice that the matlab function imregionalmax seem to work the same way (the help is not explicit, but the results on a few tests seem to be similar).
>>
>> I am afraid I do not have time to integrate it on gitlab, but this should be a good start if someone wants to work on it. If you see any problem with this code, please correct it.
>>
>> thank you
>>
>> best regards
>>
>> --
>> Yann
>>
>> _______________________________________________
>> scikit-image mailing list
>> scikit-image at python.org
>>
>> https://mail.python.org/mailman/listinfo/scikit-image
>
> --
> Yann GAVET
> Assistant Professor - Ecole Nationale Supérieure des Mines de Saint-Etienne
> 158 Cours Fauriel, CS 62362, 42023 SAINT-ETIENNE cedex 2
> Tel: (33) - 4 7742 0170
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20180410/1f51bedd/attachment-0001.html>


More information about the scikit-image mailing list