IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4291


Ignore:
Timestamp:
Jun 16, 2005, 1:13:43 PM (21 years ago)
Author:
gusciora
Message:

...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/test/tst_pmImageCombine.c

    r4218 r4291  
    77 *  @author GLG, MHPCC
    88 *
    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 $
    1113 *
    1214 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1618#include "pmImageCombine.h"
    1719static int test00(void);
    18 static int test01(void);
    1920testDescription tests[] = {
    2021                              {test00, 000, "pmCombineImages()", true, false},
    21                               {test01, 000, "pmRejectPixels()",  true, false},
    2222                              {NULL}
    2323                          };
     
    2828}
    2929
    30 #define TST01_EXPANSION_FACTOR_X 1.0
    31 #define TST01_EXPANSION_FACTOR_Y 1.0
    32 #define TST01_OFFSET_X 0.0
    33 #define TST01_OFFSET_Y 0.0
    34 
    3530psF32 genRanFloat(psF32 low,
    3631                  psF32 high)
     
    4742}
    4843
     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
    4948#define TST00_NUM_PIXELS 10
    5049#define TST00_MASK_VALUE 1
    5150#define TST00_NUM_ITERATIONS 4
    5251#define TST00_SIGMA_CLIP 1.0
     52#define TST00_REJECTION_THRESHOLD 0.01
     53#define TST00_GRADIENT_LIMIT 10.0
    5354/*******************************************************************************
    5455NOTE: This function returns FALSE if there were no errors.
     
    148149        psImage *image = (psImage *) images->data[im];
    149150        image->data.F32[row][col] += 100.0;
     151        printf("Generating a bad pixel in image (%d) at (%d, %d)\n", im, row, col);
    150152    }
    151153
     
    281283    for (psS32 im = 0 ; im < numImages ; im++) {
    282284        psPlaneTransform *ptExpand = psPlaneTransformAlloc(2, 2);
    283         ptExpand->x->coeff[0][0] = TST01_OFFSET_X;
    284         ptExpand->x->coeff[1][0] = TST01_EXPANSION_FACTOR_X;
    285         ptExpand->y->coeff[0][0] = TST01_OFFSET_Y;
    286         ptExpand->y->coeff[0][1] = TST01_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;
    287289        expandTransforms->data[im] = (psPtr *) ptExpand;
    288290
    289291        psPlaneTransform *ptContract = psPlaneTransformAlloc(2, 2);
    290         ptContract->x->coeff[0][0] = -TST01_OFFSET_X;
    291         ptContract->x->coeff[1][0] = 1.0 / TST01_EXPANSION_FACTOR_X;
    292         ptContract->y->coeff[0][0] = -TST01_OFFSET_Y;
    293         ptContract->y->coeff[0][1] = 1.0 / TST01_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;
    294296        contractTransforms->data[im] = (psPtr *) ptContract;
    295297    }
     
    300302    // We exclude this from our tests.
    301303    //
    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);
    317323    }
    318324
     
    343349    return(!testStatus);
    344350}
    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 dependence
    350 on the pmImageCombine() function, it's probably best to test the
    351 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.