ISB imaging module
Dave Orendorff
8/31/04
USER DOCUMENTATION
POGO VISION
This software was written to complement Pogo, a
suite for controlling the creation of micro arrays for oligonucleotide
synthesis.
A camera is mounted over the synthesis slide. After
each round of droplets is applied, the slide is positioned under the camera.
This is where the VISION module begins to work.
The primary purpose of the DLL is to make certain
that the droplets are printed correctly. This is achieved through a serial
process of functions.
2.
Image Processing(optional)
3.
Spot finding
4.
Image saving (optional)
5.
Handy functions (optional) – can be used anytime
during the process.
Vision
interfaces through Iwan Ulrich’s 1394Camera.dll. See API documentation
for how to change the camera settings. The two relevant functions are:
PhotographBlank()
snaps a photo of the blank images used for
flattening (optional)
PhotographSpots()
snaps a photo that will be put into the ‘buffer’
which will later be used for image analysis.
Nothing needs to be done before calling these functions. There is a working ‘buffer’ in which these images are stored. Therefore, calling them repeatedly without saving will result in the loss of data.
2. Image
Processing(optional):
After the photograph has been taken is the time to do any large-scale modifications to the image in the buffer. The functions are:
ApplyFlattening()
if a blank snapshot was taken this is the place to apply that image to ‘clean’ the buffer image. This function should be called before the other processing functions because the blank image cannot be processed. It uses the formula:
newPixel = MAX _INTENSITY *
(oldPixel / blankPixel)
ApplyGamma(int x)
apply gamma correction to the image in the buffer
using the formula:
newPixel = Normalized(oldPixel ^ x)
* the Normalize procedure makes it so that the new image will fill the entire range of possible pixel values.
FlipSpots(bool flipHorizontal, bool flipVertical)
flip the image in the buffer over the vertical and horizontal axis as described by the parameters.
When testing, these functions executed quickly (less than 50 ms.) on a standard image.
This is
where the intelligence of VISION starts to show. For a detailed algorithm of
how the spots are found see the API documentation.
Before
spots can be found and analyzed on the buffer image, some initial parameters
need to be set.
Pre-spotfinding functions:
Both functions must
be called upon first use, and they must be called later if the image
geometry changes.
SetRegion(top, left, bottom, right, numSpotsX,
numSpotsY)
This function effectively creates the ‘grid’ of
spots to be analyzed. The first 4 parameters specify the pixel coordinates of
the ‘box’, which will make up the grid. The last two parameters say how many
sections the grid will have in the x and y directions. The GetUserCreatedRectangle
function helps in automating the task of setting up these parameters.
SetSpotFinderParameters(long MinRadius, long MaxRadius)
Starts the spotfinding engine. For details see the API documentation. Min and Max radii do not need to cover the range of every expected size of pixel. Additionally, they may be over estimated by 1-2 pixels(due to how the spotfinder works). So, if you are expecting a range of radii starting at 3, try plugging in 4.
The initializations need to be called for subsequent
image analysis only if the dimensions change.
Spotfinding function:
GetFeatureInfo(long row, long col, long &dx, long &dy, long &area, long &quality)
gives the offcenter, area and quality of the spot found on the specified row and col. This information is passed through reference parameters. The quality is arbitrary, though consistent and based on roundness and contrast.
It can be useful to maintain an archive of the printing
process on hard disk. Since the slide is too large to be photographed at one
time, the files are saved as a composite(Meta) image onto disk.
The size of this ‘metaimage’ must be set
before anything can be saved:
SetupMetaImage(long nRows, long nCols, long nChannels)
nRows and nCols specify the dimensions of
the metaimage. nChannels specifies if the saved image will be monochrome (1
channel) or RGB (3 channels).
For example, SetupMetaImage(3, 2, 1) specifies a
black and white image that is 3 images tall and 2 images wide.
SetupMetaImage(3, 2, 3) specifies an RGB image that is 3 images tall and 2
images wide; this new image will be 3 times larger than the previous example.
Once this is set up, the image in the buffer can be added to the metaimage by the call:
InsertTile(long row, long col, long channel)
The buffered image will be copied into the location specified by the coordinates (row, col) and into the channel specified by channel.
Once you are done inserting tiles, you can:
SaveMetaImage(char* szFileName, long compression)
Since this is a PNG file, szFileName should end with “.png” and
can be absolute and relative. Valid values for szFileName are: “bigpicture.png”,
“c:\haha.png”.
compression specifies the level of
compression that zlib (the compression engine for libpng) uses. Valid values
are 0-9. 1 is recommended for the most efficient speed/size ratio.
DestroyMetaImage()
Deletes and then clears the stored metaimage.
Not necessary for running the spotfinder, but they are helpful.
ShowSpots(long shrinkFactor)
Pops up a window (in a new thread) that displays the
last photo taken. The parameter shrinkFactor indicates if the window
should be shrunken by a factor of shrinkFactor.
For example, a shrinkFactor of 1 will display the image
pixel for pixel while a shrinkFactor of two will halve (squash) the width and
height by 2.
CloseSpotWindow()
Closes the window if it is open
GridShown(shown)
If shown is true then the grid specified by SetRegion is
displayed when ShowSpots is called.
GetUserCreatedRectangle(long &top, long &left, long &bottom, long &right)
When the buffer image is displayed in the window, the user has the opportunity to click and create crosshairs on the screen. This function returns the coordinates of those crosshairs (by reference).
The
following conventions where adapted:
Numbers are passed through 32bit parameters (long,
float)
False is defined as 0 and true is not false.
If
for any reason a function is unable to do its duty, it will return an error
code in bit format. That is, each bit indicates a particular type of error. See
the adjacent file called “ErrorCodes.txt” or else see “globals.h”.
There
are two debugging functions possible with the DLL. However, #define DEBUG_MODE
must be set. See the bottom of vision.h for their prototypes.
Notes:
This
document was initially created in MSWord.