The ALIGNTK tools can operate on images of various formats: TIFF, JPG, or binary PGM/PPM,  Most of the tools only deal with grayscale, so if the images are color they will first be converted to grayscale by averaging the RGB values.   If an output format is not specified, the output images will be written in uncompressed TIF format.  Most tools also allow a command-line option to request lossless or lossy compression of the output images.


We adopt the following conventions when numbering the pixels in an image:  The x axis runs from left-to-right, and the leftmost pixel has index value 0.  The y axis runs from top-to-bottom, and the topmost pixel has index value 0.  Thus, in the following 8x5 pixel image (magnified greatly here), the corner pixels would have the displayed integer coordinates:

image pixels1

Because alignments are done with subpixel resolution, there is frequently a need to refer to positions within an image that lie a specific positions within a pixel.  For this we use the convention that the upper left corner of a pixel has the same floating point coordinates as the pixel's integer coordinates,  and fractional values indicates subpixel displacements to the right or downward.   For example, the following points have the given floating point coodinates:

 image pixels2


Maps relate points in one image A with their corresponding points in another image B.  We thus use the term "map" not in a cartographic sense, but in its mathematical sense of a function that takes coordinates within image A, and yields the coordinates of the corresponding point in image B.  We approximate an arbitrary non-linear map in AlignTK by only storing this function for a finite set of grid points in image A, and then using bilinear interpolation to calculate the map for other points in image A.   So, for example, we might have a map grid such as the following:


The map in this case has 5x5 = 25 points for which the map is defined explicity.  We often refer to image A as the source image, and image B as the target image.  A map is stored in a file that consists of a header followed by the mapped coordinates for each grid point. Currently, each grid point has a confidence value associated with it that ranges from 0.0 (no confidence) to 1.0 (full confidence).  This is useful when the image content of the source and target images is slightly different, and certain regions are more similar and thus allow for more confidence for those regions of the map.  AlignTK also provides for partial maps, where the map is only defined for a portion of image A.   In this case, the map header specifies a subrectangle of the grid, and within that subrectangle, a confidence value of 0.0 indicates the partial map is not defined for the surrounding grid elements.


Intensity maps are used for smoothly varying brightness and contrast compensation across images.  The intensity map is a function that yields for each point in the image the black value and white value for that point.  When displaying the image, pixel values that are less than or equal to the black value are displayed as black, and pixel values greater than or equal to the white value are displayed as pure white.  Intermediate values are linearly interpolated to a shade of gray.  As in the case of image-to-image maps, the black and white values of intensity maps are explicitly defined on only a rectangular grid of points, and the values at other points are obtained by bilinear interpolation.


Source maps are used for identify where the values used in a composite image came from.  For a grid of points in the composite image, an index into the source image, and the x,y position within that source image is stored in the map file.  This allows one to determine where the image data came within a compositie image.  Typically, there is one grid point every 64 pixels in x and y in the composite image.


Target maps are essentially the inverse of source maps.  They allow one to determine for a particular source image where that image ended up in a composite image.  Typically, there is one grid point every 64 pixels in x and y in the source image.




Copyright © 2019 National Center for Multiscale Modeling of Biological Systems. All Rights Reserved.