Index: trunk/psLib/src/image/psImageExtraction.c
===================================================================
--- trunk/psLib/src/image/psImageExtraction.c	(revision 2105)
+++ trunk/psLib/src/image/psImageExtraction.c	(revision 2204)
@@ -9,6 +9,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-10-14 01:22:59 $
+ *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-10-27 00:57:31 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -26,11 +26,11 @@
 psImage* imageSubset(psImage* out,
                      psImage* image,
-                     int col0,
-                     int row0,
-                     int col1,
-                     int row1)
+                     psS32 col0,
+                     psS32 row0,
+                     psS32 col1,
+                     psS32 row1)
 {
-    unsigned int elementSize;          // size of image element in bytes
-    unsigned int inputColOffset;       // offset in bytes to first subset pixel in input row
+    psU32 elementSize;          // size of image element in bytes
+    psU32 inputColOffset;       // offset in bytes to first subset pixel in input row
 
     if (image == NULL || image->data.V == NULL) {
@@ -68,6 +68,6 @@
         return NULL;
     }
-    int numRows = row1-row0;
-    int numCols = col1-col0;
+    psS32 numRows = row1-row0;
+    psS32 numCols = col1-col0;
 
     elementSize = PSELEMTYPE_SIZEOF(image->type.type);
@@ -82,5 +82,5 @@
 
     // increment the raw data buffer before freeing anything in the 'out'
-    void* rawData = psMemIncrRefCounter(image->rawDataBuffer);
+    psPtr rawData = psMemIncrRefCounter(image->rawDataBuffer);
 
     if (out != NULL) {
@@ -97,10 +97,10 @@
     }
 
-    out->data.V = psRealloc(out->data.V,sizeof(void*)*numRows); // resize row pointer array
+    out->data.V = psRealloc(out->data.V,sizeof(psPtr)*numRows); // resize row pointer array
     *(psType*)&out->type = image->type;
-    *(unsigned int*)&out->numCols = numCols;
-    *(unsigned int*)&out->numRows = numRows;
-    *(int*)&out->row0 = row0;
-    *(int*)&out->col0 = col0;
+    *(psU32*)&out->numCols = numCols;
+    *(psU32*)&out->numRows = numRows;
+    *(psS32*)&out->row0 = row0;
+    *(psS32*)&out->col0 = col0;
     out->parent = image;
     out->children = NULL;
@@ -111,10 +111,10 @@
 
     inputColOffset = elementSize * col0;
-    for (int row = 0; row < numRows; row++) {
+    for (psS32 row = 0; row < numRows; row++) {
         out->data.V[row] = image->data.U8[row0 + row] + inputColOffset;
     }
 
     // add output image as a child of the input image.
-    int n = 0;
+    psS32 n = 0;
     psArray* children = image->children;
     if (children == NULL) {
@@ -134,8 +134,8 @@
 
 psImage* psImageSubset(psImage* image,
-                       int col0,
-                       int row0,
-                       int col1,
-                       int row1)
+                       psS32 col0,
+                       psS32 row0,
+                       psS32 col1,
+                       psS32 row1)
 {
     return imageSubset(NULL,image,col0,row0,col1,row1);
@@ -145,8 +145,8 @@
                            const char* section)
 {
-    int col0;
-    int col1;
-    int row0;
-    int row1;
+    psS32 col0;
+    psS32 col1;
+    psS32 row0;
+    psS32 row1;
 
     // section should be of the form '[col0:col1,row0:row1]'
@@ -177,5 +177,5 @@
 }
 
-psImage* psImageTrim(psImage* image, int col0, int row0, int col1, int row1)
+psImage* psImageTrim(psImage* image, psS32 col0, psS32 row0, psS32 col1, psS32 row1)
 {
     if (image == NULL || image->data.V == NULL) {
@@ -220,24 +220,24 @@
     psImageFreeChildren(image);
 
-    unsigned int elementSize = PSELEMTYPE_SIZEOF(image->type.type);
-    unsigned int numCols = col1-col0;
-    unsigned int numRows = row1-row0;
-    unsigned int rowSize = elementSize*numCols;
-    unsigned int colOffset = elementSize * col0;
+    psU32 elementSize = PSELEMTYPE_SIZEOF(image->type.type);
+    psU32 numCols = col1-col0;
+    psU32 numRows = row1-row0;
+    psU32 rowSize = elementSize*numCols;
+    psU32 colOffset = elementSize * col0;
     psU8* imageData = image->rawDataBuffer;
-    for (int row = row0; row < row1; row++) {
+    for (psS32 row = row0; row < row1; row++) {
         memmove(imageData,image->data.U8[row] + colOffset,rowSize);
         imageData += rowSize;
     }
 
-    *(unsigned int*)&image->numRows = numRows;
-    *(unsigned int*)&image->numCols = numCols;
+    *(psU32*)&image->numRows = numRows;
+    *(psU32*)&image->numCols = numCols;
 
     // XXX: should I really resize the buffers?
-    image->data.V = psRealloc(image->data.V,sizeof(void*)*numRows);
+    image->data.V = psRealloc(image->data.V,sizeof(psPtr)*numRows);
     image->rawDataBuffer = psRealloc(image->rawDataBuffer,rowSize*numRows);
 
     image->data.V[0] = image->rawDataBuffer;
-    for (int r = 1; r < numRows; r++) {
+    for (psS32 r = 1; r < numRows; r++) {
         image->data.U8[r] = image->data.U8[r-1] + rowSize;
     }
@@ -250,9 +250,9 @@
                        const psImage* restrict in,
                        const psImage* restrict mask,
-                       unsigned int maskVal,
-                       int col0,
-                       int row0,
-                       int col1,
-                       int row1,
+                       psU32 maskVal,
+                       psS32 col0,
+                       psS32 row0,
+                       psS32 col1,
+                       psS32 row1,
                        psImageCutDirection direction,
                        const psStats* stats)
@@ -261,7 +261,7 @@
     psStats* myStats;
     psElemType type;
-    int inRows;
-    int inCols;
-    int delta = 1;
+    psS32 inRows;
+    psS32 inCols;
+    psS32 delta = 1;
     psF64* outData;
 
@@ -349,6 +349,6 @@
     *myStats = *stats;
 
-    int numCols = col1-col0;
-    int numRows = row1-row0;
+    psS32 numCols = col1-col0;
+    psS32 numRows = row1-row0;
 
     if (direction == PS_CUT_X_POS || direction == PS_CUT_X_NEG) {
@@ -380,5 +380,5 @@
     case PS_TYPE_##TYPE: { \
             psMaskType* maskVecData = NULL; \
-            for (int c=col0;c<col1;c++) { \
+            for (psS32 c=col0;c<col1;c++) { \
                 ps##TYPE *imgData = in->data.TYPE[row0] + c; \
                 ps##TYPE *imgVecData = imgVec->data.TYPE; \
@@ -387,5 +387,5 @@
                     maskData = (psMaskType* )(mask->data.V[row0]) + c; \
                 } \
-                for (int r=row0;r<row1;r++) { \
+                for (psS32 r=row0;r<row1;r++) { \
                     *(imgVecData++) = *imgData; \
                     imgData += inCols; \
@@ -437,5 +437,5 @@
         psVector* imgVec = NULL;
         psVector* maskVec = NULL;
-        int elementSize = PSELEMTYPE_SIZEOF(type);
+        psS32 elementSize = PSELEMTYPE_SIZEOF(type);
         psU32* outPosition = NULL;
 
@@ -465,10 +465,10 @@
         }
 
-        for (int r = row0; r < row1; r++) {
+        for (psS32 r = row0; r < row1; r++) {
             // point the vector struct to the
             // data to calculate the stats
-            imgVec->data.V = (void *)(in->data.U8[r] + col0 * elementSize);
+            imgVec->data.V = (psPtr )(in->data.U8[r] + col0 * elementSize);
             if (maskVec != NULL) {
-                maskVec->data.V = (void *)(mask->data.U8[r] + col0 * sizeof(psMaskType));
+                maskVec->data.V = (psPtr )(mask->data.U8[r] + col0 * sizeof(psMaskType));
             }
             myStats = psVectorStats(myStats, imgVec, maskVec, maskVal);
@@ -503,10 +503,10 @@
                      const psImage* in,
                      const psImage* restrict mask,
-                     unsigned int maskVal,
+                     psU32 maskVal,
                      float startCol,
                      float startRow,
                      float endCol,
                      float endRow,
-                     unsigned int nSamples,
+                     psU32 nSamples,
                      psImageInterpolateMode mode)
 {
@@ -518,6 +518,6 @@
         return NULL;
     }
-    int numCols = in->numCols;
-    int numRows = in->numRows;
+    psS32 numCols = in->numCols;
+    psS32 numRows = in->numRows;
 
     if (nSamples < 2) {
@@ -594,5 +594,5 @@
 case PS_TYPE_##TYPE: { \
         ps##TYPE* outData = out->data.TYPE; \
-        for (int i = 0; i < nSamples; i++) { \
+        for (psS32 i = 0; i < nSamples; i++) { \
             float x = startCol + (float)i*dX; \
             float y = startRow + (float)i*dY; \
@@ -642,5 +642,5 @@
                            const psImage* in,
                            const psImage* restrict mask,
-                           unsigned int maskVal,
+                           psU32 maskVal,
                            float centerCol,
                            float centerRow,
@@ -659,6 +659,6 @@
         return NULL;
     }
-    int numCols = in->numCols;
-    int numRows = in->numRows;
+    psS32 numCols = in->numCols;
+    psS32 numRows = in->numRows;
 
     if (mask != NULL) {
@@ -734,5 +734,5 @@
 
     // size the output vector to proper size.
-    int numOut = radii->n - 1;
+    psS32 numOut = radii->n - 1;
     out = psVectorRecycle(out, numOut, PS_TYPE_F64);
     psF64* outData = out->data.F64;
@@ -741,8 +741,8 @@
     psF32* rSq = rSqVec->data.F32;
 
-    int startRow = centerRow - rSq[numOut];
-    int endRow = centerRow + rSq[numOut];
-    int startCol = centerCol - rSq[numOut];
-    int endCol = centerCol + rSq[numOut];
+    psS32 startRow = centerRow - rSq[numOut];
+    psS32 endRow = centerRow + rSq[numOut];
+    psS32 startCol = centerCol - rSq[numOut];
+    psS32 endCol = centerCol + rSq[numOut];
 
     if (startRow < 0) {
@@ -763,5 +763,5 @@
 
     // Square the radii data
-    for (int d = 0; d <= numOut; d++) {
+    for (psS32 d = 0; d <= numOut; d++) {
         rSq[d] *= rSq[d];
     }
@@ -770,5 +770,5 @@
     psVector** buffer = psAlloc(sizeof(psVector*)*numOut);
     psVector** bufferMask = psAlloc(sizeof(psVector*)*numOut);
-    for (int lcv = 0; lcv < numOut; lcv++) {
+    for (psS32 lcv = 0; lcv < numOut; lcv++) {
         // n.b. alloc enough for the data by making the vectors slightly larger
         // than the area of the region of interest.
@@ -788,5 +788,5 @@
     float dY;
     float dist;
-    for (int row=startRow; row <= endRow; row++) {
+    for (psS32 row=startRow; row <= endRow; row++) {
         psF32* inRow = in->data.F32[row];
         psMaskType* maskRow = NULL;
@@ -794,11 +794,11 @@
             maskRow = mask->data.PS_TYPE_MASK_DATA[row];
         }
-        for (int col=startCol; col <= endCol; col++) {
+        for (psS32 col=startCol; col <= endCol; col++) {
             dX = centerCol - (float)col - 0.5f;
             dY = centerRow - (float)row - 0.5f;
             dist = dX*dX+dY*dY;
-            for (int r = 0; r < numOut; r++) {
+            for (psS32 r = 0; r < numOut; r++) {
                 if (rSq[r] < dist && dist < rSq[r+1]) {
-                    int n = buffer[r]->n;
+                    psS32 n = buffer[r]->n;
                     if (n == buffer[r]->nalloc) { // in case buffers already full, expand
                         buffer[r] = psVectorRealloc(buffer[r], n*2);
@@ -825,5 +825,5 @@
     *myStats = *stats;
 
-    for (int r = 0; r < numOut; r++) {
+    for (psS32 r = 0; r < numOut; r++) {
         myStats = psVectorStats(myStats,buffer[r], bufferMask[r],maskVal);
         (void)p_psGetStatValue(myStats,&statVal);
@@ -833,5 +833,5 @@
     psFree(myStats);
 
-    for (int lcv = 0; lcv < numOut; lcv++) {
+    for (psS32 lcv = 0; lcv < numOut; lcv++) {
         psFree(buffer[lcv]);
         psFree(bufferMask[lcv]);
