Changeset 3625
- Timestamp:
- Apr 1, 2005, 10:47:40 AM (21 years ago)
- Location:
- trunk/psModules
- Files:
-
- 3 edited
-
src/pmObjects.c (modified) (13 diffs)
-
src/pmObjects.h (modified) (3 diffs)
-
test/tst_pmObjects01.c (modified) (29 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/pmObjects.c
r3576 r3625 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $8 * @date $Date: 2005-0 3-31 00:22:49$7 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-04-01 20:47:40 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 147 147 148 148 /****************************************************************************** 149 pmFindVectorPe eks(vector, threshold): Find all local peaks in the given vector149 pmFindVectorPeaks(vector, threshold): Find all local peaks in the given vector 150 150 above the given threshold. Returns a vector of type PS_TYPE_U32 containing 151 151 the location (x value) of all peaks. … … 157 157 Depending upon actual use, this may need to be optimized. 158 158 *****************************************************************************/ 159 psVector *pmFindVectorPe eks(const psVector *vector,159 psVector *pmFindVectorPeaks(const psVector *vector, 160 160 psF32 threshold) 161 161 { … … 267 267 MyListAddPeak(): A private function which allocates a psList, if the list 268 268 argument is NULL, otherwise it adds the peak to that list. 269 *****************************************************************************/ 270 // XXX: Switch row, col args? 269 270 XXX: Switch row, col args? 271 *****************************************************************************/ 271 272 psList *MyListAddPeak(psList *list, 272 273 psS32 row, … … 275 276 psPeakType type) 276 277 { 277 psPeak *tmpPeak = pmPeakAlloc( col, row, counts, type);278 psPeak *tmpPeak = pmPeakAlloc(row, col, counts, type); 278 279 279 280 if (list == NULL) { … … 287 288 288 289 /****************************************************************************** 289 pmFindImagePe eks(image, threshold): Find all local peaks in the given psImage290 pmFindImagePeaks(image, threshold): Find all local peaks in the given psImage 290 291 above the given threshold. Returns a psList containing location (x/y value) 291 292 of all peaks. … … 301 302 Currently, we do not. 302 303 *****************************************************************************/ 303 psList *pmFindImagePe eks(const psImage *image,304 psList *pmFindImagePeaks(const psImage *image, 304 305 psF32 threshold) 305 306 { … … 319 320 row = 0; 320 321 tmpRow = p_psGetRowVectorFromImage((psImage *) image, row); 321 psVector *row1 = pmFindVectorPe eks(tmpRow, threshold);322 psVector *row1 = pmFindVectorPeaks(tmpRow, threshold); 322 323 for (psU32 i = 0 ; i < row1->n ; i++ ) { 323 324 col = row1->data.U32[i]; … … 355 356 356 357 } else { 357 psError(PS_ERR_UNKNOWN, true, "peak specified valid colum range.");358 psError(PS_ERR_UNKNOWN, true, "peak specified valid column range."); 358 359 } 359 360 } … … 370 371 for (row = 1 ; row < (image->numRows - 1) ; row++) { 371 372 tmpRow = p_psGetRowVectorFromImage((psImage *) image, 0); 372 row1 = pmFindVectorPe eks(tmpRow, threshold);373 374 // Step through all local pea skin this row.373 row1 = pmFindVectorPeaks(tmpRow, threshold); 374 375 // Step through all local peaks in this row. 375 376 for (psU32 i = 0 ; i < row1->n ; i++ ) { 377 psPeakType myType = PM_PEAK_UNDEF; 376 378 col = row1->data.U32[i]; 377 379 378 if ((image->data.F32[row][col] >= image->data.F32[row-1][col-1]) && 379 (image->data.F32[row][col] > image->data.F32[row-1][col]) && 380 (image->data.F32[row][col] >= image->data.F32[row-1][col+1]) && 381 (image->data.F32[row][col] > image->data.F32[row][col-1]) && 382 (image->data.F32[row][col] >= image->data.F32[row][col+1]) && 383 (image->data.F32[row][col] >= image->data.F32[row+1][col-1]) && 384 (image->data.F32[row][col] >= image->data.F32[row+1][col]) && 385 (image->data.F32[row][col] >= image->data.F32[row+1][col+1])) { 386 if (image->data.F32[row][col] > threshold) { 387 388 psPeakType myType = PM_PEAK_UNDEF; 389 if ((image->data.F32[row][col] > image->data.F32[row-1][col-1]) && 390 (image->data.F32[row][col] > image->data.F32[row-1][col]) && 391 (image->data.F32[row][col] > image->data.F32[row-1][col+1]) && 392 (image->data.F32[row][col] > image->data.F32[row][col-1]) && 393 (image->data.F32[row][col] > image->data.F32[row][col+1]) && 394 (image->data.F32[row][col] > image->data.F32[row+1][col-1]) && 395 (image->data.F32[row][col] > image->data.F32[row+1][col]) && 396 (image->data.F32[row][col] > image->data.F32[row+1][col+1])) { 397 myType = PM_PEAK_LONE; 398 } 399 if ((image->data.F32[row][col] == image->data.F32[row-1][col-1]) || 400 (image->data.F32[row][col] == image->data.F32[row-1][col]) || 401 (image->data.F32[row][col] == image->data.F32[row-1][col+1]) || 402 (image->data.F32[row][col] == image->data.F32[row][col-1]) || 403 (image->data.F32[row][col] == image->data.F32[row][col+1]) || 404 (image->data.F32[row][col] == image->data.F32[row+1][col-1]) || 405 (image->data.F32[row][col] == image->data.F32[row+1][col]) || 406 (image->data.F32[row][col] == image->data.F32[row+1][col+1])) { 407 myType = PM_PEAK_FLAT; 408 } 409 380 if (col == 0) { 381 // If col==0, then we can not read col-1 pixels 382 if ((image->data.F32[row][col] > image->data.F32[row-1][col]) && 383 (image->data.F32[row][col] >= image->data.F32[row-1][col+1]) && 384 (image->data.F32[row][col] >= image->data.F32[row][col+1]) && 385 (image->data.F32[row][col] >= image->data.F32[row+1][col]) && 386 (image->data.F32[row][col] >= image->data.F32[row+1][col+1])) { 387 myType = PM_PEAK_EDGE; 410 388 list = MyListAddPeak(list, row, col, image->data.F32[row][col], myType); 411 389 } 390 } else if (col < (image->numCols - 1)) { 391 // This is an interior pixel 392 if ((image->data.F32[row][col] >= image->data.F32[row-1][col-1]) && 393 (image->data.F32[row][col] > image->data.F32[row-1][col]) && 394 (image->data.F32[row][col] >= image->data.F32[row-1][col+1]) && 395 (image->data.F32[row][col] > image->data.F32[row][col-1]) && 396 (image->data.F32[row][col] >= image->data.F32[row][col+1]) && 397 (image->data.F32[row][col] >= image->data.F32[row+1][col-1]) && 398 (image->data.F32[row][col] >= image->data.F32[row+1][col]) && 399 (image->data.F32[row][col] >= image->data.F32[row+1][col+1])) { 400 if (image->data.F32[row][col] > threshold) { 401 if ((image->data.F32[row][col] > image->data.F32[row-1][col-1]) && 402 (image->data.F32[row][col] > image->data.F32[row-1][col]) && 403 (image->data.F32[row][col] > image->data.F32[row-1][col+1]) && 404 (image->data.F32[row][col] > image->data.F32[row][col-1]) && 405 (image->data.F32[row][col] > image->data.F32[row][col+1]) && 406 (image->data.F32[row][col] > image->data.F32[row+1][col-1]) && 407 (image->data.F32[row][col] > image->data.F32[row+1][col]) && 408 (image->data.F32[row][col] > image->data.F32[row+1][col+1])) { 409 myType = PM_PEAK_LONE; 410 } 411 412 if ((image->data.F32[row][col] == image->data.F32[row-1][col-1]) || 413 (image->data.F32[row][col] == image->data.F32[row-1][col]) || 414 (image->data.F32[row][col] == image->data.F32[row-1][col+1]) || 415 (image->data.F32[row][col] == image->data.F32[row][col-1]) || 416 (image->data.F32[row][col] == image->data.F32[row][col+1]) || 417 (image->data.F32[row][col] == image->data.F32[row+1][col-1]) || 418 (image->data.F32[row][col] == image->data.F32[row+1][col]) || 419 (image->data.F32[row][col] == image->data.F32[row+1][col+1])) { 420 myType = PM_PEAK_FLAT; 421 } 422 423 list = MyListAddPeak(list, row, col, image->data.F32[row][col], myType); 424 } 425 } 426 } else if (col == (image->numCols - 1)) { 427 // If col==numCols - 1, then we can not read col+1 pixels 428 if ((image->data.F32[row][col] >= image->data.F32[row-1][col-1]) && 429 (image->data.F32[row][col] > image->data.F32[row-1][col]) && 430 (image->data.F32[row][col] > image->data.F32[row][col-1]) && 431 (image->data.F32[row][col] >= image->data.F32[row][col+1]) && 432 (image->data.F32[row][col] >= image->data.F32[row+1][col-1]) && 433 (image->data.F32[row][col] >= image->data.F32[row+1][col])) { 434 myType = PM_PEAK_EDGE; 435 list = MyListAddPeak(list, row, col, image->data.F32[row][col], myType); 436 } 437 } else { 438 psError(PS_ERR_UNKNOWN, true, "peak specified valid column range."); 412 439 } 440 413 441 } 414 442 } … … 419 447 row = image->numRows - 1; 420 448 tmpRow = p_psGetRowVectorFromImage((psImage *) image, row); 421 row1 = pmFindVectorPe eks(tmpRow, threshold);449 row1 = pmFindVectorPeaks(tmpRow, threshold); 422 450 for (psU32 i = 0 ; i < row1->n ; i++ ) { 423 451 col = row1->data.U32[i]; … … 482 510 XXX: warning message if valid is NULL? 483 511 *****************************************************************************/ 484 psList *pmCullPe eks(psList *peaks,512 psList *pmCullPeaks(psList *peaks, 485 513 psF32 maxValue, 486 514 const psRegion *valid) … … 492 520 psS32 indexNum = 0; 493 521 494 // printf("pmCullPe eks(): list size is %d\n", peaks->size);522 // printf("pmCullPeaks(): list size is %d\n", peaks->size); 495 523 while (tmpListElem != NULL) { 496 524 psPeak *tmpPeak = (psPeak *) tmpListElem->data; -
trunk/psModules/src/pmObjects.h
r3600 r3625 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $8 * @date $Date: 2005-0 3-31 23:45:22$7 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-04-01 20:47:40 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 110 110 111 111 /****************************************************************************** 112 pmFindVectorPe eks(vector, threshold): Find all local peaks in the given vector112 pmFindVectorPeaks(vector, threshold): Find all local peaks in the given vector 113 113 above the given threshold. Returns a vector of type PS_TYPE_U32 containing 114 114 the location (x value) of all peaks. … … 119 119 120 120 /****************************************************************************** 121 pmFindImagePe eks(image, threshold): Find all local peaks in the given psImage121 pmFindImagePeaks(image, threshold): Find all local peaks in the given psImage 122 122 above the given threshold. Returns a psList containing the location (x/y 123 123 value) of all peaks. -
trunk/psModules/test/tst_pmObjects01.c
r3576 r3625 19 19 * abd never deallocate, no error is generated. 20 20 * 21 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $22 * @date $Date: 2005-0 3-31 00:22:49$21 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 22 * @date $Date: 2005-04-01 20:47:40 $ 23 23 * 24 24 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 63 63 { 64 64 return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv); 65 test02(); 65 66 } 66 67 … … 153 154 154 155 #define VECTOR_SIZE 10 155 bool test_pmFindVectorPe eks(int n)156 bool test_pmFindVectorPeaks(int n) 156 157 { 157 158 bool testStatus = true; … … 159 160 psVector *outData = NULL; 160 161 161 printf("-------------- Calling test_pmFindVectorPe eks on an %d size vector. --------------\n", n);162 printf("-------------- Calling test_pmFindVectorPeaks on an %d size vector. --------------\n", n); 162 163 // 163 164 // Test first pixel peak. 164 165 // 165 printf("Test pmFindVectorPe eks() with a first-element peak.\n");166 printf("Test pmFindVectorPeaks() with a first-element peak.\n"); 166 167 for (psS32 i = 0 ; i < n ; i++) { 167 168 inData->data.F32[i] = (float) (n-i); … … 169 170 inData->data.F32[0] = (float) n; 170 171 171 outData= pmFindVectorPe eks(inData, 0.0);172 outData= pmFindVectorPeaks(inData, 0.0); 172 173 if (outData == NULL) { 173 printf("TEST ERROR: pmFindVectorPe eks returned a NULL psVector.\n");174 printf("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n"); 174 175 testStatus = false; 175 176 } else { … … 189 190 // Test first pixel peak, large threshold 190 191 // 191 printf("Test pmFindVectorPe eks() with a first-element peak, large threshold.\n");192 printf("Test pmFindVectorPeaks() with a first-element peak, large threshold.\n"); 192 193 for (psS32 i = 0 ; i < n ; i++) { 193 194 inData->data.F32[i] = (float) (n-i); … … 195 196 inData->data.F32[0] = (float) n; 196 197 197 outData= pmFindVectorPe eks(inData, (float) (n*n));198 outData= pmFindVectorPeaks(inData, (float) (n*n)); 198 199 if (outData == NULL) { 199 printf("TEST ERROR: pmFindVectorPe eks returned a NULL psVector.\n");200 printf("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n"); 200 201 testStatus = false; 201 202 } else { … … 217 218 // Test last pixel peak. 218 219 // 219 printf("Test pmFindVectorPe eks() with a last-element peak.\n");220 printf("Test pmFindVectorPeaks() with a last-element peak.\n"); 220 221 for (psS32 i = 0 ; i < n ; i++) { 221 222 inData->data.F32[i] = (float) (i); … … 223 224 inData->data.F32[n-1] = (float) n; 224 225 225 outData= pmFindVectorPe eks(inData, 0.0);226 outData= pmFindVectorPeaks(inData, 0.0); 226 227 if (outData == NULL) { 227 printf("TEST ERROR: pmFindVectorPe eks returned a NULL psVector.\n");228 printf("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n"); 228 229 testStatus = false; 229 230 } else { … … 243 244 // Test last pixel peak, large threshold. 244 245 // 245 printf("Test pmFindVectorPe eks() with a last-element peak, large threshold.\n");246 printf("Test pmFindVectorPeaks() with a last-element peak, large threshold.\n"); 246 247 for (psS32 i = 0 ; i < n ; i++) { 247 248 inData->data.F32[i] = (float) (i); … … 249 250 inData->data.F32[n-1] = (float) n; 250 251 251 outData= pmFindVectorPe eks(inData, (float) (n*n));252 outData= pmFindVectorPeaks(inData, (float) (n*n)); 252 253 if (outData == NULL) { 253 printf("TEST ERROR: pmFindVectorPe eks returned a NULL psVector.\n");254 printf("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n"); 254 255 testStatus = false; 255 256 } else { … … 266 267 // Set all even number elements to be peaks. 267 268 // 268 printf("Test pmFindVectorPe eks() with all even-numbered elements peak.\n");269 printf("Test pmFindVectorPeaks() with all even-numbered elements peak.\n"); 269 270 for (psS32 i = 0 ; i < n ; i++) { 270 271 if (0 == i%2) { … … 277 278 278 279 279 outData= pmFindVectorPe eks(inData, 0.0);280 outData= pmFindVectorPeaks(inData, 0.0); 280 281 if (outData == NULL) { 281 printf("TEST ERROR: pmFindVectorPe eks returned a NULL psVector.\n");282 printf("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n"); 282 283 testStatus = false; 283 284 } else { … … 301 302 // Should generate an empty output psVector. 302 303 // 303 printf("Test pmFindVectorPe eks() with all even-numbered elements peak, large threshold.\n");304 outData= pmFindVectorPe eks(inData, (float) (n*n));304 printf("Test pmFindVectorPeaks() with all even-numbered elements peak, large threshold.\n"); 305 outData= pmFindVectorPeaks(inData, (float) (n*n)); 305 306 if (outData == NULL) { 306 printf("TEST ERROR: pmFindVectorPe eks returned a NULL psVector.\n");307 printf("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n"); 307 308 testStatus = false; 308 309 } else { … … 331 332 332 333 printf("----------------------------------------------------------------------------------\n"); 333 printf("Calling pmFindVectorPe eks with NULL psVector. Should generate error and return NULL.\n");334 tmpVec = pmFindVectorPe eks(NULL, 0.0);334 printf("Calling pmFindVectorPeaks with NULL psVector. Should generate error and return NULL.\n"); 335 tmpVec = pmFindVectorPeaks(NULL, 0.0); 335 336 if (tmpVec != NULL) { 336 printf("TEST ERROR: pmFindVectorPe eks() returned a non-NULL psVector.\n");337 printf("TEST ERROR: pmFindVectorPeaks() returned a non-NULL psVector.\n"); 337 338 testStatus = false; 338 339 psFree(tmpVec); … … 340 341 341 342 printf("----------------------------------------------------------------------------------\n"); 342 printf("Calling pmFindVectorPe eks with empty psVector. Should generate error and return NULL.\n");343 tmpVec = pmFindVectorPe eks(tmpVecEmpty, 0.0);343 printf("Calling pmFindVectorPeaks with empty psVector. Should generate error and return NULL.\n"); 344 tmpVec = pmFindVectorPeaks(tmpVecEmpty, 0.0); 344 345 if (tmpVec != NULL) { 345 printf("TEST ERROR: pmFindVectorPe eks() returned a non-NULL psVector.\n");346 printf("TEST ERROR: pmFindVectorPeaks() returned a non-NULL psVector.\n"); 346 347 testStatus = false; 347 348 psFree(tmpVec); … … 349 350 350 351 printf("----------------------------------------------------------------------------------\n"); 351 printf("Calling pmFindVectorPe eks with PS_TYPE_F64 psVector. Should generate error and return NULL.\n");352 tmpVec = pmFindVectorPe eks(tmpVecF64, 0.0);352 printf("Calling pmFindVectorPeaks with PS_TYPE_F64 psVector. Should generate error and return NULL.\n"); 353 tmpVec = pmFindVectorPeaks(tmpVecF64, 0.0); 353 354 if (tmpVec != NULL) { 354 printf("TEST ERROR: pmFindVectorPe eks() returned a non-NULL psVector.\n");355 printf("TEST ERROR: pmFindVectorPeaks() returned a non-NULL psVector.\n"); 355 356 testStatus = false; 356 357 psFree(tmpVec); 357 358 } 358 testStatus&= test_pmFindVectorPe eks(1);359 testStatus&= test_pmFindVectorPe eks(VECTOR_SIZE);359 testStatus&= test_pmFindVectorPeaks(1); 360 testStatus&= test_pmFindVectorPeaks(VECTOR_SIZE); 360 361 361 362 psFree(tmpVecF64); … … 366 367 // XXX: Add tests for the PEAK_TYPE. 367 368 // XXX: Add interior peaks, edge peaks, and flat peaks. 368 bool test_pmFindImagePe eks(int numRows, int numCols)369 bool test_pmFindImagePeaks(int numRows, int numCols) 369 370 { 370 printf("-------------- Calling test_pmFindVectorPe eks on an %d-by-%d image. --------------\n", numRows, numCols);371 printf("-------------- Calling test_pmFindVectorPeaks on an %d-by-%d image. --------------\n", numRows, numCols); 371 372 bool testStatus = true; 372 373 psImage *inData = psImageAlloc(numCols, numRows, PS_TYPE_F32); … … 392 393 } 393 394 394 outData = pmFindImagePe eks(inData, 0.0);395 outData = pmFindImagePeaks(inData, 0.0); 395 396 396 397 if (outData == NULL) { 397 printf("TEST ERROR: pmFindImagePe eks returned a NULL psList.\n");398 printf("TEST ERROR: pmFindImagePeaks returned a NULL psList.\n"); 398 399 testStatus = false; 399 400 } else { 400 401 if (outData->size != 4) { 401 printf("TEST ERROR: pmFindImagePe eks found only %d peaks (should be 4)\n", outData->size);402 printf("TEST ERROR: pmFindImagePeaks found only %d peaks (should be 4)\n", outData->size); 402 403 testStatus = false; 403 404 } 404 405 406 //HEY 405 407 psListElem *tmpPeakLE = (psListElem *) outData->head; 406 408 while (tmpPeakLE != NULL) { … … 409 411 ((tmpPeak->y == 0) || (tmpPeak->y == numCols-1))) {} 410 412 else { 411 printf("TEST ERROR: Peak at (%d, %d) \n", tmpPeak->x, tmpPeak->y);413 printf("TEST ERROR: Peak at (%d, %d) (%f)\n", tmpPeak->x, tmpPeak->y, tmpPeak->counts); 412 414 testStatus = false; 413 415 } … … 432 434 433 435 printf("----------------------------------------------------------------------------------\n"); 434 printf("Calling pmFindImagePe eks with NULL psImage. Should generate error and return NULL.\n");435 tmpList = pmFindImagePe eks(NULL, 0.0);436 printf("Calling pmFindImagePeaks with NULL psImage. Should generate error and return NULL.\n"); 437 tmpList = pmFindImagePeaks(NULL, 0.0); 436 438 if (tmpList != NULL) { 437 printf("TEST ERROR: pmFindImagePe eks() returned a non-NULL psImage.\n");439 printf("TEST ERROR: pmFindImagePeaks() returned a non-NULL psImage.\n"); 438 440 testStatus = false; 439 441 psFree(tmpList); … … 441 443 442 444 printf("----------------------------------------------------------------------------------\n"); 443 printf("Calling pmFindImagePe eks with empty psImage. Should generate error and return NULL.\n");444 tmpList = pmFindImagePe eks(tmpImageEmpty, 0.0);445 printf("Calling pmFindImagePeaks with empty psImage. Should generate error and return NULL.\n"); 446 tmpList = pmFindImagePeaks(tmpImageEmpty, 0.0); 445 447 if (tmpList != NULL) { 446 printf("TEST ERROR: pmFindImagePe eks() returned a non-NULL psImage.\n");448 printf("TEST ERROR: pmFindImagePeaks() returned a non-NULL psImage.\n"); 447 449 testStatus = false; 448 450 psFree(tmpList); … … 450 452 451 453 printf("----------------------------------------------------------------------------------\n"); 452 printf("Calling pmFindImagePe eks with PS_TYPE_F64 psImage. Should generate error and return NULL.\n");453 tmpList = pmFindImagePe eks(tmpImageF64, 0.0);454 printf("Calling pmFindImagePeaks with PS_TYPE_F64 psImage. Should generate error and return NULL.\n"); 455 tmpList = pmFindImagePeaks(tmpImageF64, 0.0); 454 456 if (tmpList != NULL) { 455 printf("TEST ERROR: pmFindImagePe eks() returned a non-NULL psImage.\n");457 printf("TEST ERROR: pmFindImagePeaks() returned a non-NULL psImage.\n"); 456 458 testStatus = false; 457 459 psFree(tmpList); 458 460 } 459 461 printf("----------------------------------------------------------------------------------\n"); 460 // testStatus&= test_pmFindImagePe eks(1, 1);461 // testStatus&= test_pmFindImagePe eks(2, 5);462 // testStatus&= test_pmFindImagePe eks(5, 2);463 testStatus&= test_pmFindImagePe eks(10, 10);462 // testStatus&= test_pmFindImagePeaks(1, 1); 463 // testStatus&= test_pmFindImagePeaks(2, 5); 464 // testStatus&= test_pmFindImagePeaks(5, 2); 465 testStatus&= test_pmFindImagePeaks(10, 10); 464 466 465 467 … … 470 472 471 473 /****************************************************************************** 472 test03(): We first test pmCullPe eks() with various NULL and unallowable input473 parameters. Then we generate a list of peaks and test that pmCullPe eks()474 test03(): We first test pmCullPeaks() with various NULL and unallowable input 475 parameters. Then we generate a list of peaks and test that pmCullPeaks() 474 476 removes them correctly. 475 477 *****************************************************************************/ … … 481 483 482 484 printf("----------------------------------------------------------------------------------\n"); 483 printf("Calling pmCullPe eks with NULL psList. Should generate error and return NULL.\n");484 outData = pmCullPe eks(NULL, 0.0, NULL);485 printf("Calling pmCullPeaks with NULL psList. Should generate error and return NULL.\n"); 486 outData = pmCullPeaks(NULL, 0.0, NULL); 485 487 if (outData != NULL) { 486 printf("TEST ERROR: pmCulPe eks() returned a non-NULL psList.\n");488 printf("TEST ERROR: pmCulPeaks() returned a non-NULL psList.\n"); 487 489 testStatus = false; 488 490 } … … 512 514 513 515 // 514 // Call pmCullPe eks() with HUGE maxValue and NULL psRegion. Should not516 // Call pmCullPeaks() with HUGE maxValue and NULL psRegion. Should not 515 517 // remove any peaks. 516 518 // 517 519 printf("----------------------------------------------------------------------------------\n"); 518 printf("Calling pmCullPe eks with large maxValue and NULL psRegion.\n");519 outData = pmFindImagePe eks(imgData, 0.0);520 outData = pmCullPe eks(outData, PS_MAX_F32, NULL);520 printf("Calling pmCullPeaks with large maxValue and NULL psRegion.\n"); 521 outData = pmFindImagePeaks(imgData, 0.0); 522 outData = pmCullPeaks(outData, PS_MAX_F32, NULL); 521 523 522 524 if (outData == NULL) { 523 printf("TEST ERROR: pmCullPe eks() returned a non-NULL psList.\n");525 printf("TEST ERROR: pmCullPeaks() returned a non-NULL psList.\n"); 524 526 testStatus = false; 525 527 return(testStatus); 526 528 } 527 529 if (outData->size != numPeaksOrig) { 528 printf("TEST ERROR (0): pmCullPe eks incorrectly removed peaks\n");529 printf("The pmCullPe eks() output had %d peaks, should have had %d peaks.\n", outData->size, numPeaksOrig);530 printf("TEST ERROR (0): pmCullPeaks incorrectly removed peaks\n"); 531 printf("The pmCullPeaks() output had %d peaks, should have had %d peaks.\n", outData->size, numPeaksOrig); 530 532 testStatus = false; 531 533 } … … 533 535 534 536 // 535 // Call pmCullPe eks() with TINY maxValue and NULL psRegion. Should537 // Call pmCullPeaks() with TINY maxValue and NULL psRegion. Should 536 538 // remove all peaks. 537 539 // 538 540 printf("----------------------------------------------------------------------------------\n"); 539 printf("Calling pmCullPe eks with tiny maxValue and NULL psRegion.\n");540 outData = pmFindImagePe eks(imgData, 0.0);541 printf("pmFindImagePe eks found %d peaks\n", outData->size);542 outData = pmCullPe eks(outData, 0.0, NULL);541 printf("Calling pmCullPeaks with tiny maxValue and NULL psRegion.\n"); 542 outData = pmFindImagePeaks(imgData, 0.0); 543 printf("pmFindImagePeaks found %d peaks\n", outData->size); 544 outData = pmCullPeaks(outData, 0.0, NULL); 543 545 544 546 if (outData == NULL) { 545 printf("TEST ERROR: pmCullPe eks() returned a non-NULL psList.\n");547 printf("TEST ERROR: pmCullPeaks() returned a non-NULL psList.\n"); 546 548 testStatus = false; 547 549 return(testStatus); 548 550 } 549 551 if (outData->size != 0) { 550 printf("TEST ERROR (1): pmCullPe eks incorrectly removed peaks\n");551 printf("The pmCullPe eks() output had %d peaks, should have had %d peaks.\n", outData->size, 0);552 printf("TEST ERROR (1): pmCullPeaks incorrectly removed peaks\n"); 553 printf("The pmCullPeaks() output had %d peaks, should have had %d peaks.\n", outData->size, 0); 552 554 testStatus = false; 553 555 } … … 555 557 556 558 // 557 // Call pmCullPe eks() with HUGE maxValue and disjoint psRegion. Should559 // Call pmCullPeaks() with HUGE maxValue and disjoint psRegion. Should 558 560 // not remove any peaks. 559 561 // 560 562 printf("----------------------------------------------------------------------------------\n"); 561 printf("Calling pmCullPe eks with large maxValue and disjoint psRegion.\n");562 outData = pmFindImagePe eks(imgData, 0.0);563 printf("pmFindImagePe eks found %d peaks\n", outData->size);563 printf("Calling pmCullPeaks with large maxValue and disjoint psRegion.\n"); 564 outData = pmFindImagePeaks(imgData, 0.0); 565 printf("pmFindImagePeaks found %d peaks\n", outData->size); 564 566 psRegion *tmpRegion = psRegionAlloc(10000.0, 20000.0, 10000.0, 20000.0); 565 outData = pmCullPe eks(outData, PS_MAX_F32, tmpRegion);567 outData = pmCullPeaks(outData, PS_MAX_F32, tmpRegion); 566 568 567 569 if (outData == NULL) { 568 printf("TEST ERROR: pmCullPe eks() returned a non-NULL psList.\n");570 printf("TEST ERROR: pmCullPeaks() returned a non-NULL psList.\n"); 569 571 testStatus = false; 570 572 return(testStatus); 571 573 } 572 574 if (outData->size != numPeaksOrig) { 573 printf("TEST ERROR (2): pmCullPe eks incorrectly removed peaks\n");574 printf("The pmCullPe eks() output had %d peaks, should have had %d peaks.\n", outData->size, numPeaksOrig);575 printf("TEST ERROR (2): pmCullPeaks incorrectly removed peaks\n"); 576 printf("The pmCullPeaks() output had %d peaks, should have had %d peaks.\n", outData->size, numPeaksOrig); 575 577 testStatus = false; 576 578 } … … 579 581 580 582 // 581 // Call pmCullPe eks() with HUGE maxValue and non-disjoint psRegion. Should583 // Call pmCullPeaks() with HUGE maxValue and non-disjoint psRegion. Should 582 584 // remove all peaks. 583 585 // 584 586 printf("----------------------------------------------------------------------------------\n"); 585 printf("Calling pmCullPe eks with large maxValue and non-disjoint psRegion.\n");586 outData = pmFindImagePe eks(imgData, 0.0);587 printf("pmFindImagePe eks found %d peaks\n", outData->size);587 printf("Calling pmCullPeaks with large maxValue and non-disjoint psRegion.\n"); 588 outData = pmFindImagePeaks(imgData, 0.0); 589 printf("pmFindImagePeaks found %d peaks\n", outData->size); 588 590 tmpRegion = psRegionAlloc(-PS_MAX_F32, PS_MAX_F32, -PS_MAX_F32, PS_MAX_F32); 589 outData = pmCullPe eks(outData, PS_MAX_F32, tmpRegion);591 outData = pmCullPeaks(outData, PS_MAX_F32, tmpRegion); 590 592 591 593 if (outData == NULL) { 592 printf("TEST ERROR: pmCullPe eks() returned a non-NULL psList.\n");594 printf("TEST ERROR: pmCullPeaks() returned a non-NULL psList.\n"); 593 595 testStatus = false; 594 596 return(testStatus); 595 597 } 596 598 if (outData->size != 0) { 597 printf("TEST ERROR (3): pmCullPe eks incorrectly removed peaks\n");598 printf("The pmCullPe eks() output had %d peaks, should have had %d peaks.\n", outData->size, 0);599 printf("TEST ERROR (3): pmCullPeaks incorrectly removed peaks\n"); 600 printf("The pmCullPeaks() output had %d peaks, should have had %d peaks.\n", outData->size, 0); 599 601 testStatus = false; 600 602 }
Note:
See TracChangeset
for help on using the changeset viewer.
