Index: trunk/psModules/src/pmObjects.c
===================================================================
--- trunk/psModules/src/pmObjects.c	(revision 3600)
+++ trunk/psModules/src/pmObjects.c	(revision 3625)
@@ -5,6 +5,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-03-31 00:22:49 $
+ *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-04-01 20:47:40 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -147,5 +147,5 @@
 
 /******************************************************************************
-pmFindVectorPeeks(vector, threshold): Find all local peaks in the given vector
+pmFindVectorPeaks(vector, threshold): Find all local peaks in the given vector
 above the given threshold.  Returns a vector of type PS_TYPE_U32 containing
 the location (x value) of all peaks.
@@ -157,5 +157,5 @@
 Depending upon actual use, this may need to be optimized.
  *****************************************************************************/
-psVector *pmFindVectorPeeks(const psVector *vector,
+psVector *pmFindVectorPeaks(const psVector *vector,
                             psF32 threshold)
 {
@@ -267,6 +267,7 @@
 MyListAddPeak(): A private function which allocates a psList, if the list
 argument is NULL, otherwise it adds the peak to that list.
- *****************************************************************************/
-// XXX: Switch row, col args?
+ 
+XXX: Switch row, col args?
+ *****************************************************************************/
 psList *MyListAddPeak(psList *list,
                       psS32 row,
@@ -275,5 +276,5 @@
                       psPeakType type)
 {
-    psPeak *tmpPeak = pmPeakAlloc(col, row, counts, type);
+    psPeak *tmpPeak = pmPeakAlloc(row, col, counts, type);
 
     if (list == NULL) {
@@ -287,5 +288,5 @@
 
 /******************************************************************************
-pmFindImagePeeks(image, threshold): Find all local peaks in the given psImage
+pmFindImagePeaks(image, threshold): Find all local peaks in the given psImage
 above the given threshold.  Returns a psList containing location (x/y value)
 of all peaks.
@@ -301,5 +302,5 @@
      Currently, we do not.
  *****************************************************************************/
-psList *pmFindImagePeeks(const psImage *image,
+psList *pmFindImagePeaks(const psImage *image,
                          psF32 threshold)
 {
@@ -319,5 +320,5 @@
     row = 0;
     tmpRow = p_psGetRowVectorFromImage((psImage *) image, row);
-    psVector *row1 = pmFindVectorPeeks(tmpRow, threshold);
+    psVector *row1 = pmFindVectorPeaks(tmpRow, threshold);
     for (psU32 i = 0 ; i < row1->n ; i++ ) {
         col = row1->data.U32[i];
@@ -355,5 +356,5 @@
 
         } else {
-            psError(PS_ERR_UNKNOWN, true, "peak specified valid colum range.");
+            psError(PS_ERR_UNKNOWN, true, "peak specified valid column range.");
         }
     }
@@ -370,45 +371,72 @@
     for (row = 1 ; row < (image->numRows - 1) ; row++) {
         tmpRow = p_psGetRowVectorFromImage((psImage *) image, 0);
-        row1 = pmFindVectorPeeks(tmpRow, threshold);
-
-        // Step through all local peask in this row.
+        row1 = pmFindVectorPeaks(tmpRow, threshold);
+
+        // Step through all local peaks in this row.
         for (psU32 i = 0 ; i < row1->n ; i++ ) {
+            psPeakType myType = PM_PEAK_UNDEF;
             col = row1->data.U32[i];
 
-            if ((image->data.F32[row][col] >= image->data.F32[row-1][col-1]) &&
-                    (image->data.F32[row][col] >  image->data.F32[row-1][col]) &&
-                    (image->data.F32[row][col] >= image->data.F32[row-1][col+1]) &&
-                    (image->data.F32[row][col] > image->data.F32[row][col-1]) &&
-                    (image->data.F32[row][col] >= image->data.F32[row][col+1]) &&
-                    (image->data.F32[row][col] >= image->data.F32[row+1][col-1]) &&
-                    (image->data.F32[row][col] >= image->data.F32[row+1][col]) &&
-                    (image->data.F32[row][col] >= image->data.F32[row+1][col+1])) {
-                if (image->data.F32[row][col] > threshold) {
-
-                    psPeakType myType = PM_PEAK_UNDEF;
-                    if ((image->data.F32[row][col] > image->data.F32[row-1][col-1]) &&
-                            (image->data.F32[row][col] > image->data.F32[row-1][col]) &&
-                            (image->data.F32[row][col] > image->data.F32[row-1][col+1]) &&
-                            (image->data.F32[row][col] > image->data.F32[row][col-1]) &&
-                            (image->data.F32[row][col] > image->data.F32[row][col+1]) &&
-                            (image->data.F32[row][col] > image->data.F32[row+1][col-1]) &&
-                            (image->data.F32[row][col] > image->data.F32[row+1][col]) &&
-                            (image->data.F32[row][col] > image->data.F32[row+1][col+1])) {
-                        myType = PM_PEAK_LONE;
-                    }
-                    if ((image->data.F32[row][col] == image->data.F32[row-1][col-1]) ||
-                            (image->data.F32[row][col] == image->data.F32[row-1][col]) ||
-                            (image->data.F32[row][col] == image->data.F32[row-1][col+1]) ||
-                            (image->data.F32[row][col] == image->data.F32[row][col-1]) ||
-                            (image->data.F32[row][col] == image->data.F32[row][col+1]) ||
-                            (image->data.F32[row][col] == image->data.F32[row+1][col-1]) ||
-                            (image->data.F32[row][col] == image->data.F32[row+1][col]) ||
-                            (image->data.F32[row][col] == image->data.F32[row+1][col+1])) {
-                        myType = PM_PEAK_FLAT;
-                    }
-
+            if (col == 0) {
+                // If col==0, then we can not read col-1 pixels
+                if ((image->data.F32[row][col] >  image->data.F32[row-1][col]) &&
+                        (image->data.F32[row][col] >= image->data.F32[row-1][col+1]) &&
+                        (image->data.F32[row][col] >= image->data.F32[row][col+1]) &&
+                        (image->data.F32[row][col] >= image->data.F32[row+1][col]) &&
+                        (image->data.F32[row][col] >= image->data.F32[row+1][col+1])) {
+                    myType = PM_PEAK_EDGE;
                     list = MyListAddPeak(list, row, col, image->data.F32[row][col], myType);
                 }
+            } else if (col < (image->numCols - 1)) {
+                // This is an interior pixel
+                if ((image->data.F32[row][col] >= image->data.F32[row-1][col-1]) &&
+                        (image->data.F32[row][col] >  image->data.F32[row-1][col]) &&
+                        (image->data.F32[row][col] >= image->data.F32[row-1][col+1]) &&
+                        (image->data.F32[row][col] > image->data.F32[row][col-1]) &&
+                        (image->data.F32[row][col] >= image->data.F32[row][col+1]) &&
+                        (image->data.F32[row][col] >= image->data.F32[row+1][col-1]) &&
+                        (image->data.F32[row][col] >= image->data.F32[row+1][col]) &&
+                        (image->data.F32[row][col] >= image->data.F32[row+1][col+1])) {
+                    if (image->data.F32[row][col] > threshold) {
+                        if ((image->data.F32[row][col] > image->data.F32[row-1][col-1]) &&
+                                (image->data.F32[row][col] > image->data.F32[row-1][col]) &&
+                                (image->data.F32[row][col] > image->data.F32[row-1][col+1]) &&
+                                (image->data.F32[row][col] > image->data.F32[row][col-1]) &&
+                                (image->data.F32[row][col] > image->data.F32[row][col+1]) &&
+                                (image->data.F32[row][col] > image->data.F32[row+1][col-1]) &&
+                                (image->data.F32[row][col] > image->data.F32[row+1][col]) &&
+                                (image->data.F32[row][col] > image->data.F32[row+1][col+1])) {
+                            myType = PM_PEAK_LONE;
+                        }
+
+                        if ((image->data.F32[row][col] == image->data.F32[row-1][col-1]) ||
+                                (image->data.F32[row][col] == image->data.F32[row-1][col]) ||
+                                (image->data.F32[row][col] == image->data.F32[row-1][col+1]) ||
+                                (image->data.F32[row][col] == image->data.F32[row][col-1]) ||
+                                (image->data.F32[row][col] == image->data.F32[row][col+1]) ||
+                                (image->data.F32[row][col] == image->data.F32[row+1][col-1]) ||
+                                (image->data.F32[row][col] == image->data.F32[row+1][col]) ||
+                                (image->data.F32[row][col] == image->data.F32[row+1][col+1])) {
+                            myType = PM_PEAK_FLAT;
+                        }
+
+                        list = MyListAddPeak(list, row, col, image->data.F32[row][col], myType);
+                    }
+                }
+            } else if (col == (image->numCols - 1)) {
+                // If col==numCols - 1, then we can not read col+1 pixels
+                if ((image->data.F32[row][col] >= image->data.F32[row-1][col-1]) &&
+                        (image->data.F32[row][col] >  image->data.F32[row-1][col]) &&
+                        (image->data.F32[row][col] > image->data.F32[row][col-1]) &&
+                        (image->data.F32[row][col] >= image->data.F32[row][col+1]) &&
+                        (image->data.F32[row][col] >= image->data.F32[row+1][col-1]) &&
+                        (image->data.F32[row][col] >= image->data.F32[row+1][col])) {
+                    myType = PM_PEAK_EDGE;
+                    list = MyListAddPeak(list, row, col, image->data.F32[row][col], myType);
+                }
+            } else {
+                psError(PS_ERR_UNKNOWN, true, "peak specified valid column range.");
             }
+
         }
     }
@@ -419,5 +447,5 @@
     row = image->numRows - 1;
     tmpRow = p_psGetRowVectorFromImage((psImage *) image, row);
-    row1 = pmFindVectorPeeks(tmpRow, threshold);
+    row1 = pmFindVectorPeaks(tmpRow, threshold);
     for (psU32 i = 0 ; i < row1->n ; i++ ) {
         col = row1->data.U32[i];
@@ -482,5 +510,5 @@
 XXX: warning message if valid is NULL?
  *****************************************************************************/
-psList *pmCullPeeks(psList *peaks,
+psList *pmCullPeaks(psList *peaks,
                     psF32 maxValue,
                     const psRegion *valid)
@@ -492,5 +520,5 @@
     psS32 indexNum = 0;
 
-    //    printf("pmCullPeeks(): list size is %d\n", peaks->size);
+    //    printf("pmCullPeaks(): list size is %d\n", peaks->size);
     while (tmpListElem != NULL) {
         psPeak *tmpPeak = (psPeak *) tmpListElem->data;
Index: trunk/psModules/src/pmObjects.h
===================================================================
--- trunk/psModules/src/pmObjects.h	(revision 3600)
+++ trunk/psModules/src/pmObjects.h	(revision 3625)
@@ -5,6 +5,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-03-31 23:45:22 $
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-04-01 20:47:40 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -110,5 +110,5 @@
 
 /******************************************************************************
-pmFindVectorPeeks(vector, threshold): Find all local peaks in the given vector
+pmFindVectorPeaks(vector, threshold): Find all local peaks in the given vector
 above the given threshold.  Returns a vector of type PS_TYPE_U32 containing
 the location (x value) of all peaks.
@@ -119,5 +119,5 @@
 
 /******************************************************************************
-pmFindImagePeeks(image, threshold): Find all local peaks in the given psImage
+pmFindImagePeaks(image, threshold): Find all local peaks in the given psImage
 above the given threshold.  Returns a psList containing the location (x/y
 value) of all peaks.
