Index: trunk/pswarp/src/pswarp.h
===================================================================
--- trunk/pswarp/src/pswarp.h	(revision 10954)
+++ trunk/pswarp/src/pswarp.h	(revision 10957)
@@ -13,13 +13,20 @@
 # define PSWARP_RECIPE "PSWARP" // Name of the recipe to use
 
+// a single pswarpMap converts coordinates from one image to a second image 
+// the linear model is only valid over a limited range of pixels
 typedef struct {
-  double Xo, Xx, Xy;
-  double Yo, Yx, Yy;
+    double Xo, Xx, Xy;
+    double Yo, Yx, Yy;
+    int xo;
+    int yo;
 } pswarpMap;
 
+// the pswarpMapGrid carries a collection of pswarpMag structures representing the
+// local value of the pswarpMap at different locations in the image.
 typedef struct {
-  pswarpMap **grid;
-  int Nx, Ny;
-  int nXpix, nYpix;
+    pswarpMap ***maps;
+    int nXpts, nYpts;			// number of x,y samples in the grid
+    int nXpix, nYpix;			// x,y spacing in src image pixels of grid samples
+    int xMin,  yMin;			// coordinate of first grid sample
 } pswarpMapGrid;
 
@@ -31,3 +38,15 @@
 void pswarpCleanup (pmConfig *config);
 bool pswarpTransformReadout (pmReadout *output, pmReadout *input, pmConfig *config);
+bool pswarpTransformReadout_Opt (pmReadout *output, pmReadout *input, pmConfig *config);
 
+bool pswarpMatchRange (int *minX, int *minY, int *maxX, int *maxY, pmReadout *dest, pmReadout *src);
+
+pswarpMap *pswarpMapAlloc ();
+pswarpMapGrid *pswarpMapGridAlloc (int Nx, int Ny);
+
+pswarpMapGrid *pswarpMapGridFromImage (pmReadout *dest, pmReadout *src, int nXpix, int nYpix);
+bool pswarpMapGridSetGrid (pswarpMapGrid *grid, int ix, int iy, int *gridX, int *gridY);
+bool pswarpMapGridNextGrid (pswarpMapGrid *grid, int gridX, int gridY, int *nextX, int *nextY);
+double pswarpMapGridMaxError (pswarpMapGrid *grid);
+bool pswarpMapApply (double *outX, double *outY, pswarpMap *map, double inX, double inY);
+bool pswarpMapSetLocalModel (pswarpMap *map, pmReadout *dest, pmReadout *src, int ix, int iy);
