Changeset 4291
- Timestamp:
- Jun 16, 2005, 1:13:43 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psModules/test/tst_pmImageCombine.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/test/tst_pmImageCombine.c
r4218 r4291 7 7 * @author GLG, MHPCC 8 8 * 9 * @version $Revision: 1.1 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-06-13 19:36:46 $ 9 * XXX: Must verify the results internally. Don't use stdout file. 10 * 11 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-06-16 23:13:43 $ 11 13 * 12 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 16 18 #include "pmImageCombine.h" 17 19 static int test00(void); 18 static int test01(void);19 20 testDescription tests[] = { 20 21 {test00, 000, "pmCombineImages()", true, false}, 21 {test01, 000, "pmRejectPixels()", true, false},22 22 {NULL} 23 23 }; … … 28 28 } 29 29 30 #define TST01_EXPANSION_FACTOR_X 1.031 #define TST01_EXPANSION_FACTOR_Y 1.032 #define TST01_OFFSET_X 0.033 #define TST01_OFFSET_Y 0.034 35 30 psF32 genRanFloat(psF32 low, 36 31 psF32 high) … … 47 42 } 48 43 44 #define TST00_EXPANSION_FACTOR_X 1.0 45 #define TST00_EXPANSION_FACTOR_Y 1.0 46 #define TST00_OFFSET_X 0.0 47 #define TST00_OFFSET_Y 0.0 49 48 #define TST00_NUM_PIXELS 10 50 49 #define TST00_MASK_VALUE 1 51 50 #define TST00_NUM_ITERATIONS 4 52 51 #define TST00_SIGMA_CLIP 1.0 52 #define TST00_REJECTION_THRESHOLD 0.01 53 #define TST00_GRADIENT_LIMIT 10.0 53 54 /******************************************************************************* 54 55 NOTE: This function returns FALSE if there were no errors. … … 148 149 psImage *image = (psImage *) images->data[im]; 149 150 image->data.F32[row][col] += 100.0; 151 printf("Generating a bad pixel in image (%d) at (%d, %d)\n", im, row, col); 150 152 } 151 153 … … 281 283 for (psS32 im = 0 ; im < numImages ; im++) { 282 284 psPlaneTransform *ptExpand = psPlaneTransformAlloc(2, 2); 283 ptExpand->x->coeff[0][0] = TST0 1_OFFSET_X;284 ptExpand->x->coeff[1][0] = TST0 1_EXPANSION_FACTOR_X;285 ptExpand->y->coeff[0][0] = TST0 1_OFFSET_Y;286 ptExpand->y->coeff[0][1] = TST0 1_EXPANSION_FACTOR_Y;285 ptExpand->x->coeff[0][0] = TST00_OFFSET_X; 286 ptExpand->x->coeff[1][0] = TST00_EXPANSION_FACTOR_X; 287 ptExpand->y->coeff[0][0] = TST00_OFFSET_Y; 288 ptExpand->y->coeff[0][1] = TST00_EXPANSION_FACTOR_Y; 287 289 expandTransforms->data[im] = (psPtr *) ptExpand; 288 290 289 291 psPlaneTransform *ptContract = psPlaneTransformAlloc(2, 2); 290 ptContract->x->coeff[0][0] = -TST0 1_OFFSET_X;291 ptContract->x->coeff[1][0] = 1.0 / TST0 1_EXPANSION_FACTOR_X;292 ptContract->y->coeff[0][0] = -TST0 1_OFFSET_Y;293 ptContract->y->coeff[0][1] = 1.0 / TST0 1_EXPANSION_FACTOR_Y;292 ptContract->x->coeff[0][0] = -TST00_OFFSET_X; 293 ptContract->x->coeff[1][0] = 1.0 / TST00_EXPANSION_FACTOR_X; 294 ptContract->y->coeff[0][0] = -TST00_OFFSET_Y; 295 ptContract->y->coeff[0][1] = 1.0 / TST00_EXPANSION_FACTOR_Y; 294 296 contractTransforms->data[im] = (psPtr *) ptContract; 295 297 } … … 300 302 // We exclude this from our tests. 301 303 // 302 if (0) { 303 printf("\n\n\nCalling pmRejectPixels() with acceptable data. Should generate a psArray.\n"); 304 psArray *pixelRejects = pmRejectPixels(images, questionablePixels, expandTransforms, 305 contractTransforms, 1.0, 1.0); 306 if (pixelRejects == NULL) { 307 printf("TEST ERROR: pmCombineImages() returned a NULL psArray.\n"); 308 testStatus = true; 309 } else { 310 // XXX: We should internally verify this with the pixels list, not merely use the stdout. 311 for (psS32 i = 0 ; i < pixelRejects->n ; i++) { 312 psPixels *myPixels = (psPixels *) pixelRejects->data[i]; 313 printf("Image %d had %d rejects.\n", i, myPixels->n); 314 } 315 psFree(pixelRejects); 316 } 304 printf("\n\n\nCalling pmRejectPixels() with acceptable data. Should generate a psArray.\n"); 305 psArray *pixelRejects = pmRejectPixels(images, questionablePixels, expandTransforms, 306 contractTransforms, TST00_REJECTION_THRESHOLD, 307 TST00_GRADIENT_LIMIT); 308 if (pixelRejects == NULL) { 309 printf("TEST ERROR: pmCombineImages() returned a NULL psArray.\n"); 310 testStatus = true; 311 } else { 312 // XXX: We should internally verify this with the pixels list, not merely use the stdout. 313 for (psS32 i = 0 ; i < pixelRejects->n ; i++) { 314 psPixels *myPixels = (psPixels *) pixelRejects->data[i]; 315 printf("tst_pmImageCombine.c: Image %d had %d rejects.\n", i, myPixels->n); 316 317 for (psS32 p = 0 ; p < myPixels->n ; p++) { 318 printf("Image %d, rejected pixel %d is (%d %d)\n", i, p, 319 myPixels->data[p].y, myPixels->data[p].x); 320 } 321 } 322 psFree(pixelRejects); 317 323 } 318 324 … … 343 349 return(!testStatus); 344 350 } 345 346 /*******************************************************************************347 NOTE: This function returns FALSE if there were no errors.348 349 XXX: This function will probably disappear. Because of the tight dependence350 on the pmImageCombine() function, it's probably best to test the351 pmRejectPixels() function there.352 ******************************************************************************/353 psBool testRejectPixels(psS32 numRows,354 psS32 numCols,355 psS32 numImages,356 psF32 rejThreshold,357 psF32 gradLimit)358 359 {360 printf("Testing pmRejectPixels(%d, %d, %d, %f, %f)\n",361 numRows, numCols, numImages, rejThreshold, gradLimit);362 bool testStatus = false;363 364 return(testStatus);365 }366 367 /*******************************************************************************368 NOTE: This function returns TRUE if there were no errors.369 ******************************************************************************/370 int test01( void )371 {372 bool testStatus = false;373 374 testStatus|= testRejectPixels(10, 10, 5, 1.0, 1.0);375 376 return(!testStatus);377 }
Note:
See TracChangeset
for help on using the changeset viewer.
