How to select cells with both GFP and mCherry for stress granule counting

Dear Friends,
I have different types of HeLa cells (with GFP or mCherry or both) in Ch1 (for gfp) and Ch2 (for mch). I am interested in only those cells where both GFP and mCherry are present. I need these cells for stress granule counting. Can you please suggest how can I proceed for calculation positive cells (gfp+mch) with stress granules?

Thank you so much.
best regards,
NS

2 Likes

Hey @nir9,

would you mind sharing an example image so that we can guide you in the right direction? :upside_down_face:

Cheers,
Robert

Dear Robert,
Thank you very much for your concern. Yes, sure I am sharing the images.CH_GFP.tif (877.8 KB) CH_mCherry.tif (877.8 KB)

Thanks.
Nir9

Hey @nir9,

in Fiji, you can use blurring+thresholding to get rough contours of the cells in the two channels. Afterwards, use the Image Calculator to get the binary overlap (AND) of both binary images. Last but not least, the Particle Analyser allows you to define regions of interest. This macro can be a starting point:

open("C:/Users/rober/Downloads/CH_GFP.tif");
open("C:/Users/rober/Downloads/CH_mCherry.tif");

// duplicate mCherry image and segment it
run("Duplicate...", " ");
run("Gaussian Blur...", "sigma=15");
setAutoThreshold("Default dark");
setOption("BlackBackground", true);
run("Convert to Mask");

// select GFP and segment it
selectWindow("CH_GFP.tif");
setAutoThreshold("Default dark");
//run("Threshold...");
run("Gaussian Blur...", "sigma=15");
setAutoThreshold("Default dark");
run("Convert to Mask");

// select all pixels which are positive in GFP AND mCherry
imageCalculator("AND create", "CH_GFP.tif","CH_mCherry-1.tif");
selectWindow("Result of CH_GFP.tif");

// make Regions of interest
run("Analyze Particles...", "add");

// show result and close intermediate results
selectWindow("CH_mCherry.tif");
close("\\Others");
roiManager("Show None");
roiManager("Show All");

Does this help you?

Cheers,
Robert

Dear Robert,
Thank you so much for your help!
Can you please suggest further after this code if I want to distinguish which contains smaller granule? I need the number of mCherry-cells (with gfp already) containing granule/smaller particle. I can segment and count the individual granule but how I can give the relation of parent cells?

Thanks a lot!
best
Nir9

Let’s work together on it by sharing in both directions.

How do you segment and count them? If you share your macro, I can help you extending it :wink:

Cheers,
Robert

Here it is: (though I am not very satisfied with this, have to improve).

//Droplet counting

run(“16-bit”);

WindowTitle=getTitle()
selectWindow(getTitle());

run(“Duplicate…”, “title=duplicate1.TIF”);
run(“Smooth”);

run(“Threshold…”);
waitForUser(‘choose proper threshold and press Apply and ok’)´
run(“Convert to Mask”);
run(“Analyze Particles…”, “size=0.5-5 circularity=0.70-1.00 show=[Overlay Outlines] display exclude clear summarize record”);

Thanks.
best
Nirnay

Hey @nir9,

after the first step, cell segmentation, you can go through all ROIs in the ROImanager and analyse these rois in detail. For example, you can do so by multiplying all pixels outside of the ROI with 0.

open("C:/Users/rober/Downloads/CH_GFP.tif");
open("C:/Users/rober/Downloads/CH_mCherry.tif");

// duplicate mCherry image and segment it
run("Duplicate...", " ");
run("Gaussian Blur...", "sigma=15");
setAutoThreshold("Default dark");
setOption("BlackBackground", true);
run("Convert to Mask");

// select GFP and segment it
selectWindow("CH_GFP.tif");
setAutoThreshold("Default dark");
//run("Threshold...");
run("Gaussian Blur...", "sigma=15");
setAutoThreshold("Default dark");
run("Convert to Mask");

// select all pixels which are positive in GFP AND mCherry
imageCalculator("AND create", "CH_GFP.tif","CH_mCherry-1.tif");
selectWindow("Result of CH_GFP.tif");

// make Regions of interest
run("Analyze Particles...", "add");

// show result and close intermediate results
selectWindow("CH_mCherry.tif");
close("\\Others");

// go through all ROIs an search for objects inside
number_of_rois = roiManager("count");
for (r = 0; r < number_of_rois; r++) {
	// dupllicate the image to not screw up the original
	run("Duplicate...", "title=duplicate1.TIF");

	// remove noise
	run("Smooth");

	// remove background
	run("Subtract Background...", "rolling=25");

	// remove pixels outside ROIs
	roiManager("select", r);
	run("Make Inverse");
	run("Multiply...", "value=0");
	run("Make Inverse");

	// automatic threshold
	setAutoThreshold("Intermodes dark");
	setOption("BlackBackground", true);
	run("Convert to Mask");

	// find objects
	run("Analyze Particles...", "size=0.5-5 circularity=0.70-1.00 summarize record add ");

	// close duplicate image
	close();
}

// show all ROIs
roiManager("Show None");
roiManager("Show All");

Furthermore, be careful with manual thresholding - it is not reproducible. I can explain that to you in more detail if you like: https://youtu.be/LT8L3vSLQ2Q?t=1578

I hope that helps

Cheers,
Robert

2 Likes

Dear Robert,
That’s awsome! You are Great! Many many thanks to You for your kind help.
I will follow you on your channel.
:slightly_smiling_face: :ok_hand:
Thanks.
With best regards
Nirnay

1 Like

Hello Robert,
Can you please suggest me how to improve the code a bit more:

  1. Open and rename in a batch mode (need all ROIs information also)
  2. how I can do better segmentation of cells! You see here there are two cells. Capture|471x404

so far the code is like this:
//give the path and file name
open(“D:/Research/Experiment_Data/filename_gfp0000.tif”);
run(“Rename…”, “title=CH_GFP.tif”);

//change the file name only
open(“D:/Research/Experiment_Data/filename_mch0000.tif”);
run(“Rename…”, “title=CH_mCherry.tif”);

// duplicate mCherry image and segment it
run(“Duplicate…”, " ");
run(“Gaussian Blur…”, “sigma=15”);
setAutoThreshold(“Default dark”);
setOption(“BlackBackground”, true);
run(“Convert to Mask”);

// select GFP and segment it
selectWindow(“CH_GFP.tif”);
setAutoThreshold(“Default dark”);
//run(“Threshold…”);
run(“Gaussian Blur…”, “sigma=15”);
setAutoThreshold(“Default dark”);
run(“Convert to Mask”);

// select all pixels which are positive in GFP AND mCherry
imageCalculator(“AND create”, “CH_GFP.tif”,“CH_mCherry-1.tif”);
selectWindow(“Result of CH_GFP.tif”);

// make Regions of interest
run(“Analyze Particles…”, “add”);

// show result and close intermediate results
selectWindow(“CH_mCherry.tif”);
close("\Others");

// go through all ROIs an search for objects inside
number_of_rois = roiManager(“count”);
for (r = 0; r < number_of_rois; r++) {
// dupllicate the image to not screw up the original
run(“Duplicate…”, “title=duplicate1.TIF”);

// remove noise
run("Smooth");

// remove background
run("Subtract Background...", "rolling=25");

// remove pixels outside ROIs
roiManager("select", r);
run("Make Inverse");
run("Multiply...", "value=0");
run("Make Inverse");

// automatic threshold
setAutoThreshold("Intermodes dark");
setOption("BlackBackground", true);
run("Convert to Mask");

// find objects
run("Analyze Particles...", "size=0.2-6 circularity=0.50-1.00 summarize record add ");

// close duplicate image
close();

}

// show all ROIs
roiManager(“Show None”);
roiManager(“Show All”);

Thanks a lot!
best
Nirnay

Dear All,
Can anyone please help me to improve the code? My goal is to segment first mcheery cell and then gfp cell. Then and operation to select the cells which have both gfp and mcherry. Then select the cells one by one for detecting droplets or SGs. My problem is that I could not optimize any proper threshold which will work for all. I shared some cells and my code. I will be highly obliged if someone can help. Thank you very much.daa_test.zip (2.4 MB)

following is my code (I would like to acknowledge Dr. Robert Haase for helping to improve the code few months ago and also his Bio-Image Analysis course in youtube helps a lot to learn):

@String(value=“calibrate image”,visibility=“MESSAGE”) hint
@double(label=“distance in pixel”) pixel
@double(label=“known distance(micron)”) micron
@String(choices={“Gaussian Blur…”,“Meadian…”},style=“list”) filter
@double(value=10,min=2,max=100,style=“slider”) sigmamCh
@double(value=10,min=2,max=100,style=“slider”) sigmaGFP
@double(value=400,min=200,max=500,style=“slider”) cellminsize
@double(value=0.5,min=0,max=5,stepSize=0.1,style=“slider”) SGminsize
@double(value=1,min=2,max=40,style=“slider”) SGmaxsize

//Count cells which are common in both GFP and mCherry Ch and analysis the droplet/SGs in mCherry Ch. @ Dr. Nirnay Samanta
// close all images
run(“Close All”);
//clearing ROI manager before run
if (roiManager(“count”)>0) {
roiManager(“deselect”);
roiManager(“Delete”);
}
//------------------------------------------------------------------------------------------------------------INPUT1
//give the path and file name for Ch:gfp
open(“C:/Users/mail2/Desktop/daa_test/gfp0001.tif”);

//give proper value distance=?(in pixel) known=?(in micron)
run(“Set Scale…”, “distance=”+pixel+" known="+micron+" pixel=1 unit=micron");
run(“Rename…”, “title=CH_GFP.tif”);

//give the path and file name for Ch:mch-----------------------------------------------------------------------INPUT2
open(“C:/Users/mail2/Desktop/daa_test/mch0001.tif”);

//give proper value distance=?(in pixel) known=?(in micron)
run(“Set Scale…”, “distance=”+pixel+" known="+micron+" pixel=1 unit=micron");
run(“Rename…”, “title=CH_mCherry.tif”);

// duplicate mCherry image and segment it**************************************************************************
run(“Duplicate…”, " ");
//run(“Subtract Background…”, “rolling=2”);
if(filter==“Gaussian Blur…”){
run(“Gaussian Blur…”, “sigma=sigmamCh”);
} else {
run(“Median…”, “radius=sigmavalue”);
}

setAutoThreshold(“Huang dark”);
//run(“Threshold…”);
waitForUser(“is it okay?”);
setOption(“BlackBackground”, true);
run(“Convert to Mask”);
run(“Watershed”);
//waitForUser(“is it okay?”);

// select GFP and segment it*************************************************************************************
selectWindow(“CH_GFP.tif”);
run(“Subtract Background…”, “rolling=2”);
run(“Gaussian Blur…”, “sigma=sigmaGFP”);
setAutoThreshold(“Default dark”);
waitForUser(“choose threshold”);
setOption(“BlackBackground”, true);
run(“Convert to Mask”);
run(“Watershed”);
waitForUser(“is it okay?”);

// select all pixels which are positive in GFP AND mCherry
imageCalculator(“AND create”, “CH_GFP.tif”,“CH_mCherry-1.tif”);
selectWindow(“Result of CH_GFP.tif”);

// make Regions of interest, Input cell size-----------------------------------------------------------
run(“Analyze Particles…”, “size=”+cellminsize+"-Infinity circularity=0.0-1.00 exclude add");

// show result and close intermediate results
selectWindow(“CH_mCherry.tif”);
close("\Others");

// go through all ROIs and search for objects inside
number_of_rois = roiManager(“count”);
for (r = 0; r < number_of_rois; r++) {
// dupllicate the image to not screw up the original
run(“Duplicate…”, “title=duplicate1.TIF”);

// remove noise
run("Smooth");

// remove background
run("Subtract Background...", "rolling=20");

// remove pixels outside ROIs
roiManager("select", r);
run("Make Inverse");
run("Multiply...", "value=0");
run("Make Inverse");

// automatic threshold*************************************************************************************
setAutoThreshold("MaxEntropy dark");
setOption("BlackBackground", true);
run("Convert to Mask");

// find objects for SGs*************************************************************************************
run("Analyze Particles...", "size="+SGminsize+"-"+SGmaxsize+" circularity=0.25-1.00 summarize record add");

// close duplicate image
close();

}
// show all ROIs
roiManager(“Show None”);
roiManager(“Show All”);
roiManager(“Show None”);

//measure each cell and droplet intensity
//number_of_rois = roiManager(“count”);
//for (i = 0; i < number_of_rois; i++) {
//roiManager(“select”, i);
//roiManager(“Measure”);
//}

Hi there,
I apologize, I cannot help with the coding aspect of this, although after reading this thread I was wondering if you would be able to help me by including the pipeline you used for this. I am running a similar experiment but struggle with the coding aspect of CellProfiler.
Would be greatly appreciated to help me get started! Thanks so much!

Sophia

Hi @srfranco,

This similar workflow could be absolutely be performed with CellProfiler. If your image sets would resemble the images that is been shared in this thread, you could go ahead as follows,

  1. Segment the cells from both the channels GFP & mCherry.
  2. If there is a difference in the intensity levels between both type of cells, then you could use it to classify the segmented cells.
    You could start with basic pipelines in the example page. If you are new to CP, you could watch the workshop here & download quick start guide here.

In case you could share your initial pipeline & the sample images we could help you better.

Regards,
Lakshmi
www.wakoautomation.com

Dear Lakshmi,
Thanks for your suggestions. I tried Cell profiler for the single-channel image, it really good to extract information for SGs. Though thresholding to detect objects gives trouble. Would you mind to suggest how can I filter objects so that it only chooses the cells which has both GFP and mCherry. I tried image AND operation, did not work.
What would be your opinion.

Thank you very much.
best,
Nirnay

Hi @nir9,

Good. I was suggesting to filter based on the intensity of the cells. So, once you segment cells compute the intensity using “MeasureObjectIntensity” module. From that result, you can use any of the parameters for eg. Mean intensity to filter your objects using “FilterObjects” module. Please refer to example “Segmentation & Classification…based on size” in this link for the usage of those modules. There instead of intensity we would have used Area to filter the objects based on its size.
Hope this works.

Regards,
Lakshmi