Getting Fluorescence values of Pixels

Hey everyone, I was wondering if any of you could help me with something. I am very new at imaging with almost no training in how to use the software to analysis the images that I get so I could really use some help with this. I am trying to reproduce the following technique from a paper I found:
“Based on the fluorescence images the fraction of pixels with fluorescence values higher than two standard deviations of background was calculated for all slices from each animal.”

I have no idea how I would go about doing this but my boss wants me to get it done, can any of you point me in the right direction?

P.S. Since I am very new at this, do any of you know of a good tutorial online that might help me understand how to use imaging software?

Thank you!

Hi Franklin,

In my opinion, this document from Peter Bankhead is really good when it comes to analysing fluorescence microscopy images using Fiji. It’s a bit long, but it really explains the basic concepts and goes on to some more advanced tools, with many example and exercises.

For your question, the other people here may have a much better answer than me, but I don’t know a plugin that does that already and I would suggest a basic manual method:

Open your image. Duplicate the first slice with Image>Duplicate unchecking the “duplicate stack” box. Open Analyze>Histogram (shortcut h). Under the histogram, you will have several statistics, including the standard deviation (StdDev). Also write down the Count, which is the total number of pixels in the image. Select your image, then go to Image>Type>32-bit. Now open Image>Adjust>Threshold… (shortcut shift+T). In the threshold window, click on “set”. For the lower threshold level, choose twice the StdDev, for the Upper one, leave the value (which is the highest value of a pixel in your image). Click OK, then click Apply in the Threshold window, then OK to “set background to NaN”. Now, in your image, all the pixels lower than 2*StdDev have been replaced by the value NaN (Not a Number), which isn’t taken into account in the statistics. So just open the histogram again, and look at the Count: you now have the number of pixels above the threshold value, you just need to divide it by the previous count (that you wrote down before), and you’re done.

NaN exists only for 32-bit images, that’s why we needed to convert it. Remember to always keep your raw, initial image somewhere, and do not overwrite it with a modified version.

Depending on the type of animal that you try to image (e.g. a worm moving on a plate), you might not want to compare the number of pixels above threshold to the number in the entire image. You will first need to segment your image, to distinguish the pixels that are in the animal from the background. A simple threshold could be enough (what we did just before), so that you set all the background pixels to NaN, measure the Count and StdDev in the animal, then set a new threshold at 2*StdDev and measure the new Count. However, depending on your images, segmenting is not always easy, you can post an example image here if you need advice.

If this works as wanted, and once you’ve got used to analysing your image, you may want to automatize it with a macro. Instead of using the histogram, you could just use the getStatistics function, and use setSlice and nSlices to treat the whole stack.

That should give you something like:

run("Clear Results");
imageName = getTitle();

for(slice=1; slice<nSlices+1; slice++){
    setSlice(slice);
    run("32-bit");
    getStatistics(areaWholeImage, mean, min, max, std);
    setThreshold(2*std, max);
    run("NaN Background");
    getStatistics(areaHighFluo);
    fraction = 100*areaHighFluo/areaWholeImage;

    setResult("image", nResults, imageName);
    setResult("fraction", nResults-1, fraction);
}
4 Likes

Thanks Alex, I had totally forgotten about that document. We need to get that book linked prominently from imagej.net! @etadobson @hinerm Any ideas about the best place to link it? I’m thinking it might deserve its own link between “User Guide” and “Tutorials” in the left sidebar. It is that good.

1 Like

@ctrueden @hinerm — I am linking it right now - just including it in the User Guides page… http://imagej.net/User_Guide Perhaps we will find a better home for this amazing document in time… but just want to get it out there ASAP for users - because it’s great!

1 Like

Thank you @etarena! For now I think it is great to have it listed next to the ImageJ User Guide at http://imagej.net/User_Guides. Makes it much more visible for everyone.

1 Like