IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 28, 2005, 3:15:38 PM (21 years ago)
Author:
drobbin
Message:

Added fxns psImageRow/Col and tests. Updated psList struct to add void *lock.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/imageops/tst_psImagePixelExtract.c

    r4547 r5174  
    66*  @author Robert DeSonia, MHPCC
    77*
    8 *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2005-07-13 02:47:00 $
     8*  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2005-09-29 01:15:38 $
    1010*
    1111*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2121static psS32 testImageCut(void);
    2222static psS32 testImageRadialCut(void);
     23static psS32 testImageRowCol(void);
    2324
    2425
     
    2728                              {testImageCut, 555, "psImageCut", 0, false},
    2829                              {testImageRadialCut, 557, "psImageRadialCut", 0, false},
     30                              {testImageRowCol, 559, "psImageRowCol", 0, false},
    2931                              {NULL}
    3032                          };
     
    742744    return 0;
    743745}
     746
     747psS32 testImageRowCol(void)
     748{
     749    psVector *rowcol = NULL;
     750    psVector *empty = NULL;
     751    psImage *image = NULL;
     752    psImage *emptyImage = NULL;
     753
     754    image = psImageAlloc(3, 3, PS_TYPE_F64);
     755    rowcol = psVectorAlloc(3, PS_TYPE_F64);
     756
     757    image->data.F64[0][0] = 666.666;
     758    image->data.F64[1][0] = 66.6;
     759    image->data.F64[2][0] = 6.66;
     760    image->data.F64[0][1] = 6.6;
     761    image->data.F64[1][1] = 6.666;
     762    image->data.F64[2][1] = 66.666;
     763    image->data.F64[0][2] = 666.6;
     764    image->data.F64[1][2] = 666.66;
     765    image->data.F64[2][2] = 66.66;
     766
     767    //Test for error with NULL image
     768    empty = psImageCol(empty, emptyImage, 0);
     769    if (empty != NULL) {
     770        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
     771                "psImageCol failed to return NULL for NULL image input.\n");
     772        return 1;
     773    }
     774    //Test for error with Out of Range Row
     775    empty = psImageRow(empty, image, 5);
     776    if (empty != NULL) {
     777        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
     778                "psImageRow failed to return NULL for out of range row input.\n");
     779        return 2;
     780    }
     781    rowcol->data.F64[0] = 1.1;
     782    rowcol->data.F64[2] = 2.2;
     783    //Test recycling of non-NULL vector & correct output
     784    rowcol = psImageCol(rowcol, image, 1);
     785    if (rowcol->data.F64[0] != 66.6 && rowcol->data.F64[2] != 666.66) {
     786        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
     787                "psImageCol failed to return correct values.\n");
     788        return 3;
     789    }
     790
     791    psFree(rowcol);
     792    psFree(image);
     793    return 0;
     794}
     795
Note: See TracChangeset for help on using the changeset viewer.