Actually this specific function has been on my mind for some time! Do you have a reference implementation, preferably in nD? =)
On 21 Sep 2017, 4:33 PM +1000, firstname.lastname@example.org, wrote:
add one: if scikit-image can implements a ridge filter. just like watershed mixed with the skeleton. make all region a same label, then do level loop, just stop when one pixel left. It's usful in geography and hydrology analysis.
----- 原始邮件 ----- 发件人：Juan Nunez-Iglesias email@example.com 收件人：scikit-image firstname.lastname@example.org, email@example.com, "Mailing_list_for_scikit-image_(http://scikit-image.org)" firstname.lastname@example.org 主题：Re: [scikit-image] my watershed 日期：2017年09月21日 13点48分
Thanks for this. Simple functions are very good for one’s own images, as well as to understand an algorithm, but for a widely used library like scikit-image, flexibility and robustness are least as important as speed. In skimage, we aim to support floating point input images, for which your code won’t work. There is a lot of thought into edge cases going into the skimage implementation, which unfortunately could have an effect on performance. The question we need to solve isn’t “can we make a super-fast watershed implementation”, but, “can we make a flexible and robust implementation that is also fast?” Using Numba is certainly not off-limits, but any candidate implementation should at a minimum pass the skimage test suite.
I once tried a level-by-level implementation of watershed, by the way. It has a fatal flaw, which is that valleys with no markers will never get labeled. Here’s a test case that works with skimage but fails in your implementation. (Note also that your implementation overwrites the seeds image, which is pretty crazy. =)
In : import watershed In : from skimage import morphology In : import numpy as np In : image = np.array([1, 0, 1, 0, 1, 0, 1], dtype=np.uint8) In : seeds = np.array([0, 1, 0, 0, 0, 2, 0]) In : morphology.watershed(image, seeds) Out: array([1, 1, 1, 1, 2, 2, 2], dtype=int32) In : watershed.watershed(image, seeds) Out: array([0, 0, 0, 0, 0, 0, 0]) In : seeds Out: array([0, 0, 0, 0, 0, 0, 0])
On 12 Sep 2017, 6:34 AM +1000, email@example.com, wrote:
Hi: Now It supports nd. but less of test. this image, skimage cost 20s, mine less than 1s. It is wrriten with numba in 90 lines. did not support compactness, but it's simple, and fast.
YXDragon _______________________________________________ scikit-image mailing list firstname.lastname@example.org https://mail.python.org/mailman/listinfo/scikit-image