IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 30, 2006, 10:28:34 AM (20 years ago)
Author:
drobbin
Message:

Added type support in Metadata for s8,s16,u8-32. Edited PixelsTransform and test. Added types to DataType.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/astro/tst_psCoord.c

    r5549 r6251  
    66*  @author GLG, MHPCC
    77*
    8 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2005-11-18 21:23:21 $
     8*  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2006-01-30 20:28:34 $
    1010*
    1111*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    1818static psS32 testPlaneTransformApply(void);
    1919static psS32 testPlaneDistortApply(void);
     20static psS32 testPixelsTransform(void);
    2021
    2122testDescription tests[] = {
     
    2425                              {testPlaneTransformApply, 831, "psPlaneTransformApply()", 0, false},
    2526                              {testPlaneDistortApply, 832, "psPlaneDistortApply()", 0, false},
     27                              {testPixelsTransform, 833, "psPixelsTransform()", 0, false},
    2628                              {NULL}
    2729                          };
     
    371373}
    372374
     375psS32 testPixelsTransform(void)
     376{
     377    psPixels *input = NULL;
     378    psPixels *output = NULL;
     379    psPlaneTransform *trans = psPlaneTransformAlloc(2, 0);
     380
     381    //Return NULL for NULL input pixels
     382    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
     383    output = psPixelsTransform(output, input, trans);
     384    if (output != NULL) {
     385        psError(PS_ERR_BAD_PARAMETER_NULL, false,
     386                "psPixelsTransform failed to return NULL for NULL input pixels.\n");
     387        return 1;
     388    }
     389    //Return NULL for NULL input PlaneTransform
     390    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
     391    output = psPixelsTransform(output, input, NULL);
     392    if (output != NULL) {
     393        psError(PS_ERR_BAD_PARAMETER_NULL, false,
     394                "psPixelsTransform failed to return NULL for NULL psPlaneTransform.\n");
     395        return 2;
     396    }
     397
     398    input = psPixelsAlloc(5);
     399    /*    for (int i = 0; i < 2; i++) {
     400            input->data[i].x = i*1.0;
     401            input->data[i].y = i*1.0;
     402        }
     403    */
     404    input->data[0].x = 1.0;
     405    input->data[0].y = 2.0;
     406    input->data[1].x = 1.0;
     407    input->data[1].y = 3.0;
     408    trans->x->nX = 1;
     409    trans->x->nY = 0;
     410    trans->y->nX = 1;
     411    trans->y->nY = 0;
     412    trans->x->coeff[0][0] = 0;
     413    trans->x->coeff[1][0] = 1;
     414    trans->y->coeff[0][0] = 0;
     415    trans->y->coeff[1][0] = 2;
     416
     417    //Verify that the output pixels are what we expected
     418    output = psPixelsTransform(output, input, trans);
     419    printf("\n output return %ld pixels\n\n", output->n);
     420    int nExpected = 1;
     421    if (output->n != nExpected) {
     422        psError(PS_ERR_BAD_PARAMETER_SIZE, false,
     423                "psPixelsTransform failed to return the expected number of pixels.\n");
     424        return 3;
     425    }
     426
     427    psFree(input);
     428    psFree(output);
     429    psFree(trans);
     430
     431    return 0;
     432}
     433
Note: See TracChangeset for help on using the changeset viewer.