odRatio
Top  Previous  Next

odRatio ( integer Input, integer Bright, integer Dark, integer Output )

Use this function to generate a floating point image whose pixels represent the optical density values.

In general, to generate the optical density image, two auxiliary images should be prepared: dark field and bright field. Dark field is a background image captured with no light transmitted through the camera lens, and the bright field is a background image captured with the maximum light transmitted (no specimen or objects in the filed of view). It is recommended to use the grabAvrg function to acquire background images. While capturing the bright field image, the user should adjust the light intensity so that it stays just below the saturation level of the camera. That will provide the maximum dynamic range for the image acquisition.

The resulting pixel values are based on the following formula:

odratio
where

Ix,y    is a pixel value of the original image
Bx,y    is a pixel value of the dark field image
Wx,y    is a pixel value of the bright field image
ODx,y    is a pixel value of the resulting Optical Density image


Parameters
 
Input  
 
An integer between 0 and 116 specifying the input image frame number. A value of 0 represents the DMA memory buffer of the video device. Values in the range of 100-116 correspond to hidden frames.  
 
Output  
 
An integer between 1 and 116 specifying the output image frame number. Values in the range of 100-116 correspond to hidden frames.  
 
Dark  
 
An integer between 0 and 116 specifying the number of the frame that contains a dark field image. Values in the range of 100-116 correspond to hidden frames. If this parameter is zero, only the bright field image will be used in calculations.  
 
Bright  
 
An integer between 0 and 116 specifying the number of the frame that contains a bright field image. Values in the range of 100-116 correspond to hidden frames.  
 
 
Error flags

ERR_OK  
 
The flag set if successful.  
 
ERR_FAILED  
 
The flag set if failed.  

Example

This set of statements prompts the user to capture a dark and white field, and then continuously generates an optical density image in frame #1.  
 
Dark=102  
Bright=101  
Print "Open Video window"  
Input "Press Enter to capture dark field"  
grabIm (Dark)   
Input "Press Enter to capture bright field"  
grabIm (Bright)  
Input "Press Enter to display corrected video"  
do  
 grabIm (100)  
 odRatio (100, 101, 102, 1)  
loop  
 
Example

To perform the OD measurements on the image generated by this function use linear intensity measurements (GrayAvrg, GraySD, GrayI, etc.) rather than their OD counterparts (OptdAvrg, OptdSD, OptdI). The latter will implement unnecessary logarithmic conversion, which is already done by odRatio. See the Measure section of ImageWarp User's Guide for more details.