You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
watershed method from skimage.segmentation is not working as it supposed to with mask parameter (or at least not as I assumed)
I think it is even segmenting area outside of mask. Some kind of dots (at regular interval) are in segmented image.
I have attached original (image which I want to segment), mask and segmented image.
Way to reproduce
# Place the full code we need to recreate your issue here# upload all necessary images to github too!importSimpleITKfrommatplotlibimportpyplotaspltfromskimage.segmentationimportclear_border, watershed, mark_boundariesorg=SimpleITK.ReadImage("original.png")
mask=SimpleITK.ReadImage("mask.png")
org_array=SimpleITK.GetArrayFromImage(org)
mask_array=SimpleITK.GetArrayFromImage(mask)
segments_watershed=watershed(org_array, 1000, mask=mask_array)
plt.imshow(segments_watershed, cmap="gray")
Version information
# Paste the output of the following python commandsfrom __future__ importprint_functionimportsys; print(sys.version)
importplatform; print(platform.platform())
importskimage; print("scikit-image version: {}".format(skimage.__version__))
importnumpy; print("numpy version: {}".format(numpy.__version__))
Thanks for the report, @Vapster! What's happening is that we are creating markers (the points from which the watershed begins) over the whole image, rather than limiting ourselves to the mask. Then, the actual watershed only happens within the mask, but you're left with those tiny, unused markers everywhere.
It's a matter of making sure the marker creation is aware of the mask. Shouldn't be too hard to fix.
Description
watershed method from skimage.segmentation is not working as it supposed to with mask parameter (or at least not as I assumed)
I think it is even segmenting area outside of mask. Some kind of dots (at regular interval) are in segmented image.
I have attached original (image which I want to segment), mask and segmented image.
Way to reproduce
Version information
The text was updated successfully, but these errors were encountered: