Cell tessellation

Hi,
I have the following image of an emulsion under the confocal. I need to detect the edges of the “cells” (droplets).

I am especially interested in the number of contact of each droplet “cell”, the length of each contact -which correspond to the brightest regions of the interfaces of the droplets-, and the volume (or in 2D here, surface) fraction of these droplets.
WTE750nM_005ns.tif (1.0 MB)

I just discovered Icy and the EpiTools seems to do something similar to what I am looking for, but I cannot get it to work on other data that the one given on the “Test”.
There is also the “Active Tessellation” plugin but so far I did not manage to install it in Icy.

I know FiJi a bit and I am “fluent” in Matlab.
Does anyone know how to run the tessellation on my image and get the characteristics of the network?

Thanks a ton

Hi
@LeChat
To get the contact limits: macro
Obviously it will be necessary to refine with:
-Analyze
-Set Measurements

A thresholding with Huang or Li allows you to have the bubbles.

run("Duplicate...", "title=1");
run("Duplicate...", "title=2");
run("Gaussian Blur...", "sigma=1");
setAutoThreshold("MaxEntropy dark");
//run("Threshold...");
//setThreshold(51, 255);
setOption("BlackBackground", true);
run("Convert to Mask");
run("Analyze Particles...");
run("Set Measurements...", "area bounding add redirect=None decimal=4");
run("Analyze Particles...", "display exclude add");
selectWindow("2");
roiManager("Show All without labels");
roiManager("Set Color", "red");
roiManager("Set Line Width", 0);

Hi @Mathew, thank you for your response.
I tried to run the macro you sent, also using the Huang, the Li, or even the Otsu threshold methods (Otsu seemed cleaner -less noisy- than the other two…?) but I cannot find a way to visualize the results nor export them.
Last, I did not manage to find a way to detect the droplets nor did I manage to get their respective geometrical properties.
Would it be possible to explain this with more details?

Ideally, I am looking for:

  • position and length of the contact patches (and if possible their respective mean intensity);
  • the tessellation (which I am guessing will be similar to a Voronoi’s), with each droplet’s edges coordinates, and therefore the number of neighbors and local volume fraction (computed with respect to the Voronoi cell for instance).
    Can I get this without the EpiTools plugin?

Thank you very much for your help and time.

Hi
@LeChat
I’m passing the macro to you. It’s up to you to do what you want. I hope it helps, a little …
To obtain the measurements of the quantities you want, you will have to “play” a little with the roiManager and setMesurement, and analysis.

macro "Bubbles"
{
requires("1.52u");
setBackgroundColor(0,0,0);
setOption("BlackBackground",true);
img=getImageID();
//-----------------------------
// Start batch mode
setBatchMode(true);
selectImage(img);
run("Duplicate...", "title=1");
close("\\Others");
run("Duplicate...", "title=2");
run("Duplicate...", "title=3");
//------------------------------------
// Start processing
run("Gaussian Blur...", "sigma=3");
setAutoThreshold("Li");
//run("Threshold...");
//setThreshold(0, 13);
run("Convert to Mask");
run("Set Measurements...", "area add redirect=None decimal=4");
run("Analyze Particles...", "size=5000-Infinity display exclude add");
n=roiManager("Count");
a=Array.getSequence(n);
roiManager("Select",a);
roiManager("Combine");
roiManager("Add");
roiManager("Delete");
roiManager("Select", 0);
run("Enlarge...", "enlarge=3");
roiManager("Update");
selectImage("1");
roiManager("Set Color", "green");
roiManager("Set Line Width", 0);
roiManager("Show All without labels");
run("Flatten");
close("3");
close("nResults");
roiManager("reset");
selectImage("2");
run("Gaussian Blur...", "sigma=1");
setAutoThreshold("MaxEntropy dark");
//run("Threshold...");
//setThreshold(51, 255);
setOption("BlackBackground", true);
run("Convert to Mask");
run("Set Measurements...", "area bounding add redirect=None decimal=4");
run("Analyze Particles...", "size=80-Infinity display exclude add");
roiManager("Set Fill Color", "red");
selectImage("1-1");
roiManager("Show All without labels");
run("Flatten");
// End of processing
// End of batch mode
setBatchMode(false);
close("Results");
exit("All is done !");
}

Can you tell me about your results, if you don’t mind.
Greetings

Hi @Mathew,
Thank you for sharing your macro.
Actually it seems that we are getting closer to the goal, namely getting the coordinates of the edges of the tessellation cells and the number of contacts for each droplet.

I added a couple of measurements to the one you output in your initial version of the macro. Now it is like this:

macro "Bubbles"
{
requires("1.52u");
setBackgroundColor(0,0,0);
setOption("BlackBackground",true);
img=getImageID();
//-----------------------------
// Start batch mode
setBatchMode(true);
selectImage(img);
run("Duplicate...", "title=1");
close("\\Others");
run("Duplicate...", "title=2");
run("Duplicate...", "title=3");
//------------------------------------
// Start processing
run("Gaussian Blur...", "sigma=3");
setAutoThreshold("Li");
//run("Threshold...");
//setThreshold(0, 13);
run("Convert to Mask");
run("Set Measurements...", "area mean centroid bounding fit shape feret's area_fraction add redirect=None decimal=4");
run("Analyze Particles...", "size=5000-Infinity display exclude add");
n=roiManager("Count");
a=Array.getSequence(n);
roiManager("Select",a);
roiManager("Combine");
roiManager("Add");
roiManager("Delete");
roiManager("Select", 0);
run("Enlarge...", "enlarge=3");
roiManager("Update");
selectImage("1");
roiManager("Set Color", "green");
roiManager("Set Line Width", 0);
roiManager("Show All without labels");
run("Flatten");
close("3");
close("nResults");
roiManager("reset");
selectImage("2");
run("Gaussian Blur...", "sigma=1");
setAutoThreshold("MaxEntropy dark");
//run("Threshold...");
//setThreshold(51, 255);
setOption("BlackBackground", true);
run("Convert to Mask");
run("Set Measurements...", "area mean centroid bounding fit shape feret's area_fraction add decimal=4");
run("Analyze Particles...", "size=80-Infinity display exclude add");
roiManager("Set Fill Color", "red");
selectImage("1-1");
roiManager("Show All without labels");
run("Flatten");
// End of processing
// End of batch mode
setBatchMode(false);
//close("Results");
exit("All is done !");
}
  1. I am not sure what the X, Y, BX, BY, FeretX and FeretY and FeretAngle… correspond to and how it relates to the cell edge coordinates and/or the contact patch coordinates.
  2. I believe the code here does not see the contact network per se, nor does it links interfaces to the given contact. I guess the next stage could be to tessellate? I was thinking of something like they do in Heller et al., Developmental Cell 2016, figure 5.

Thank you for your help and following-up,
All the best
WTE750nM_005ns_resultsBubble.zip.zip (1.1 MB)

1 Like

@LeChat

Have you read this?
https://imagej.nih.gov/ij/docs/guide/146-30.html#toc-Section-30

More precisely the paragraph: 30.7 Set Measurements…

1 Like

Thank you, I was actually digging into the doc!

Ok so the Feret diameter seems to give me the typical contact patch size, which is a first step.
Now I am looking to find a way to study the cells (droplets, bubbles…) contact network. Is there a built-in function in ImageJ of Fiji that allows for such a tessellation?

Did you use the forum search tool?

yes, I did search on the forum. Besides the SR-Tesseler which I tried with no success, I did not find anything.
EpiTools seems to be just what I need for the tesselation, but I cannot get it to work on another dataset than the one given in their Test example.
If you found an ImageJ (Fiji) plugin that does the work, I am obviously interested though :slight_smile:

Hello
I am not sure if you have solved this already but here is an option in Matlab. Apply a very large gaussian low pass filter

a=(watershed(imfilter(WTE750nM_005ns,fspecial(‘Gaussian’,[75 75],33),‘replicate’)));

And will get the cells, have a look at the result

Dear @creyes,
Thank you for your help. This is actually really nice, I manage to reproduce your images (albeit with different colors for the first graph of yours ; is the color related to a physical quantity?).

Now I am looking for a way in Matlab to do the Tessellation.
I understood that a, which is the result of the watershed transformation, is image with the cell borders, but so far I have not found a way to compute the tessellation of the other pixels (as groups corresponding to the cells).
I tried to computer the coordinates of all the non-zeros points of the image a ([ax,ay]=find(a~=0)) but when I run voronoi(ax, ay) it compute the tessellation of the whole pixels.

Would you have any insight for this tessellation?
Thank you for your help and advice.

Hello
The colours are randomly selected so no properties there. The tessellation itself (the lines that separate the cells?) can be obtained easily as well by taking the zeros of a:

imagesc(imdilate(a==0,ones(5)))
filename=‘tessellation_cells.png’;

tessellation_cells

Hi, thank you fr your response.
I believe what I was doing when using [ax,ay]=find(a~=0) was also giving me the same datapoint for the lines that separate the cells, wasn’t it?
I was wondering if there was a way to make each cell an object (which its edges are straight) which I could then study in terms of topology (for instance compute the average cell volume, the average number of contacts per cell, the local volume fraction by computing the volume of theses cells over the actual size of the initial droplets on the image…).
I was think doing a Voronoi of the inside points of each cells as a whole (for each cell) could be a solution to tessellate the image and create exploitable objects from this tessellation. Like what people seem to do with epithelial cells (like so: https://www.frontiersin.org/articles/10.3389/fphys.2016.00551/full
or like so even better, like so: https://www.cell.com/action/showPdf?pii=S1534-5807(15)00797-2 see Fig. 5, panels A-B-C-D)

Each of the cells is unique, that is why they have different colours, try imagesc(a==5), then you can get all the properties with regionprops.

I have written a book with many “recipes” of these type, perhaps you would like to take a look at these:

I think I am getting closer, thank you so much for your help.
Your book looks great, I especially need to go through the Chapter 7!
Using regionprops I manage to do the Voronoi tessellation (from the coordinates of the centroids), see picture attached. I will now study the contact network of these cells.
Thank you for your enlightening help!

Looking much better! But I would warn against Voronoi, look at the cells on the bottom, you are losing the real shapes of the cells. You can explore further regionprops and other tricks, you can get the perimeters of each cell separately and that would keep the real shapes and not the approximation of voronoi.

I am also a bit worried that my system is not really at equilibrium, considering the fact that the Voronoi cells are different from the tessellation cells obtained from the previous image processing…

Yes I agree, I meant using the Voronoi just for the neighbors counting, not for statistics on the area fractions and contacts size… But I guess I can just count all the neighbors for each “region” in order to get the contact network and also compute the average contact number per drop.
I will then measure the actual area of the drops and compare them with the corresponding “region” in order to have the area fraction of my sample.
I guess I can do all this with just algorithmic and regionprops

Thank you for your advice.

Hi @Mathew,
I have been trying to reuse the macro I saved from our previous exchanges, but it does not seem to run on my new dataset.
WTEimg3.tif (2.0 MB) (actually it is originated from a .lif file that contains many experiments and I changed the LUTs to gray and saved it into .tif -but I cannot save each of the 2 places separaterly-)

When I open the .tif and then launch the macro, it says that the ROI Manager is empty. I tried to do each command line separately but the image window just closes after execution of line 14.
I am not sure what is different between this image and the previous one you saw before and which seems to work…
If you have any idea, I would really appreciate your help.
Thank you!