Jason Wong wrote:
Hi, I’m trying to figure out how to use Photoshop for scientific image analysis purposes. I’m doing some neuroscience research, and what I need to analyze is the intensity in certain brain regions created by a specific staining technique. So what I was thinking of doing is using the square marquee of Fixed Size to anaylze a square from Region A, and compare that to a same area in Region B. What confuses me the most is if I do Image –> Histogram, the value for Mean seems to be inversly proportional to the staining intensity.
i.e., if the region is darkly stained I get a small Mean value and
vice versa.
Does anyone know what I’m talking about? Is there a specific formula I would use in order to determin the relative optical density of a certain region? Any help would be greatly appreciated!
I’ve been thinking some more about this.
Most, if not all, of the replies to your question have concentrated on the numeric conversion of RGB values to density. This response is centered on your need to calculate the average density of a selected area, thereby getting the value of the total amount of stain absorbed by a particular area of a cell.
Density is minus the log of the fraction of transmitted light, aka transparency. For example, clear film would have a transparencyof 1.0 and a density of -log(1.0) = 0.0. An area of film that transmits 1/100 of the light would have a density of -log(.01) = 2.0.
In black and white film density is proportional to the mass of silver per unit area, and this corresponds to your goal of measuring the mass of stain absorbed in a particular area of the cell. I cannot think of an exact way to do this in Photoshop because it deals in luminance directly, and not the log of luminance.
1) avoid gamma issues by converting the image to Lab mode.
2) You will need to calibrate the luminance values by matching a couple of density points, using using a specimen with known density values. This amounts to subtracting the background density from your measurements, and scaling to match a maximum density. Once this is done, you may read luminance values from your 50% means a 50% tranaparency value, or a density of -log(.5) = .30
3) selecting an area with the lasso will .cause Image>Histogram to display the average percent lightness of that area.
4) Subtracting that number from 100 and taking the log will give you an accurate density only if the stain for that area is uniform. If there is much variation in density, the result will be only an approximate average density.
Unfortunately, at the end of the day, the density number yielded by this method is based on an average transparency, and not an average density.
The problem with that is this. Consider a stained area consisting of a checkerboard of .1 and 1.0 transparency , corresponding to density values of
1.0 and 0.0, respectively. The average transparency will be .55, and the
density calculated from this would be -log(.55) = .25, and not the correct value of .5. If your subject does not vary much in density, the numbers just might be accurate enough using this method. My guess is not.
One solution to this is to save the image as a 16 bit grayscale (the raw file format is probably easiest to deal with), and write a C or Visual Basic program to take the logs. You may then open this image in Photoshop, and use the histogram tool to measure density values directly.
Another solution would be to have a custom plugin written to do this calculation. If this is a university setting, and you have student cycles available this could be very reasonable solution to your problem. Or hire a summer student.
There is also a Macintosh only program called NIH image that will do a variety of quantitative measurements of images:
see <
http://rsb.info.nih.gov/nih-image/>
—
Mike Russell
http://www.curvemeister.com http://www.zocalo.net/~mgr http://geigy.2y.net