User Tools

Site Tools


2019-11-18 Centerline and contour detection


Skeletonization works nicely and the pharynx is failry well described by a cubic or similar. We find the order of the skeleton using hierarchical clustering of the point coordinates of the skeleton with optmized leaf order. The resulting ordered point cloud is fit (x, y independently) to a cubic polynomial. To account for the reduced length of the skeleton compared to the original image, increase length of the polynomial by 10% on each end.


Li thresholding works nicely to find a conservative (i.e larger than object) mask of the pharynx without getting separation of the anterior and posterior bulbs.(This happens with otsu and other thresholding methods). We use this mask and an inverse gaussian gradient as input to a morphological snakes algorithm. (morphological_chan_vese). These are faster and more robust than active_contour_fits. We then apply find_contours to get a continuous ordered contour line. This has sub-pixel accuracy as far as I can see.

The resulting image is this:

width segments

Using the fitted midline, we can calculate orthogonal vectors to the midline. these will be used for the kymograph and to get the width of the animal.

wiki/documentation/monika/2019-11-18_centerline_and_contour_detection.txt · Last modified: 2019/11/18 23:22 by mscholz