Is there a way to segment cells based on membrane and nuclei fluorescence in FIJI?

Hi everyone!

I have pictures of cultured cells stained with WGA (membranes) and DAPI. I am interested in segmenting cells based on the membrane fluorescence, but also taking into account that there should be one nuclei per cell. I was looking for something similar to the CellProfiler detect primary and secondary structures, but I wanted to know if there was something like that in FIJI. Here’s an example of a picture I get:

The “Mophological segmentation” plugin of MorpholibJ does a fare job based only on the membrane fluorescence, but it doesn’t take into account the nuclei, so I get many incorrectly segmented cells.

Thanks a lot!
Ariel

1 Like

Hi @Ariel,

If you want to relate nuclei with their corresponding cytoplasm ROI I would recommend using CellProfiler (that will take care of this for you).
If you want to use ImageJ/Fiji, one option would be the following : make a mask of the cells, make a mask of the nuclei then calculate a Voronoi map from the nuclei mask, threshold the voronoi and substract it to the cell_mask.

You’ll find a code below that does it (plus some tricks because you used Magenta and Grays LUTs)

Cheers,

Romain

roiManager("reset");

selectWindow("WGA DAPI.jpg");
close("\\Others");
img_title = getTitle();


// you have made an RGB with gray and magenta,
// which is a bad idea because now hte cell staining is in all the channels
// try to keep independant colors (Red, Green, Blue)
// here is a trick
run("Duplicate...", "title=["+img_title+"]");
run("Split Channels");
imageCalculator("Subtract create 32-bit", "WGA DAPI.jpg (red)","WGA DAPI.jpg (green)");
rename("nuc");
nuc_ID = getImageID();


selectImage("WGA DAPI.jpg (green)");
rename("cell");
cell_ID = getImageID();


/*
 * Make a Mask of the Nuclei
 */
selectImage(nuc_ID)
setAutoThreshold("Default dark");
setOption("BlackBackground", true);
run("Convert to Mask");

// to clear a bit the nuclei mask
run("Median...", "radius=2");
run("Options...", "iterations=10 count=3 black edm=8-bit do=Close");
run("Watershed");// to split the nuclei BUT might cut in two some you don't want
run("Options...", "iterations=3 count=3 black edm=8-bit do=Erode");

//select nuclei_mask
run("Analyze Particles...", "add");

// here we make the Voronoi
run("Voronoi");
selectImage(nImages);
setThreshold(1, 255);
run("Convert to Mask");
voronoi_img = getTitle();

/*
 * Make a Mask of the cells
 */
selectImage(cell_ID);
setAutoThreshold("Huang dark");
run("Convert to Mask");
run("Median...", "radius=2");


// substract the Voronoi to the Cell mask
imageCalculator("Subtract create", "cell", voronoi_img);

//select cell_mask and detect cells 
run("Analyze Particles...", "add");

selectImage(img_title);
roiManager("Show All");
3 Likes

Hi Romain,

That was completely amazing, thanks a lot! I am quite new to this kind of analysis, I didn’t know the Voronoi function, it is super useful. My original image had the channels separated, I should have put that one instead of the JPEG. But the trick to separate the nuclei and the membrane channels from the JPEG is also super cool.

Thanks again for all the effort and the code!
Have a great weekend.
Cheers,
Ariel

@romainGuiet, as you suggested, I tried with CellProfiler, which I only knew a little bit, but had never really used it. Thanks so much!!

boom

3 Likes