Labeling mitochondria per cell basis when you have no membrane marker and only nucleus

Hello everyone,
I a started learning and applying image analysis with python very recently. I mostly use skimage.
I have confocal microscopy images of cells labelled with mitotracker and dapi.
for labelling mitochondria I wrote this code:

img = io.imread(‘mitoch_image’)
thresh = threshold_yen(img)
binary = img > thresh
binary= binary.astype(np.uint8)

blobs = binary > 0.7 * binary.mean()
all_labels = measure.label(blobs)
blobs_labels = measure.label(blobs, background=0)

props_tabl = regionprops_table(blobs_labels, properties=(‘area’,
‘convex_area’,
‘eccentricity’,
‘equivalent_diameter’,
‘perimeter’,
‘filled_area’,
‘solidity’,
‘orientation’,
‘major_axis_length’,
‘minor_axis_length’,
))

and this way, I can get the measurements per image,
but I need to get them per cell basis,
how can I use the nuclei image to get the measurements per cell.
what piece of code do I need to add to the one above?
Many many thanks in advance,

You probably should also show an example image but fundamentally, it boils down to how you want to define a cell when you don’t have cell boundaries. One way would be to do a watershed partitioning of the image using the nuclei as seeds. Look for skimage.segmentation. watershed

Thank you so much for replying but could you elaborate a little more on how to do it?
I know how to use watershed but how can one setup a distance from the nuclear limits for that? Or any other suggestion you might have is very much appreciated, Thank you

Thank you so much for replying but could you elaborate a little more on how to do it?
I know how to use watershed but how can one setup a distance from the nuclear limits for that? Or any other suggestion you might have is very much appreciated, Thank you

Sorry I was a bit too quick in replying. I actually wanted to suggest using the Voronoi algorithm but it looks like it is not available in scikit image. A way to do it would be to apply the watershed algorithm to the distance transform of the binary mask of the nuclei. Alternatively, you could use the mahotas library following this tutorial (computing the Voronoi segmentation is shown towards the bottom of the page).

Thank you JKH, I was able to use Voronoi from Mahotas.
for others that may have trouble with pip installing Mahotas;
I was able to install it with:

conda config --add channels conda-forge
conda install mahotas

Thank you again,

just for everyone’s info, we kinda sorta do have voronoi in scikit-image, because the compact watershed becomes a Voronoi segmentation if the edge map has no features:

voronoi = segmentation.watershed(np.ones_like(dna), seeds, compactness=1)

It’s probably worth making this more easily accessible, though. Thanks for the idea! :blush:

2 Likes

If you don’t have a marker for the cell boundary, a common method is to grow the region around the nuclei. As of scikit image v 0.19 there is the function expand_labels https://scikit-image.org/docs/dev/auto_examples/segmentation/plot_expand_labels.html

Thanks for linking the two functions, nice image.

Expand labels was not working last week when I tried but I had v0.18,
I will try 19. Thank you

expand_labels is in 0.18.0. Let us know if it’s not working for you for some reason!

Hi I checked it again with v18, strangely but happily its working now, thank you for encouraging me to try again

I get this error trying to use code you kindly provided,
what am i doing wrong?

You are passing in np.ones_like (a function) as the edge image, instead of np.ones_like(image), the result of applying that function to the image.

Ok thanks, sorry for the ignorance,
happy holidays!

typos/mistypes happen to the best of us! :sweat_smile: