I am using the Voronoi diagram-based approach outlined here to find midlines of binary masks of root images. I am using the Python code more or less exactly as described:
import skimage.morphology as morphology
WHITE = 255
image_bool = binary_mask == WHITE
d = morphology.disk(2)
img = morphology.binary_closing(image_bool, selem=d)
skeleton = morphology.medial_axis(img)
Then comes the graphing: I feed the skeletonized image into buildTree, as described in user Gabriel's iPython notebook: https://github.com/gabyx/WormAnalysis/blob/master/SkeletonTest/Skeletonize.ipynb
In general, this produces great results. However, the method occasionally fails in two distinct ways:
1) The graphs do not always extend the full length of the root:
2) The graphs sometimes connect "prematurely" to a point along the root contour that may appear to be the longest path, but clearly does not conform to what I would call the "midline". This happens for a diverse range of polygon shapes:
This final case is an artificial mask -- none of my actual roots have perfectly flat tips -- but I think it represents the problem quite well.
Does anyone with a more refined understanding of Voronoi diagrams have any tips for how to address either of these problems, while still retaining this general approach.
Thanks!