Photogtaphy Forums

Photography Forums > Photography Newsgroups > Software Archive > Photoshop Tutorials > Densitometry (or relative optical density)

Reply
Thread Tools Display Modes

Densitometry (or relative optical density)

 
 
Jason Wong
Guest
Posts: n/a

 
      08-01-2003, 03:57 PM
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!

-- Jason

 
Reply With Quote
 
 
 
 
John Stafford
Guest
Posts: n/a

 
      08-01-2003, 06:21 PM
Jason Wong wrote:
> Hi, I'm trying to figure out how to use Photoshop for scientific image
> analysis purposes. [...]


Might this program be helpfull? I don't know.
http://www.reindeergraphics.com/foveapro/classify.shtml

 
Reply With Quote
 
 
 
 
Mike Russell
Guest
Posts: n/a

 
      08-01-2003, 08:06 PM
Don wrote:
> The number you are reading is the brightness of the spot from 0-255,
> not the density. The density in absolute terms is therefore
> porportional to the inverse of the number, or in density numbers to
> the log(10) of the inverse of the number/255.


Correct. Also, don't forget gamma. This is an exponential funciton applied
to the data before it is displayed. In practical terms this means an image
value of 128 will be somewhat darker than 50% intensty.

You may set a custom working space with a gamma of 1.0 to eliminate this.

--

Mike Russell
http://www.curvemeister.com
http://www.zocalo.net/~mgr
http://geigy.2y.net


 
Reply With Quote
 
Jason Wong
Guest
Posts: n/a

 
      08-02-2003, 12:07 AM
Well Fovea Pro sounds like a great program but at $800 I don't think I
can afford it! Is there no other way to do this manually? Like as
someone said before can I take the log of the intensity to get
density?
 
Reply With Quote
 
Bart van der Wolf
Guest
Posts: n/a

 
      08-02-2003, 12:47 AM

"Jason Wong" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Well Fovea Pro sounds like a great program but at $800 I don't think I
> can afford it! Is there no other way to do this manually? Like as
> someone said before can I take the log of the intensity to get
> density?


Photoshop unfortunately only reports in 8-bit/channel values, even for (15
or) 16-b/ch values. So you are limited to a relative (to the brightest
pixel) Optical Density range of 0.0-2.4 . If that is enough for your
purpose, there seems to be no other way than calculating by hand, or using a
look-up table. As mentioned, make sure the image data is in Gamma 1 space.

Maybe, I'm not sure because my trial period expired, Picture Window (Pro for
16-b/ch) has such a functionality? Check http://www.dl-c.com for details.

Bart


 
Reply With Quote
 
Timo Autiokari
Guest
Posts: n/a

 
      08-03-2003, 06:09 PM
Jason Wong <(E-Mail Removed)> wrote:

>Hi, I'm trying to figure out how to use Photoshop
>for scientific image analysis purposes.


Photoshop has some "enhancements" that makes it is rather difficult to
utilize it for scientific purposes.

>I need to analyze is the intensity in certain brain
>regions created by a specific staining technique.


What is it that gives the "intensities"? X-ray film or something else?


>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.


The relation depends on the working-space gamma, among other things.

>i.e., if the region is darkly stained I
>get a small Mean value and vice versa.


Yes, the relative whitepoint is RGB=255,255,255, from there on it gets
darker and darker as you approach to level RGB=0,0,0.

>Is there a specific formula I would use in order
>to determin the relative optical density of a
>certain region?


Yes there is but one needs to know what the source is, it has to have a
known relation to density in the first place.

Timo Autiokari http://www.aim-dtp.net
 
Reply With Quote
 
Tom Nelson
Guest
Posts: n/a

 
      08-04-2003, 06:04 PM
In article <SPvXa.63741$uu5.6238@sccrnsc04>, Leonard Evens
<(E-Mail Removed)> wrote:

> Photoshop starts with values in the range 0..255 (for each channel)
> obtained from some source. That source could be a digital camera or
> more likely in your case a scanner used to scan the Xray film. One
> would have to know just what that device is doing in creating the values
> 0..255. For example, Vuescan used in conjunction with one of the
> standard film scanners can actually show what Ed Hamrick tells us is the
> density of the film at each point in the scan. I haven't checked
> with a densitometer to see if his values are accurate, but they
> certainly seem to be in the right ball park of what I would expect. But
> his software, as does any scanning software, converts the density values
> to RGB values in the range 0..255. How it does it depends on some
> parameters, including the white and black points and a value of gamma.
> Since the aim in scanning is to get a usable image, whatever the density
> range in the source, it is going to be difficult to relate the latter
> values to density.


Most scanning software allows you to save scanning parameters. Might
you prepare a slide with the maximum possible stain next to an
unstained area? You could relate those densities to 0 and 255,
respectively, and use that setting for your test slides.
Tom Nelson
Tom Nelson Photography
 
Reply With Quote
 
Mike Russell
Guest
Posts: n/a

 
      08-04-2003, 08:08 PM
> 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


 
Reply With Quote
 
Jason Wong
Guest
Posts: n/a

 
      08-11-2003, 07:13 PM
Thanks everyone for the helpful replies. However I'm still a little
befuddled and confused as to what to do... I've switched to trying to
learn ImageJ, a java based image analysis program which is the PC
version of NIH Image (produced by the National Institute of Health).
But I think I'm back to where I started, basically I don't think I can
convert my mean values to density without some kind of calibration
step tablet or something like that. Here's a copy of the message I
just wrote to two other forums for help with ImageJ. Hopefully this
will clear up what I wanted to do and maybe someone can tell me how to
do it (easily preferrably!) in either photoshop or ImageJ. Thanks!

----

Hello, I'm trying to analyze hippocampal brain slices which I have
been immunostained for a neuronal marker (SNAP-25). All areas of the
slice in which synaptic connections are occurring are stained brown,
so the only unstained areas are where no tissue exists or where cell
bodies are located. The hippocampus is composed of several regions of
different neuron types (e.g. CA1, CA3, dentate gyrus), which are
clearly demarked using this stain by differential staining
intensities. However due to difficulties with the staining protocol,
staining intensities were not uniform from day to day, brain to brain,
and even parallel slice to slice. So to normalize this, I'm going to
be dealing with ratios between one hippocampal region and another.

So far I've converted my RGB images to 8-bit grayscale by selecting
Image -> Type -> 8-bit. I then openned up an image of a scale bar
used to set the scale by selecting Analyze -> Set Scale. Next I drew
a rectangle area selection tool to draw a square of fixed area (88
squared pixels). I then moved the square to the CA1 region, and
recorded the mean gray value by selecting Analyze -> Measure. Finally
I moved the selection square to record the mean gray value for a total
of 3 regions per image.

What I'm mostly confused with is what the mean gray value actually
MEANS. For the darker regions, I get a lower mean value but for the
lighter regions, I get a greater one. That seems to go against what I
would think of intuitively of what I actually want -- which is pixel
density. So if region A is darker than region C, I'd get a larger
value for region A. Final analysis would involve taking the ration of
A to C and comparing it with another region, such as B to C.

Someone mentioned something about calibrating my images. I'm not too
sure what this means or entails, but I don't think I have access to a
calibrated optical density step tablet. I don't know if that would
help either because each image I took might have slight changes in
brightness as I often fiddled around with the imaging system to
produce the best "looking" picture. But I figure the ratios idea will
help solve that dilema.

If anyone can understand what I'm trying to do and give me some help,
please please please do! Thank you
 
Reply With Quote
 
Bart van der Wolf
Guest
Posts: n/a

 
      08-11-2003, 08:08 PM

"Jason Wong" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
SNIPped introduction
> So far I've converted my RGB images to 8-bit grayscale by selecting
> Image -> Type -> 8-bit. I then openned up an image of a scale bar
> used to set the scale by selecting Analyze -> Set Scale. Next I drew
> a rectangle area selection tool to draw a square of fixed area (88
> squared pixels). I then moved the square to the CA1 region, and
> recorded the mean gray value by selecting Analyze -> Measure. Finally
> I moved the selection square to record the mean gray value for a total
> of 3 regions per image.


Okay, you have now RGB Gray values. As far as I can see, all ImageJ (just
like
Photoshop) does when you convert to 8-bit is take the unweighted average or
mean (R+G+B)/3. These RGB values are a sort of brightness (higher values are
brighter) on a scale from 0 to 255.

> What I'm mostly confused with is what the mean gray value actually
> MEANS. For the darker regions, I get a lower mean value but for the
> lighter regions, I get a greater one. That seems to go against what I
> would think of intuitively of what I actually want -- which is pixel
> density. So if region A is darker than region C, I'd get a larger
> value for region A. Final analysis would involve taking the ration of
> A to C and comparing it with another region, such as B to C.


You seem to be looking for Optical Density values, which would then be
calculated as D=Log10(255/measured), assuming the brightest value in the
image equals 255. This would give higher density values for darker tones, on
a logarithmic scale, and the difference of two values in Log space is the
same as a ratio in Linear space.

> Someone mentioned something about calibrating my images. I'm not too
> sure what this means or entails, but I don't think I have access to a
> calibrated optical density step tablet.


The best you can do with the above approach, is Relative density and not
Absolute density. Relative density to a lightest measurement of 255 only
gives a range of 2.4 density but that may be enough for your purpose.
Because you only have 255 logarithmicly spaced values you will create gaps
in the range at one end, and loss of precision at the other. Calibration
only offers to get Absolute density instead of Relative density.

Hope that helps a bit.

Bart


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Vegas 7 relative noob, rendering evil / end result stuttering aaaa rrieaa sefifjls Professional Video Production 2 02-07-2007 09:03 PM
Color management - "relative calorimetric" intent being ignored? James Photoshop 0 08-25-2005 09:16 AM
Scaling accurately to relative sizes. Jefferis Peterson Photoshop 16 09-16-2004 06:16 AM
Scaling accurately to relative sizes. Jefferis Peterson Photoshop 0 09-15-2004 01:41 AM
Densitometry (or relative optical density) Jason Wong Photoshop 10 08-11-2003 08:08 PM