Ratiometric z stack

I would like to know if someone can help me to try to ratiometric analysis of a Z stack.
I have 2 channel of 20 image (16 bit) (please, see attached Max projection of channel 3 =C3 and channel 1=C1) I want to do a ratio between them.
After background subtraction and median filter , I try to Divide my channel 3 by channel 1, with the image calculator tool on FIJI. However, as a result I got an image which I cannot use for analysis (please see attached the figure: Montage Ratio 32 bit z stack).
I try to use max intensity of each channel and the result is the same a strange artifact that I cannot I figure it out (please, see attached figure: MAX ratio). I thought that if I can use a binary mask of 1 channel and multiply the stack I can solve the problem but still does not work properly.
Finally, I tried to use the plugin Ratio Plus but also did not work. I used the Max intensity projection to measure the mean background and use it in the plugin. I used as Stack 1 my Channel 3 and Stack 2 my channel 1, multiplication factor 10 or 100 and I did not get a good result.
I hope someone can help me with this doubt.
Thanks in advance,
Pablo M

Hi @Pablo_M,

I don’t see any images, please try to upload them again or share a link to dropbox/googledrive.

You may need to threshold the images to get a sensible results so that the background does not resemble the foreground, something you need to consider when you are dividing images (100/50 and 0.1/0.05 both =2). And when you are doing background subtraction or any other processing on one channel, make sure the other channel receives the exact same treatment, or you could get false results in your ratio image.


Hi @Sverre
Thank you for your comment. I upload the images again but in JPG because on tif format, did not work. The original file on tif is here https://drive.google.com/open?id=1uRPKpmPXQBrKkasE2cQqjGWWS51I9LE2
I am doing background subtraction or median in both channels previous to the ratio but still, I see aberrants results.
So, I have this doubt regarding threshold. If I have a z stack. How can I threshold the images?
I was thinking to use the -z project tool- and projected the average intensity of each channel, do the threshold and divide by 255 to have a binary mask, then multiply this mask against the z stack (each mask per its correspondent channel) and then do the ratio.
I do not know if this is correct.

You can either threshold very gently to get a rough outline of the cell, or apply more advanced and more reproducible segmentation techniques. For my own FRET projects I used the trainable WEKA segmentation plugin to label the relevant cells.

With conservative thresholding you get something like this:

(Sum slices projection, 95% threshold applied to both channels. CH2/CH1, 32bit float output)


Thank you Sverre, I am going to go ahead and try your recommendation and let you know how does it work. Thanks again for the help

Hi Sverre,
I’m trying to do something similar with Pablo, and in my try to simulate what you did here (using Pablo’s images as test files), can’t reproduce it. I’m only getting what Pablo did at the beginning. I really don’t understand the thresholding part of the workflow. Can you be more specific on how to achieve the final result?

Thanks in advance

1 Like

I am still trying to get good images . I am also having problem with the threshold part. I am trying to learn how to use the weka segmentation but it is not so easy to use (at least for me).

Hi Pablo,
found this link Ratiometric Imaging and followed the workflow… it worked… at least for me… try it and hope it helps


Hi @beholder2572,

I applied a manual threshold like this (image), and when prompted set all thresholded pixels to NaN (in a 32-bit image):

I then used the image calculator to divide c3 by c1. Here is what the recorded macro looks like:

selectWindow("C1 max.jpg");
setAutoThreshold("Default dark");
run("NaN Background");

selectWindow("C3 max.jpg");
setAutoThreshold("Default dark");
run("NaN Background");

imageCalculator("Divide create 32-bit", "C3 max.jpg","C1 max.jpg");
selectWindow("Result of C3 max.jpg");
run("Rainbow RGB");
setMinAndMax(0.4000, 2.0000);
run("Calibration Bar...");

Edit: Note that I used the raw data from @beholder2572 and that I used (for my original post) a sum slices projection, not a maximum projection. A maximum projection gives you the brightest pixel in x,y from any z position, sum slices is simply the sum of all x,y across z.

1 Like

Thank you very much Mike. I will try it.
Thanks again

Sverre, thanks for the input. It makes more sense now. That’s very similar to the link I posted above…

FYI: I always thought that max projection was the sum of all slices in one level… food for thought :slight_smile:

1 Like

Thanks for the instruction Sverre. I really appreciated your help.

Hey Mike
I managed to do some ratiometric imaging with the suggestion that you sent. However the last part to eliminate the infinity pixel I cannot make it work. How do you do the mask to eliminate the NaN or infinity numbers? Now I have to analyze the image regarding time, not in z stack ,as the example but the last part is giving odd numbers and not image just dots.
Can you help me with this since you could do it ?

Pablo hi,
sorry for the delay but you caught me in a really busy time. If you don’t mind waiting a few days, I’ll have an answer for you next week cause I have to look again at my workflow and tell you what I did.


No problem, whenever you can, thank you for your time

Hello Pablo
in the pdf is the macro I used to make my ratio images… the part with the red letters is the one that allowed me to remove the infinity pixels… it is the NaN backgroud… from my understanding you need a 32bit image… and I just put the top slider far left and just one click to the right and the slider below far right… when i press apply it asks me if I want to remove NaN… I don’t know if that helps


Ratio macro.pdf (216.6 KB)

Thank you very much, Michael. I really appreciated