Skip to content

3. Cell morphology from binary mask

Jane Ling edited this page Jul 6, 2023 · 3 revisions

The original mask from output of suite2p looks like this:
Original binary mask

Note that some cells are broken or with disconnected parts.

binary_closing from the package skimage.morphology is used to fill the gaps. Here is the image after binary closing:
binary closing

binary_opening from the package skimage.morphology is used to remove the long and thin parts of the cells, presumably the axons or dendrites. Here is the image after binary opening:
binary closing and opening

measure.find_contours from the package skimage is used to obtained the contours of the cells:
Contours of selected cells

regionprops from the package skimage.measure is used to calculate the dimensions of the cells, including their axes and orientations:
Distorted Clocks

Clone this wiki locally