Optical density- subtract background?

I’m trying to do optical density, using grayscale images. I’m wondering, if I do the image calibration with the background included (like in the instructions) do I still have to remove the background from the image? I’m only measuring small portions of the image, not the whole thing. If so, how do I do this? Thank you in advance for any assistance!

I’m not personally familiar with this, but I would like to be :wink: Could you please include an example image, show us what you mean by “small portions of the image” and more details about what you hope to achieve?



1 Like

Here is one of the images, of striatum. We figured out how to apply a grid, and we’re going to use a random number generator to choose 6 areas to measure for optical density. They will be located closer to the substantia nigra. We are trying to determine if there is a difference in dopamine between treated vs. untreated mice. Uploading… I know the tissue is poor quality, they were improperly stored but we’d like to try to see if we can get some useful data from them anyway. In the calibration step, the first measurement is “background”- but it doesn’t say whether that’s the unstained portion of the tissue, or the white slide background. And if we do that calibration step, do we need to “subtract the background”- what is that and how do we do it? From what I understand the calibration changes the image from black and white (0-255 values) to true grayscale, and when you do it the image info changes to reflect this.

doesn’t look like it uploaded, hang on a min

Uploading… Uploading… Ok it says uploading 100% and the little icon has been spinning for about ten minutes… not sure how to get it to work

Is it a tif file? Try uploading png.

Ok that worked! Thanks

1 Like

So this is tissue that is stained for dopamine? Or dopaminergic neurons? Darker areas contain more dopamine?

Stained for tyrosine hydroxylase as a proxy for dopamine production. There are no neural bodies per se in the striatum, just projections from the substantia nigra. Darker areas would be more dopamine production, yes.

Which protocol is this?

Well, the background is defined differently in different imaging protocols. If you can clearly define what the unstained portion is, then you can measure the mean in a segment of this portion and subtract this value from the full image (see image below). Or you could define the slide behind the tissue as the background, but a problem I see here is that your slide is unevenly illuminated. The bottom right corner is brighter than the top left corner…

You can also use a background subtraction algorithm, like the rolling ball. (tip: check ligth background, or invert your image.)

Try a few approaches and see what works.

Also, this grid you generate, does it also make boxes where there is no tissue? Or do you set it to the stained area. Maybe you can show us a picture of the grid overlay.

I remember now. Been stuck in the hippocampus for too long.

This is from ImageJ’s calibration instructions “The first step in calibrating the image is to measure the mean gray value of the background and the first 18 steps. We don’t measure the last three steps be because they are not distinguishable and also because the calibration function in ImageJ is currently limited to 20 measurements. Before starting, make sure the “Results” window is closed. Create a rectangular selection that fills most of one step without overlapping another step. Move the selection to the white background at the left end of the image and measure it. Then, starting at the left, move the selection and measure each of the first 18 steps.” The grid overlays the whole picture, it’s in the analyze–> tools–> grid. One thing I noticed is that the first time I tried it, it gave the grid in square cm, and the squares were very large, only 17 of them on the stained area. When I opened the next photo and did it again, it said the grid was in square inches, but they were very small, 65 squares on the stained area now. ?? I didn’t change anything? Also, I tried the calibration using the selection as in your photo for the background in the instructions. The mean gray values went from decimals to whole numbers, but comparing the two I picked- one .9 and one .4, the one that was .4 before is now higher than the one that was .9? I’m still selecting 6 areas from each. Could it be that the scale was changed, and the size of the areas?

Ah, I thought you were using the grid for your measurements, not background subtraction. Ok, I haven’t used this approach myself. Maybe I will have time to play with it tommorow if no one else chime in before then.

Well, I put on the grid, then use the number generator to select the areas, then measure them. I guess I just don’t understand that if I do the background step in the calibration, do I still have to subtract the background from the picture? Even if I’m not actively measuring it?

Personally I just use the rolling ball.

Well, you have to either subtract it from the picture or from your measurements. Also, how do you define which regions to measure?

Ok, so we have been trying to use the corpus callosum as the background in the calibration step (found some papers on that), then using the rolling ball to subtract the background before measuring. It seems to be giving less wild measurements, but I have to have my PI look to make sure. We are looking at the dorsal striatum, and from all the papers I can find, you can look at the different projections from other regions, or medium spiny neurons, but then they used a fairly arbitrary definition that looks like you basically go halfway up from the SN and then that’s dorsal, then you can split in half for dorsolateral/medial. My biggest concern now is that Image J is changing the scale on the grid and I can’t see any options to change it! When you open the dialog box, it will either say inches, or centimeters, and you can either check or uncheck the box but not change it anywhere that I can see. It varies from picture to picture and I’m not sure why; all the pictures are the same size and resolution. It will let you input the size of the grid- say, 1, 2, 3, units- but you can’t change the units. Any clues? Thanks for all your help also!

It uses the units defined in the image scale, as you can see at the top of your image:

Do your images have different units? Not all image formats save this scale… if you save as JPEG or PNG you will lose it. TIF on the other hand hangs on to the scale metadata!

You can change the units by changing the scale of the image in Analyze >> Set Scale.


I checked, and they’re all in inches. They are saved as TIF, so that should be ok. I noticed that our new ones aren’t the same size in inches, which I will have to correct? Not sure how that happened. I opened many pictures and checked the grid scale to see if it would do it again, and now it won’t do it, so it must have been some mistake on my part. One more question: in the analyze: set scale, all the pictures I opened have a default of 87.7 pixels/inch. Do you think it’s ok to use this, or should I try to find references of a preferred scale to use?

If this is what the metadata from the acquisition software gives you, stick to it :slight_smile: