What exactly does the "image calculation" feature do in FIJI/ImageJ?

Hi all,

I have a few confocal stacks that I need to analyze for a research project. I want to essentially measure the fluorescence intensities of cells in one channel using the “measure” command via hand drawn contours. However, there is some non-specific labeling of the antibody I used near the top of the confocal stack, which is not due to the antibody binding to the protein of interest. I found a way to remove this non-specific labeling by doing some fancy work with the “Image Calculator”, since another channel also co-labels the same cells. With the second channel, I subtract the first (generating a new channel with everything BUT the protein of interest), which I then subtract from the original channel.

Since the final channel (after the “Image Calculations”) is what I will be measuring intensities from for publication, I need to know precisely what the “Image Calculator” does. On the documentation for ImageJ, it simply states that an image calculator subtraction is Image = Image1 - Image2, but that doesn’t give me enough information for a publication. Is it literally subtracting the intensity values per pixel from image1 and image2? Or is it removing any pixels that are fluorescing in one image but not in the other according to some threshold? Wether it is doing the former vs. the latter determines whether I need to come up with a new analytical strategy or not.

If anyone has any deeper understanding of the image calculator I would be most appreciative. The other other option for me is to manually look into the code. Thanks!

1 Like

Hello Terry -

Yes, when you run Process > Image Calculator... and use
the “Subtract” operation, you get pixel-image1 - pixel-image2 on a
per-pixel basis.

You can check this by running the “Pixel Inspector” tool from the
Fiji / ImageJ toolbar to verify this (and any other details you want
to check).

Thanks, mm

1 Like

Hi @Tprins.

I would mainly trust the documentation. However, it depends a bit on the image type you are working with. For example, if you work with 8-bit images and you subtract a pixel with value 8 from a pixel with value 7, the result should be -1. However, 8-bit images don’t support negative values and thus, the result would be 0. Thus, in your particular case, 32-bit images should be preferred from a mathematical point of view.

I would raise another question: How do you know that the intensity in both channels is really the same? I assume the channels express intensities which were imaged with a different wavelength, right? How do you justify subtracting an image with wavelength X from an image with wavelength Y? Maybe a reviewer could raise such a question… :wink:

If you want to dig a bit in the code to find out what the Image Calculator is actually doing, the Image Calculator code is online. However, the actual operation is done by a so called “Blitter”. This blitter can for example be a FloatBlitter (for processing 32-bit float images). In that code you find the actual operation:

However, again for 8-bit images the ByteBlitter does it a bit differently, as explained above:

Let us know if this answers your question!


Thanks to both of you for such speedy and thorough replies. I think this gives me enough information to decide what to do going forward. Thanks!

Also, thanks again Robert for also indicating some publication concerns to consider. You rock!

1 Like