IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3977 for trunk/psLib


Ignore:
Timestamp:
May 18, 2005, 7:18:20 PM (21 years ago)
Author:
desonia
Message:

fixes to psRegion.

Location:
trunk/psLib
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astro/psCoord.c

    r3884 r3977  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.66 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2005-05-11 22:02:15 $
     12*  @version $Revision: 1.67 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2005-05-19 05:18:20 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    876876psPlaneTransform *psPlaneTransformCombine(psPlaneTransform *out,
    877877        const psPlaneTransform *trans1,
    878         const psPlaneTransform *trans2)
    879 {
     878        const psPlaneTransform *trans2,
     879        psRegion region,
     880        int nSamples)
     881{
     882
     883    // XXX: This does not yet use region and nSamples:  need to modify -rdd
     884
    880885    PS_PTR_CHECK_NULL(trans1, NULL);
    881886    PS_PTR_CHECK_NULL(trans2, NULL);
     
    11281133psPlaneTransform *psPlaneTransformInvert(psPlaneTransform *out,
    11291134        const psPlaneTransform *in,
    1130         psRegion *region,
     1135        psRegion region,
    11311136        int nSamples)
    11321137{
     
    11381143        return(p_psPlaneTransformLinearInvert((psPlaneTransform *) in));
    11391144    }
    1140     PS_PTR_CHECK_NULL(region, NULL);
    11411145    PS_INT_COMPARE(1, nSamples, NULL);
    11421146
     
    11971201    psS32 cnt = 0;
    11981202    for (int yint = 0; yint < nSamples; yint++) {
    1199         inCoord->y = region->y0 + ((psF32) yint) * ((region->y1 - region->y0) / ((psF32) nSamples));
     1203        inCoord->y = region.y0 + ((psF32) yint) * ((region.y1 - region.y0) / ((psF32) nSamples));
    12001204        for (int xint = 0; xint < nSamples; xint++) {
    1201             inCoord->x = region->x0 + ((psF32) xint) * ((region->x1 - region->x0) / ((psF32) nSamples));
     1205            inCoord->x = region.x0 + ((psF32) xint) * ((region.x1 - region.x0) / ((psF32) nSamples));
    12021206            (void)psPlaneTransformApply(outCoord, in, inCoord);
    12031207
  • trunk/psLib/src/astro/psCoord.h

    r3598 r3977  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2005-03-31 23:01:46 $
     12*  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2005-05-19 05:18:20 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    383383    psPlaneTransform *out,             ///< a transform to recycle, or NULL if one is to be created.
    384384    const psPlaneTransform *in,        ///< transform to invert
    385     psRegion *region,                  ///< region to fit for non-linear transform inversion
     385    psRegion region,                   ///< region to fit for non-linear transform inversion
    386386    int nSamples                       ///< number of samples in each axis for fit
    387387);
     
    404404    psPlaneTransform *out,             ///< a transform to recycle, or NULL if one is to be created.
    405405    const psPlaneTransform *trans1,    ///< first transform to combine
    406     const psPlaneTransform *trans2     ///< first transform to combine
     406    const psPlaneTransform *trans2,    ///< first transform to combine
     407    psRegion region,                   ///< region to cover (for non-linear transforms)
     408    int nSamples                       ///< number of samples on each axis (for non-linear transforms)
    407409);
    408410
     
    431433    float sigmaClip
    432434);
     435//XXX: need to add doxygen comments on the parameters above. -rdd
    433436
    434437/// @}
  • trunk/psLib/src/astronomy/psCoord.c

    r3884 r3977  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.66 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2005-05-11 22:02:15 $
     12*  @version $Revision: 1.67 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2005-05-19 05:18:20 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    876876psPlaneTransform *psPlaneTransformCombine(psPlaneTransform *out,
    877877        const psPlaneTransform *trans1,
    878         const psPlaneTransform *trans2)
    879 {
     878        const psPlaneTransform *trans2,
     879        psRegion region,
     880        int nSamples)
     881{
     882
     883    // XXX: This does not yet use region and nSamples:  need to modify -rdd
     884
    880885    PS_PTR_CHECK_NULL(trans1, NULL);
    881886    PS_PTR_CHECK_NULL(trans2, NULL);
     
    11281133psPlaneTransform *psPlaneTransformInvert(psPlaneTransform *out,
    11291134        const psPlaneTransform *in,
    1130         psRegion *region,
     1135        psRegion region,
    11311136        int nSamples)
    11321137{
     
    11381143        return(p_psPlaneTransformLinearInvert((psPlaneTransform *) in));
    11391144    }
    1140     PS_PTR_CHECK_NULL(region, NULL);
    11411145    PS_INT_COMPARE(1, nSamples, NULL);
    11421146
     
    11971201    psS32 cnt = 0;
    11981202    for (int yint = 0; yint < nSamples; yint++) {
    1199         inCoord->y = region->y0 + ((psF32) yint) * ((region->y1 - region->y0) / ((psF32) nSamples));
     1203        inCoord->y = region.y0 + ((psF32) yint) * ((region.y1 - region.y0) / ((psF32) nSamples));
    12001204        for (int xint = 0; xint < nSamples; xint++) {
    1201             inCoord->x = region->x0 + ((psF32) xint) * ((region->x1 - region->x0) / ((psF32) nSamples));
     1205            inCoord->x = region.x0 + ((psF32) xint) * ((region.x1 - region.x0) / ((psF32) nSamples));
    12021206            (void)psPlaneTransformApply(outCoord, in, inCoord);
    12031207
  • trunk/psLib/src/astronomy/psCoord.h

    r3598 r3977  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2005-03-31 23:01:46 $
     12*  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2005-05-19 05:18:20 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    383383    psPlaneTransform *out,             ///< a transform to recycle, or NULL if one is to be created.
    384384    const psPlaneTransform *in,        ///< transform to invert
    385     psRegion *region,                  ///< region to fit for non-linear transform inversion
     385    psRegion region,                   ///< region to fit for non-linear transform inversion
    386386    int nSamples                       ///< number of samples in each axis for fit
    387387);
     
    404404    psPlaneTransform *out,             ///< a transform to recycle, or NULL if one is to be created.
    405405    const psPlaneTransform *trans1,    ///< first transform to combine
    406     const psPlaneTransform *trans2     ///< first transform to combine
     406    const psPlaneTransform *trans2,    ///< first transform to combine
     407    psRegion region,                   ///< region to cover (for non-linear transforms)
     408    int nSamples                       ///< number of samples on each axis (for non-linear transforms)
    407409);
    408410
     
    431433    float sigmaClip
    432434);
     435//XXX: need to add doxygen comments on the parameters above. -rdd
    433436
    434437/// @}
  • trunk/psLib/src/dataIO/psFits.c

    r3970 r3977  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-05-19 02:09:39 $
     9 *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-05-19 05:18:20 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    10051005    if (dx != numCols || dy != numRows) {
    10061006        // the input image needs to be subsetted
    1007         subset = psImageSubset((psImage*)input,(psRegion) {
    1008                                    0,0,dx+1,dy+1
    1009                                }
    1010                               );
     1007        subset = psImageSubset((psImage*)input, psRegionSet(0,dx+1,0,dy+1));
    10111008    } else {
    10121009        subset = psMemIncrRefCounter((psImage*)input);
  • trunk/psLib/src/dataManip/psMinimize.c

    r3884 r3977  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.116 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-05-11 22:02:16 $
     11 *  @version $Revision: 1.117 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-05-19 05:18:20 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2626#include "psMinimize.h"
    2727#include "psStats.h"
     28#include "psImage.h"
     29#include "psImageStructManip.h"
    2830#include "psImageIO.h"
    2931/*****************************************************************************/
  • trunk/psLib/src/fft/psImageFFT.c

    r3968 r3977  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2005-05-19 02:08:21 $
     7 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-05-19 05:18:20 $
    99 *
    1010 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2020#include "psLogMsg.h"
    2121#include "psImageIO.h"
     22#include "psImageStructManip.h"
    2223
    2324#include "psImageErrors.h"
  • trunk/psLib/src/fits/psFits.c

    r3970 r3977  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-05-19 02:09:39 $
     9 *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-05-19 05:18:20 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    10051005    if (dx != numCols || dy != numRows) {
    10061006        // the input image needs to be subsetted
    1007         subset = psImageSubset((psImage*)input,(psRegion) {
    1008                                    0,0,dx+1,dy+1
    1009                                }
    1010                               );
     1007        subset = psImageSubset((psImage*)input, psRegionSet(0,dx+1,0,dy+1));
    10111008    } else {
    10121009        subset = psMemIncrRefCounter((psImage*)input);
  • trunk/psLib/src/image/psImage.c

    r3786 r3977  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.65 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-04-29 02:25:10 $
     11 *  @version $Revision: 1.66 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-05-19 05:18:20 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    9191}
    9292
    93 psRegion* psRegionAlloc(psF32 x0,
    94                         psF32 x1,
    95                         psF32 y0,
    96                         psF32 y1)
    97 {
    98     psRegion* out = psAlloc(sizeof(psRegion));
    99 
    100     out->x0 = x0;
    101     out->y0 = y0;
    102     out->x1 = x1;
    103     out->y1 = y1;
     93psRegion psRegionSet(psF32 x0,
     94                     psF32 x1,
     95                     psF32 y0,
     96                     psF32 y1)
     97{
     98    psRegion out;
     99
     100    out.x0 = x0;
     101    out.y0 = y0;
     102    out.x1 = x1;
     103    out.y1 = y1;
    104104
    105105    return out;
    106106}
    107107
    108 psRegion* psRegionFromString(char* region)
     108psRegion psRegionFromString(char* region)
    109109{
    110110    psS32 col0;
     
    117117        psError(PS_ERR_BAD_PARAMETER_NULL, true,
    118118                PS_ERRORTEXT_psImage_SUBSECTION_NULL);
    119         return NULL;
     119        return psRegionSet(NAN,NAN,NAN,NAN);
    120120    }
    121121
     
    124124                PS_ERRORTEXT_psImage_SUBSECTION_INVALID,
    125125                region);
    126         return NULL;
     126        return psRegionSet(NAN,NAN,NAN,NAN);
    127127    }
    128128
     
    131131                PS_ERRORTEXT_psImage_SUBSET_RANGE_MALFORMED,
    132132                col0,col1,row0,row1);
    133         return NULL;
    134     }
    135 
    136     return psRegionAlloc(col0,col1,row0,row1);
    137 }
    138 
    139 char* psRegionToString(psRegion* region)
     133        return psRegionSet(NAN,NAN,NAN,NAN);
     134    }
     135
     136    return psRegionSet(col0,col1,row0,row1);
     137}
     138
     139char* psRegionToString(psRegion region)
    140140{
    141141    char tmpText[256]; // big enough to store any region as text
    142142
    143     if (region == NULL) {
    144         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    145                 PS_ERRORTEXT_psImage_REGION_NULL);
    146         return NULL;
    147     }
    148 
    149143    snprintf(tmpText,256,"[%g:%g,%g:%g]",
    150              region->x0, region->x1,
    151              region->y0, region->y1);
     144             region.x0, region.x1,
     145             region.y0, region.y1);
    152146
    153147    return psStringCopy(tmpText);
     
    195189
    196190    return old;
    197 }
    198 
    199 psImage* psImageCopy(psImage* output,
    200                      const psImage* input,
    201                      psElemType type)
    202 {
    203     psElemType inDatatype;
    204     psS32 elementSize;
    205     psS32 elements;
    206     psS32 numRows;
    207     psS32 numCols;
    208 
    209     if (input == NULL || input->data.V == NULL) {
    210         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    211                 PS_ERRORTEXT_psImage_IMAGE_NULL);
    212         psFree(output);
    213         return NULL;
    214     }
    215 
    216     if (input == output) {
    217         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    218                 PS_ERRORTEXT_psImage_INPLACE_NOTSUPPORTED);
    219         psFree(output);
    220         return NULL;
    221     }
    222 
    223     if (input->type.dimen != PS_DIMEN_IMAGE) {
    224         psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    225                 PS_ERRORTEXT_psImage_NOT_AN_IMAGE);
    226         psFree(output);
    227         return NULL;
    228     }
    229 
    230     inDatatype = input->type.type;
    231     numRows = input->numRows;
    232     numCols = input->numCols;
    233     elements = numRows * numCols;
    234     elementSize = PSELEMTYPE_SIZEOF(inDatatype);
    235 
    236     output = psImageRecycle(output, numCols, numRows, type);
    237 
    238     // cover the trival case of copy of the same
    239     // datatype.
    240     if (type == inDatatype) {
    241         for (psS32 row=0;row<numRows;row++) {
    242             memcpy(output->data.V[row], input->data.V[row], elementSize * numCols);
    243         }
    244         return output;
    245     }
    246 
    247     #define PSIMAGE_ELEMENT_COPY(IN,INTYPE,OUT,OUTTYPE,ELEMENTS) { \
    248         ps##INTYPE *in; \
    249         ps##OUTTYPE *out; \
    250         for(psS32 row=0;row<numRows;row++) { \
    251             in = IN->data.INTYPE[row]; \
    252             out = OUT->data.OUTTYPE[row]; \
    253             for (psS32 col=0;col<numCols;col++) { \
    254                 *(out++) = *(in++); \
    255             } \
    256         } \
    257     }
    258 
    259     #define PSIMAGE_COPY_CASE(OUT,OUTTYPE) { \
    260         switch (inDatatype) { \
    261         case PS_TYPE_S8: \
    262             PSIMAGE_ELEMENT_COPY(input,S8,OUT,OUTTYPE,elements); \
    263             break; \
    264         case PS_TYPE_S16: \
    265             PSIMAGE_ELEMENT_COPY(input,S16,OUT,OUTTYPE,elements); \
    266             break; \
    267         case PS_TYPE_S32: \
    268             PSIMAGE_ELEMENT_COPY(input,S32,OUT,OUTTYPE,elements); \
    269             break; \
    270         case PS_TYPE_S64: \
    271             PSIMAGE_ELEMENT_COPY(input,S64,OUT,OUTTYPE,elements); \
    272             break; \
    273         case PS_TYPE_U8: \
    274             PSIMAGE_ELEMENT_COPY(input,U8,OUT,OUTTYPE,elements); \
    275             break; \
    276         case PS_TYPE_U16: \
    277             PSIMAGE_ELEMENT_COPY(input,U16,OUT,OUTTYPE,elements); \
    278             break; \
    279         case PS_TYPE_U32: \
    280             PSIMAGE_ELEMENT_COPY(input,U32,OUT,OUTTYPE,elements); \
    281             break; \
    282         case PS_TYPE_U64: \
    283             PSIMAGE_ELEMENT_COPY(input,U64,OUT,OUTTYPE,elements); \
    284             break; \
    285         case PS_TYPE_F32: \
    286             PSIMAGE_ELEMENT_COPY(input,F32,OUT,OUTTYPE,elements); \
    287             break; \
    288         case PS_TYPE_F64: \
    289             PSIMAGE_ELEMENT_COPY(input,F64,OUT,OUTTYPE,elements); \
    290             break; \
    291         case PS_TYPE_C32: \
    292             PSIMAGE_ELEMENT_COPY(input,C32,OUT,OUTTYPE,elements); \
    293             break; \
    294         case PS_TYPE_C64: \
    295             PSIMAGE_ELEMENT_COPY(input,C64,OUT,OUTTYPE,elements); \
    296             break; \
    297         default: \
    298             break; \
    299         } \
    300     }
    301 
    302     switch (type) {
    303     case PS_TYPE_S8:
    304         PSIMAGE_COPY_CASE(output, S8);
    305         break;
    306     case PS_TYPE_S16:
    307         PSIMAGE_COPY_CASE(output, S16);
    308         break;
    309     case PS_TYPE_S32:
    310         PSIMAGE_COPY_CASE(output, S32);
    311         break;
    312     case PS_TYPE_S64:
    313         PSIMAGE_COPY_CASE(output, S64);
    314         break;
    315     case PS_TYPE_U8:
    316         PSIMAGE_COPY_CASE(output, U8);
    317         break;
    318     case PS_TYPE_U16:
    319         PSIMAGE_COPY_CASE(output, U16);
    320         break;
    321     case PS_TYPE_U32:
    322         PSIMAGE_COPY_CASE(output, U32);
    323         break;
    324     case PS_TYPE_U64:
    325         PSIMAGE_COPY_CASE(output, U64);
    326         break;
    327     case PS_TYPE_F32:
    328         PSIMAGE_COPY_CASE(output, F32);
    329         break;
    330     case PS_TYPE_F64:
    331         PSIMAGE_COPY_CASE(output, F64);
    332         break;
    333     case PS_TYPE_C32:
    334         PSIMAGE_COPY_CASE(output, C32);
    335         break;
    336     case PS_TYPE_C64:
    337         PSIMAGE_COPY_CASE(output, C64);
    338         break;
    339     default: {
    340             char* typeStr;
    341             PS_TYPE_NAME(typeStr,type);
    342             psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    343                     PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
    344                     typeStr);
    345             psFree(output);
    346 
    347             break;
    348         }
    349     }
    350     return output;
    351191}
    352192
  • trunk/psLib/src/image/psImage.h

    r3786 r3977  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.51 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-04-29 02:25:10 $
     13 *  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-05-19 05:18:20 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    110110/** Create a psRegion with the specified attributes.
    111111 *
    112  * Uses psLib memory allocation functions to create a psRegion the
    113  * specified x0, x1, y0, and y1.
    114  *
    115  * @return psRegion* : Pointer to psRegion.
    116  *
    117  */
    118 psRegion* psRegionAlloc(
     112 * @return psRegion : a cooresponding psRegion.
     113 */
     114psRegion psRegionSet(
    119115    psF32 x0,                         ///< the first column of the region.
    120     psF32 x1,                         ///< the last column of the region.
     116    psF32 x1,                         ///< the last column of the region + 1.
    121117    psF32 y0,                         ///< the first row of the region.
    122     psF32 y1                          ///< the last row of the region.
     118    psF32 y1                          ///< the last row of the region + 1.
    123119);
    124120
     
    128124 *  shall be of the standard IRAF form '[x0:x1,y0:y1]'
    129125 *
    130  *  @return psRegion*:  A new psRegion struct, or NULL is not successful.
    131  */
    132 psRegion* psRegionFromString(
     126 *  @return psRegion:  A new psRegion struct, or NULL is not successful.
     127 */
     128psRegion psRegionFromString(
    133129    char* region                       ///< image rectangular region in the form '[x0:x1,y0:y1]'
    134130);
     
    140136 */
    141137char* psRegionToString(
    142     psRegion* region                   ///< the psRegion to convert to a string
     138    psRegion region                   ///< the psRegion to convert to a string
    143139);
    144140
     
    153149    psU32 numRows,                     ///< the desired number of rows in image
    154150    const psElemType type              ///< the desired datatype of the image
    155 );
    156 
    157 /** Makes a copy of a psImage
    158  *
    159  * @return psImage* Copy of the input psImage.  This may not be equal to the
    160  * output parameter
    161  *
    162  */
    163 psImage* psImageCopy(
    164     psImage* output,                   ///< if not NULL, a psImage that could be recycled.
    165     const psImage* input,              ///< the psImage to copy
    166     psElemType type                    ///< the desired datatype of the returned copy
    167151);
    168152
  • trunk/psLib/src/image/psImageConvolve.c

    r3968 r3977  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2005-05-19 02:08:21 $
     7 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-05-19 05:18:20 $
    99 *
    1010 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    454454
    455455        // subset out the padded area now.
    456         psImage* complexOutSansPad = psImageSubset(complexOut,(psRegion) {
    457                                          FOURIER_PADDING,FOURIER_PADDING,
    458                                          FOURIER_PADDING+numCols,FOURIER_PADDING+numRows
    459                                      }
    460                                                   );
     456        psImage* complexOutSansPad = psImageSubset(complexOut,
     457                                     psRegionSet(FOURIER_PADDING, FOURIER_PADDING+numCols,FOURIER_PADDING,FOURIER_PADDING+numRows));
    461458
    462459        out = psImageRecycle(out,numCols,numRows,PS_TYPE_F32);
  • trunk/psLib/src/image/psImageFFT.c

    r3968 r3977  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2005-05-19 02:08:21 $
     7 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-05-19 05:18:20 $
    99 *
    1010 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2020#include "psLogMsg.h"
    2121#include "psImageIO.h"
     22#include "psImageStructManip.h"
    2223
    2324#include "psImageErrors.h"
  • trunk/psLib/src/image/psImageGeomManip.c

    r3968 r3977  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2005-05-19 02:08:21 $
     12 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2005-05-19 05:18:20 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2525#include "psError.h"
    2626#include "psImage.h"
     27#include "psImageStructManip.h"
    2728#include "psStats.h"
    2829#include "psMemory.h"
  • trunk/psLib/src/image/psImageStructManip.c

    r3968 r3977  
    88 *  @author Robert DeSonia, MHPCC
    99 *
    10  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2005-05-19 02:08:21 $
     10 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2005-05-19 05:18:20 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    136136}
    137137
    138 psImage* psImageSubsection(psImage* image,
    139                            const char* section)
     138psImage* psImageCopy(psImage* output,
     139                     const psImage* input,
     140                     psElemType type)
    140141{
    141     psS32 col0;
    142     psS32 col1;
    143     psS32 row0;
    144     psS32 row1;
    145 
    146     // section should be of the form '[col0:col1,row0:row1]'
    147     if (section == NULL) {
     142    psElemType inDatatype;
     143    psS32 elementSize;
     144    psS32 elements;
     145    psS32 numRows;
     146    psS32 numCols;
     147
     148    if (input == NULL || input->data.V == NULL) {
    148149        psError(PS_ERR_BAD_PARAMETER_NULL, true,
    149                 PS_ERRORTEXT_psImage_SUBSECTION_NULL);
    150         return NULL;
    151     }
    152 
    153     if (sscanf(section,"[%d:%d,%d:%d]",&col0,&col1,&row0,&row1) < 4) {
     150                PS_ERRORTEXT_psImage_IMAGE_NULL);
     151        psFree(output);
     152        return NULL;
     153    }
     154
     155    if (input == output) {
    154156        psError(PS_ERR_BAD_PARAMETER_NULL, true,
    155                 PS_ERRORTEXT_psImage_SUBSECTION_INVALID,
    156                 section);
    157         return NULL;
    158     }
    159 
    160     if (col0 > col1 || row0 > row1) {
    161         psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    162                 PS_ERRORTEXT_psImage_SUBSET_RANGE_MALFORMED,
    163                 col0,col1,row0,row1);
    164         return NULL;
    165     }
    166 
    167     return imageSubset(NULL,image,col0,row0,col1+1,row1+1);
     157                PS_ERRORTEXT_psImage_INPLACE_NOTSUPPORTED);
     158        psFree(output);
     159        return NULL;
     160    }
     161
     162    if (input->type.dimen != PS_DIMEN_IMAGE) {
     163        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
     164                PS_ERRORTEXT_psImage_NOT_AN_IMAGE);
     165        psFree(output);
     166        return NULL;
     167    }
     168
     169    inDatatype = input->type.type;
     170    numRows = input->numRows;
     171    numCols = input->numCols;
     172    elements = numRows * numCols;
     173    elementSize = PSELEMTYPE_SIZEOF(inDatatype);
     174
     175    output = psImageRecycle(output, numCols, numRows, type);
     176
     177    // cover the trival case of copy of the same
     178    // datatype.
     179    if (type == inDatatype) {
     180        for (psS32 row=0;row<numRows;row++) {
     181            memcpy(output->data.V[row], input->data.V[row], elementSize * numCols);
     182        }
     183        return output;
     184    }
     185
     186    #define PSIMAGE_ELEMENT_COPY(IN,INTYPE,OUT,OUTTYPE,ELEMENTS) { \
     187        ps##INTYPE *in; \
     188        ps##OUTTYPE *out; \
     189        for(psS32 row=0;row<numRows;row++) { \
     190            in = IN->data.INTYPE[row]; \
     191            out = OUT->data.OUTTYPE[row]; \
     192            for (psS32 col=0;col<numCols;col++) { \
     193                *(out++) = *(in++); \
     194            } \
     195        } \
     196    }
     197
     198    #define PSIMAGE_COPY_CASE(OUT,OUTTYPE) { \
     199        switch (inDatatype) { \
     200        case PS_TYPE_S8: \
     201            PSIMAGE_ELEMENT_COPY(input,S8,OUT,OUTTYPE,elements); \
     202            break; \
     203        case PS_TYPE_S16: \
     204            PSIMAGE_ELEMENT_COPY(input,S16,OUT,OUTTYPE,elements); \
     205            break; \
     206        case PS_TYPE_S32: \
     207            PSIMAGE_ELEMENT_COPY(input,S32,OUT,OUTTYPE,elements); \
     208            break; \
     209        case PS_TYPE_S64: \
     210            PSIMAGE_ELEMENT_COPY(input,S64,OUT,OUTTYPE,elements); \
     211            break; \
     212        case PS_TYPE_U8: \
     213            PSIMAGE_ELEMENT_COPY(input,U8,OUT,OUTTYPE,elements); \
     214            break; \
     215        case PS_TYPE_U16: \
     216            PSIMAGE_ELEMENT_COPY(input,U16,OUT,OUTTYPE,elements); \
     217            break; \
     218        case PS_TYPE_U32: \
     219            PSIMAGE_ELEMENT_COPY(input,U32,OUT,OUTTYPE,elements); \
     220            break; \
     221        case PS_TYPE_U64: \
     222            PSIMAGE_ELEMENT_COPY(input,U64,OUT,OUTTYPE,elements); \
     223            break; \
     224        case PS_TYPE_F32: \
     225            PSIMAGE_ELEMENT_COPY(input,F32,OUT,OUTTYPE,elements); \
     226            break; \
     227        case PS_TYPE_F64: \
     228            PSIMAGE_ELEMENT_COPY(input,F64,OUT,OUTTYPE,elements); \
     229            break; \
     230        case PS_TYPE_C32: \
     231            PSIMAGE_ELEMENT_COPY(input,C32,OUT,OUTTYPE,elements); \
     232            break; \
     233        case PS_TYPE_C64: \
     234            PSIMAGE_ELEMENT_COPY(input,C64,OUT,OUTTYPE,elements); \
     235            break; \
     236        default: \
     237            break; \
     238        } \
     239    }
     240
     241    switch (type) {
     242    case PS_TYPE_S8:
     243        PSIMAGE_COPY_CASE(output, S8);
     244        break;
     245    case PS_TYPE_S16:
     246        PSIMAGE_COPY_CASE(output, S16);
     247        break;
     248    case PS_TYPE_S32:
     249        PSIMAGE_COPY_CASE(output, S32);
     250        break;
     251    case PS_TYPE_S64:
     252        PSIMAGE_COPY_CASE(output, S64);
     253        break;
     254    case PS_TYPE_U8:
     255        PSIMAGE_COPY_CASE(output, U8);
     256        break;
     257    case PS_TYPE_U16:
     258        PSIMAGE_COPY_CASE(output, U16);
     259        break;
     260    case PS_TYPE_U32:
     261        PSIMAGE_COPY_CASE(output, U32);
     262        break;
     263    case PS_TYPE_U64:
     264        PSIMAGE_COPY_CASE(output, U64);
     265        break;
     266    case PS_TYPE_F32:
     267        PSIMAGE_COPY_CASE(output, F32);
     268        break;
     269    case PS_TYPE_F64:
     270        PSIMAGE_COPY_CASE(output, F64);
     271        break;
     272    case PS_TYPE_C32:
     273        PSIMAGE_COPY_CASE(output, C32);
     274        break;
     275    case PS_TYPE_C64:
     276        PSIMAGE_COPY_CASE(output, C64);
     277        break;
     278    default: {
     279            char* typeStr;
     280            PS_TYPE_NAME(typeStr,type);
     281            psError(PS_ERR_BAD_PARAMETER_TYPE, true,
     282                    PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
     283                    typeStr);
     284            psFree(output);
     285
     286            break;
     287        }
     288    }
     289    return output;
    168290}
    169291
  • trunk/psLib/src/image/psImageStructManip.h

    r3968 r3977  
    88*  @author Robert DeSonia, MHPCC
    99*
    10 *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2005-05-19 02:08:21 $
     10*  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2005-05-19 05:18:20 $
    1212*
    1313*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4545);
    4646
    47 /** Create a subimage of the specified area.
     47/** Makes a copy of a psImage
    4848 *
    49  * Uses psLib memory allocation functions to create an image based on a larger
    50  * one.
    51  *
    52  * @return psImage* : Pointer to psImage.
     49 * @return psImage* Copy of the input psImage.  This may not be equal to the
     50 * output parameter
    5351 *
    5452 */
    55 psImage* psImageSubsection(
    56     psImage* image,                    ///< Parent image.
    57     const char* section                ///< Subsection in the form '[x1:x2,y1:y2]'
     53psImage* psImageCopy(
     54    psImage* output,                   ///< if not NULL, a psImage that could be recycled.
     55    const psImage* input,              ///< the psImage to copy
     56    psElemType type                    ///< the desired datatype of the returned copy
    5857);
    5958
  • trunk/psLib/src/imageops/psImageConvolve.c

    r3968 r3977  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2005-05-19 02:08:21 $
     7 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-05-19 05:18:20 $
    99 *
    1010 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    454454
    455455        // subset out the padded area now.
    456         psImage* complexOutSansPad = psImageSubset(complexOut,(psRegion) {
    457                                          FOURIER_PADDING,FOURIER_PADDING,
    458                                          FOURIER_PADDING+numCols,FOURIER_PADDING+numRows
    459                                      }
    460                                                   );
     456        psImage* complexOutSansPad = psImageSubset(complexOut,
     457                                     psRegionSet(FOURIER_PADDING, FOURIER_PADDING+numCols,FOURIER_PADDING,FOURIER_PADDING+numRows));
    461458
    462459        out = psImageRecycle(out,numCols,numRows,PS_TYPE_F32);
  • trunk/psLib/src/imageops/psImageGeomManip.c

    r3968 r3977  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2005-05-19 02:08:21 $
     12 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2005-05-19 05:18:20 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2525#include "psError.h"
    2626#include "psImage.h"
     27#include "psImageStructManip.h"
    2728#include "psStats.h"
    2829#include "psMemory.h"
  • trunk/psLib/src/imageops/psImageStructManip.c

    r3968 r3977  
    88 *  @author Robert DeSonia, MHPCC
    99 *
    10  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2005-05-19 02:08:21 $
     10 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2005-05-19 05:18:20 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    136136}
    137137
    138 psImage* psImageSubsection(psImage* image,
    139                            const char* section)
     138psImage* psImageCopy(psImage* output,
     139                     const psImage* input,
     140                     psElemType type)
    140141{
    141     psS32 col0;
    142     psS32 col1;
    143     psS32 row0;
    144     psS32 row1;
    145 
    146     // section should be of the form '[col0:col1,row0:row1]'
    147     if (section == NULL) {
     142    psElemType inDatatype;
     143    psS32 elementSize;
     144    psS32 elements;
     145    psS32 numRows;
     146    psS32 numCols;
     147
     148    if (input == NULL || input->data.V == NULL) {
    148149        psError(PS_ERR_BAD_PARAMETER_NULL, true,
    149                 PS_ERRORTEXT_psImage_SUBSECTION_NULL);
    150         return NULL;
    151     }
    152 
    153     if (sscanf(section,"[%d:%d,%d:%d]",&col0,&col1,&row0,&row1) < 4) {
     150                PS_ERRORTEXT_psImage_IMAGE_NULL);
     151        psFree(output);
     152        return NULL;
     153    }
     154
     155    if (input == output) {
    154156        psError(PS_ERR_BAD_PARAMETER_NULL, true,
    155                 PS_ERRORTEXT_psImage_SUBSECTION_INVALID,
    156                 section);
    157         return NULL;
    158     }
    159 
    160     if (col0 > col1 || row0 > row1) {
    161         psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    162                 PS_ERRORTEXT_psImage_SUBSET_RANGE_MALFORMED,
    163                 col0,col1,row0,row1);
    164         return NULL;
    165     }
    166 
    167     return imageSubset(NULL,image,col0,row0,col1+1,row1+1);
     157                PS_ERRORTEXT_psImage_INPLACE_NOTSUPPORTED);
     158        psFree(output);
     159        return NULL;
     160    }
     161
     162    if (input->type.dimen != PS_DIMEN_IMAGE) {
     163        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
     164                PS_ERRORTEXT_psImage_NOT_AN_IMAGE);
     165        psFree(output);
     166        return NULL;
     167    }
     168
     169    inDatatype = input->type.type;
     170    numRows = input->numRows;
     171    numCols = input->numCols;
     172    elements = numRows * numCols;
     173    elementSize = PSELEMTYPE_SIZEOF(inDatatype);
     174
     175    output = psImageRecycle(output, numCols, numRows, type);
     176
     177    // cover the trival case of copy of the same
     178    // datatype.
     179    if (type == inDatatype) {
     180        for (psS32 row=0;row<numRows;row++) {
     181            memcpy(output->data.V[row], input->data.V[row], elementSize * numCols);
     182        }
     183        return output;
     184    }
     185
     186    #define PSIMAGE_ELEMENT_COPY(IN,INTYPE,OUT,OUTTYPE,ELEMENTS) { \
     187        ps##INTYPE *in; \
     188        ps##OUTTYPE *out; \
     189        for(psS32 row=0;row<numRows;row++) { \
     190            in = IN->data.INTYPE[row]; \
     191            out = OUT->data.OUTTYPE[row]; \
     192            for (psS32 col=0;col<numCols;col++) { \
     193                *(out++) = *(in++); \
     194            } \
     195        } \
     196    }
     197
     198    #define PSIMAGE_COPY_CASE(OUT,OUTTYPE) { \
     199        switch (inDatatype) { \
     200        case PS_TYPE_S8: \
     201            PSIMAGE_ELEMENT_COPY(input,S8,OUT,OUTTYPE,elements); \
     202            break; \
     203        case PS_TYPE_S16: \
     204            PSIMAGE_ELEMENT_COPY(input,S16,OUT,OUTTYPE,elements); \
     205            break; \
     206        case PS_TYPE_S32: \
     207            PSIMAGE_ELEMENT_COPY(input,S32,OUT,OUTTYPE,elements); \
     208            break; \
     209        case PS_TYPE_S64: \
     210            PSIMAGE_ELEMENT_COPY(input,S64,OUT,OUTTYPE,elements); \
     211            break; \
     212        case PS_TYPE_U8: \
     213            PSIMAGE_ELEMENT_COPY(input,U8,OUT,OUTTYPE,elements); \
     214            break; \
     215        case PS_TYPE_U16: \
     216            PSIMAGE_ELEMENT_COPY(input,U16,OUT,OUTTYPE,elements); \
     217            break; \
     218        case PS_TYPE_U32: \
     219            PSIMAGE_ELEMENT_COPY(input,U32,OUT,OUTTYPE,elements); \
     220            break; \
     221        case PS_TYPE_U64: \
     222            PSIMAGE_ELEMENT_COPY(input,U64,OUT,OUTTYPE,elements); \
     223            break; \
     224        case PS_TYPE_F32: \
     225            PSIMAGE_ELEMENT_COPY(input,F32,OUT,OUTTYPE,elements); \
     226            break; \
     227        case PS_TYPE_F64: \
     228            PSIMAGE_ELEMENT_COPY(input,F64,OUT,OUTTYPE,elements); \
     229            break; \
     230        case PS_TYPE_C32: \
     231            PSIMAGE_ELEMENT_COPY(input,C32,OUT,OUTTYPE,elements); \
     232            break; \
     233        case PS_TYPE_C64: \
     234            PSIMAGE_ELEMENT_COPY(input,C64,OUT,OUTTYPE,elements); \
     235            break; \
     236        default: \
     237            break; \
     238        } \
     239    }
     240
     241    switch (type) {
     242    case PS_TYPE_S8:
     243        PSIMAGE_COPY_CASE(output, S8);
     244        break;
     245    case PS_TYPE_S16:
     246        PSIMAGE_COPY_CASE(output, S16);
     247        break;
     248    case PS_TYPE_S32:
     249        PSIMAGE_COPY_CASE(output, S32);
     250        break;
     251    case PS_TYPE_S64:
     252        PSIMAGE_COPY_CASE(output, S64);
     253        break;
     254    case PS_TYPE_U8:
     255        PSIMAGE_COPY_CASE(output, U8);
     256        break;
     257    case PS_TYPE_U16:
     258        PSIMAGE_COPY_CASE(output, U16);
     259        break;
     260    case PS_TYPE_U32:
     261        PSIMAGE_COPY_CASE(output, U32);
     262        break;
     263    case PS_TYPE_U64:
     264        PSIMAGE_COPY_CASE(output, U64);
     265        break;
     266    case PS_TYPE_F32:
     267        PSIMAGE_COPY_CASE(output, F32);
     268        break;
     269    case PS_TYPE_F64:
     270        PSIMAGE_COPY_CASE(output, F64);
     271        break;
     272    case PS_TYPE_C32:
     273        PSIMAGE_COPY_CASE(output, C32);
     274        break;
     275    case PS_TYPE_C64:
     276        PSIMAGE_COPY_CASE(output, C64);
     277        break;
     278    default: {
     279            char* typeStr;
     280            PS_TYPE_NAME(typeStr,type);
     281            psError(PS_ERR_BAD_PARAMETER_TYPE, true,
     282                    PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
     283                    typeStr);
     284            psFree(output);
     285
     286            break;
     287        }
     288    }
     289    return output;
    168290}
    169291
  • trunk/psLib/src/imageops/psImageStructManip.h

    r3968 r3977  
    88*  @author Robert DeSonia, MHPCC
    99*
    10 *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2005-05-19 02:08:21 $
     10*  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2005-05-19 05:18:20 $
    1212*
    1313*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4545);
    4646
    47 /** Create a subimage of the specified area.
     47/** Makes a copy of a psImage
    4848 *
    49  * Uses psLib memory allocation functions to create an image based on a larger
    50  * one.
    51  *
    52  * @return psImage* : Pointer to psImage.
     49 * @return psImage* Copy of the input psImage.  This may not be equal to the
     50 * output parameter
    5351 *
    5452 */
    55 psImage* psImageSubsection(
    56     psImage* image,                    ///< Parent image.
    57     const char* section                ///< Subsection in the form '[x1:x2,y1:y2]'
     53psImage* psImageCopy(
     54    psImage* output,                   ///< if not NULL, a psImage that could be recycled.
     55    const psImage* input,              ///< the psImage to copy
     56    psElemType type                    ///< the desired datatype of the returned copy
    5857);
    5958
  • trunk/psLib/src/math/psMinimize.c

    r3884 r3977  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.116 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-05-11 22:02:16 $
     11 *  @version $Revision: 1.117 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-05-19 05:18:20 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2626#include "psMinimize.h"
    2727#include "psStats.h"
     28#include "psImage.h"
     29#include "psImageStructManip.h"
    2830#include "psImageIO.h"
    2931/*****************************************************************************/
  • trunk/psLib/src/mathtypes/psImage.c

    r3786 r3977  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.65 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-04-29 02:25:10 $
     11 *  @version $Revision: 1.66 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-05-19 05:18:20 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    9191}
    9292
    93 psRegion* psRegionAlloc(psF32 x0,
    94                         psF32 x1,
    95                         psF32 y0,
    96                         psF32 y1)
    97 {
    98     psRegion* out = psAlloc(sizeof(psRegion));
    99 
    100     out->x0 = x0;
    101     out->y0 = y0;
    102     out->x1 = x1;
    103     out->y1 = y1;
     93psRegion psRegionSet(psF32 x0,
     94                     psF32 x1,
     95                     psF32 y0,
     96                     psF32 y1)
     97{
     98    psRegion out;
     99
     100    out.x0 = x0;
     101    out.y0 = y0;
     102    out.x1 = x1;
     103    out.y1 = y1;
    104104
    105105    return out;
    106106}
    107107
    108 psRegion* psRegionFromString(char* region)
     108psRegion psRegionFromString(char* region)
    109109{
    110110    psS32 col0;
     
    117117        psError(PS_ERR_BAD_PARAMETER_NULL, true,
    118118                PS_ERRORTEXT_psImage_SUBSECTION_NULL);
    119         return NULL;
     119        return psRegionSet(NAN,NAN,NAN,NAN);
    120120    }
    121121
     
    124124                PS_ERRORTEXT_psImage_SUBSECTION_INVALID,
    125125                region);
    126         return NULL;
     126        return psRegionSet(NAN,NAN,NAN,NAN);
    127127    }
    128128
     
    131131                PS_ERRORTEXT_psImage_SUBSET_RANGE_MALFORMED,
    132132                col0,col1,row0,row1);
    133         return NULL;
    134     }
    135 
    136     return psRegionAlloc(col0,col1,row0,row1);
    137 }
    138 
    139 char* psRegionToString(psRegion* region)
     133        return psRegionSet(NAN,NAN,NAN,NAN);
     134    }
     135
     136    return psRegionSet(col0,col1,row0,row1);
     137}
     138
     139char* psRegionToString(psRegion region)
    140140{
    141141    char tmpText[256]; // big enough to store any region as text
    142142
    143     if (region == NULL) {
    144         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    145                 PS_ERRORTEXT_psImage_REGION_NULL);
    146         return NULL;
    147     }
    148 
    149143    snprintf(tmpText,256,"[%g:%g,%g:%g]",
    150              region->x0, region->x1,
    151              region->y0, region->y1);
     144             region.x0, region.x1,
     145             region.y0, region.y1);
    152146
    153147    return psStringCopy(tmpText);
     
    195189
    196190    return old;
    197 }
    198 
    199 psImage* psImageCopy(psImage* output,
    200                      const psImage* input,
    201                      psElemType type)
    202 {
    203     psElemType inDatatype;
    204     psS32 elementSize;
    205     psS32 elements;
    206     psS32 numRows;
    207     psS32 numCols;
    208 
    209     if (input == NULL || input->data.V == NULL) {
    210         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    211                 PS_ERRORTEXT_psImage_IMAGE_NULL);
    212         psFree(output);
    213         return NULL;
    214     }
    215 
    216     if (input == output) {
    217         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    218                 PS_ERRORTEXT_psImage_INPLACE_NOTSUPPORTED);
    219         psFree(output);
    220         return NULL;
    221     }
    222 
    223     if (input->type.dimen != PS_DIMEN_IMAGE) {
    224         psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    225                 PS_ERRORTEXT_psImage_NOT_AN_IMAGE);
    226         psFree(output);
    227         return NULL;
    228     }
    229 
    230     inDatatype = input->type.type;
    231     numRows = input->numRows;
    232     numCols = input->numCols;
    233     elements = numRows * numCols;
    234     elementSize = PSELEMTYPE_SIZEOF(inDatatype);
    235 
    236     output = psImageRecycle(output, numCols, numRows, type);
    237 
    238     // cover the trival case of copy of the same
    239     // datatype.
    240     if (type == inDatatype) {
    241         for (psS32 row=0;row<numRows;row++) {
    242             memcpy(output->data.V[row], input->data.V[row], elementSize * numCols);
    243         }
    244         return output;
    245     }
    246 
    247     #define PSIMAGE_ELEMENT_COPY(IN,INTYPE,OUT,OUTTYPE,ELEMENTS) { \
    248         ps##INTYPE *in; \
    249         ps##OUTTYPE *out; \
    250         for(psS32 row=0;row<numRows;row++) { \
    251             in = IN->data.INTYPE[row]; \
    252             out = OUT->data.OUTTYPE[row]; \
    253             for (psS32 col=0;col<numCols;col++) { \
    254                 *(out++) = *(in++); \
    255             } \
    256         } \
    257     }
    258 
    259     #define PSIMAGE_COPY_CASE(OUT,OUTTYPE) { \
    260         switch (inDatatype) { \
    261         case PS_TYPE_S8: \
    262             PSIMAGE_ELEMENT_COPY(input,S8,OUT,OUTTYPE,elements); \
    263             break; \
    264         case PS_TYPE_S16: \
    265             PSIMAGE_ELEMENT_COPY(input,S16,OUT,OUTTYPE,elements); \
    266             break; \
    267         case PS_TYPE_S32: \
    268             PSIMAGE_ELEMENT_COPY(input,S32,OUT,OUTTYPE,elements); \
    269             break; \
    270         case PS_TYPE_S64: \
    271             PSIMAGE_ELEMENT_COPY(input,S64,OUT,OUTTYPE,elements); \
    272             break; \
    273         case PS_TYPE_U8: \
    274             PSIMAGE_ELEMENT_COPY(input,U8,OUT,OUTTYPE,elements); \
    275             break; \
    276         case PS_TYPE_U16: \
    277             PSIMAGE_ELEMENT_COPY(input,U16,OUT,OUTTYPE,elements); \
    278             break; \
    279         case PS_TYPE_U32: \
    280             PSIMAGE_ELEMENT_COPY(input,U32,OUT,OUTTYPE,elements); \
    281             break; \
    282         case PS_TYPE_U64: \
    283             PSIMAGE_ELEMENT_COPY(input,U64,OUT,OUTTYPE,elements); \
    284             break; \
    285         case PS_TYPE_F32: \
    286             PSIMAGE_ELEMENT_COPY(input,F32,OUT,OUTTYPE,elements); \
    287             break; \
    288         case PS_TYPE_F64: \
    289             PSIMAGE_ELEMENT_COPY(input,F64,OUT,OUTTYPE,elements); \
    290             break; \
    291         case PS_TYPE_C32: \
    292             PSIMAGE_ELEMENT_COPY(input,C32,OUT,OUTTYPE,elements); \
    293             break; \
    294         case PS_TYPE_C64: \
    295             PSIMAGE_ELEMENT_COPY(input,C64,OUT,OUTTYPE,elements); \
    296             break; \
    297         default: \
    298             break; \
    299         } \
    300     }
    301 
    302     switch (type) {
    303     case PS_TYPE_S8:
    304         PSIMAGE_COPY_CASE(output, S8);
    305         break;
    306     case PS_TYPE_S16:
    307         PSIMAGE_COPY_CASE(output, S16);
    308         break;
    309     case PS_TYPE_S32:
    310         PSIMAGE_COPY_CASE(output, S32);
    311         break;
    312     case PS_TYPE_S64:
    313         PSIMAGE_COPY_CASE(output, S64);
    314         break;
    315     case PS_TYPE_U8:
    316         PSIMAGE_COPY_CASE(output, U8);
    317         break;
    318     case PS_TYPE_U16:
    319         PSIMAGE_COPY_CASE(output, U16);
    320         break;
    321     case PS_TYPE_U32:
    322         PSIMAGE_COPY_CASE(output, U32);
    323         break;
    324     case PS_TYPE_U64:
    325         PSIMAGE_COPY_CASE(output, U64);
    326         break;
    327     case PS_TYPE_F32:
    328         PSIMAGE_COPY_CASE(output, F32);
    329         break;
    330     case PS_TYPE_F64:
    331         PSIMAGE_COPY_CASE(output, F64);
    332         break;
    333     case PS_TYPE_C32:
    334         PSIMAGE_COPY_CASE(output, C32);
    335         break;
    336     case PS_TYPE_C64:
    337         PSIMAGE_COPY_CASE(output, C64);
    338         break;
    339     default: {
    340             char* typeStr;
    341             PS_TYPE_NAME(typeStr,type);
    342             psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    343                     PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
    344                     typeStr);
    345             psFree(output);
    346 
    347             break;
    348         }
    349     }
    350     return output;
    351191}
    352192
  • trunk/psLib/src/mathtypes/psImage.h

    r3786 r3977  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.51 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-04-29 02:25:10 $
     13 *  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-05-19 05:18:20 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    110110/** Create a psRegion with the specified attributes.
    111111 *
    112  * Uses psLib memory allocation functions to create a psRegion the
    113  * specified x0, x1, y0, and y1.
    114  *
    115  * @return psRegion* : Pointer to psRegion.
    116  *
    117  */
    118 psRegion* psRegionAlloc(
     112 * @return psRegion : a cooresponding psRegion.
     113 */
     114psRegion psRegionSet(
    119115    psF32 x0,                         ///< the first column of the region.
    120     psF32 x1,                         ///< the last column of the region.
     116    psF32 x1,                         ///< the last column of the region + 1.
    121117    psF32 y0,                         ///< the first row of the region.
    122     psF32 y1                          ///< the last row of the region.
     118    psF32 y1                          ///< the last row of the region + 1.
    123119);
    124120
     
    128124 *  shall be of the standard IRAF form '[x0:x1,y0:y1]'
    129125 *
    130  *  @return psRegion*:  A new psRegion struct, or NULL is not successful.
    131  */
    132 psRegion* psRegionFromString(
     126 *  @return psRegion:  A new psRegion struct, or NULL is not successful.
     127 */
     128psRegion psRegionFromString(
    133129    char* region                       ///< image rectangular region in the form '[x0:x1,y0:y1]'
    134130);
     
    140136 */
    141137char* psRegionToString(
    142     psRegion* region                   ///< the psRegion to convert to a string
     138    psRegion region                   ///< the psRegion to convert to a string
    143139);
    144140
     
    153149    psU32 numRows,                     ///< the desired number of rows in image
    154150    const psElemType type              ///< the desired datatype of the image
    155 );
    156 
    157 /** Makes a copy of a psImage
    158  *
    159  * @return psImage* Copy of the input psImage.  This may not be equal to the
    160  * output parameter
    161  *
    162  */
    163 psImage* psImageCopy(
    164     psImage* output,                   ///< if not NULL, a psImage that could be recycled.
    165     const psImage* input,              ///< the psImage to copy
    166     psElemType type                    ///< the desired datatype of the returned copy
    167151);
    168152
  • trunk/psLib/test/astronomy/verified/tst_psAstrometry01.stderr

    r3570 r3977  
    6363    Unallowable operation: in is NULL.
    6464<DATE><TIME>|<HOST>|E|psPlaneTransformInvert (FILE:LINENO)
    65     Unallowable operation: region is NULL.
    66 <DATE><TIME>|<HOST>|E|psPlaneTransformInvert (FILE:LINENO)
    6765    Error: (1 > nSamples) (1 0).
    6866
  • trunk/psLib/test/astronomy/verified/tst_psAstrometry01.stdout

    r3883 r3977  
    2727Calling psPlaneTransformInvert with NULL trans.  Should generate error and return NULL.
    2828----------------------------------------------------------------------------------
    29 Calling psPlaneTransformInvert with NULL psRegion.  Should generate error and return NULL.
    30 ----------------------------------------------------------------------------------
    3129Calling psPlaneTransformInvert with zero nSamples.  Should generate error and return NULL.
    3230Calling psPlaneTransformInvert with an acceptable linear transformation.
  • trunk/psLib/test/collections/tst_psPixels.c

    r3974 r3977  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.1 $
     7 *  @version $Revision: 1.2 $
    88 *           $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-05-19 02:57:03 $
     9 *  @date $Date: 2005-05-19 05:18:20 $
    1010 *
    1111 *  Copyright 2005 Maui High Performance Computing Center, University of Hawaii
     
    328328    pixels->n = 10;
    329329
    330     psImage* mask = psPixelsToMask(NULL,pixels,(psRegion) {
    331                                        0,10,0,10
    332                                    }
    333                                    ,1);
     330    psImage* mask = psPixelsToMask(NULL,pixels, psRegionSet(0,10,0,10), 1);
    334331
    335332    if (mask == NULL) {
     
    358355
    359356    // test when input psPixels is NULL.
    360     mask = psPixelsToMask(mask, NULL, (psRegion) {
    361                               0,10,0,10
    362                           }
    363                           ,1);
     357    mask = psPixelsToMask(mask, NULL, psRegionSet(0,10,0,10), 1);
    364358    if (mask != NULL) {
    365359        psError(PS_ERR_UNKNOWN, true,
  • trunk/psLib/test/collections/verified/tst_psMetadata_01.stdout

    r3945 r3977  
    4444 Key Name:   PCOUNT  Key mdType: 0x00000104  Key Value:               0  Key Comment: required keyword; must = 0
    4545 Key Name: XTENSION  Key mdType: 0x00010001  Key Value:      'IMAGE   '  Key Comment: IMAGE extension
    46  Key Name:   BITPIX  Key mdType: 0x0001000a  Key Value:                  Key Comment:
     46 Key Name:   BITPIX  Key mdType: 0x0001000a  Key Value:                  Key Comment: List of Metadata Items
    4747    Key Name:   BITPIX  Key mdType: 0x00000104  Key Value:             -64  Key Comment: number of bits per data pixel
    4848    Key Name:   BITPIX  Key mdType: 0x00000104  Key Value:             -64  Key Comment: number of bits per data pixel
    4949 Key Name:   GCOUNT  Key mdType: 0x00000104  Key Value:               1  Key Comment: required keyword; must = 1
    50  Key Name:  HISTORY  Key mdType: 0x0001000a  Key Value:                  Key Comment:
     50 Key Name:  HISTORY  Key mdType: 0x0001000a  Key Value:                  Key Comment: List of Metadata Items
    5151    Key Name:  HISTORY  Key mdType: 0x00010001  Key Value:                  Key Comment: File modified by user 'harman' with fv  on 2004-08-04T<DATE>
    5252    Key Name:  HISTORY  Key mdType: 0x00010001  Key Value:                  Key Comment: File modified by user 'harman' with fv  on 2004-08-04T<DATE>
     
    8181 Key Name:   GCOUNT  Key mdType: 0x00000104  Key Value:               1  Key Comment: required keyword; must = 1
    8282 Key Name:   BITPIX  Key mdType: 0x00000104  Key Value:             -64  Key Comment: number of bits per data pixel
    83  Key Name:  HISTORY  Key mdType: 0x0001000a  Key Value:                  Key Comment:
     83 Key Name:  HISTORY  Key mdType: 0x0001000a  Key Value:                  Key Comment: List of Metadata Items
    8484    Key Name:  HISTORY  Key mdType: 0x00010001  Key Value:                  Key Comment: File modified by user 'harman' with fv  on 2004-08-04T<DATE>
    8585    Key Name:  HISTORY  Key mdType: 0x00010001  Key Value:                  Key Comment: File modified by user 'harman' with fv  on 2004-08-04T<DATE>
  • trunk/psLib/test/image/tst_psImageStats.c

    r3973 r3977  
    113113            tmpImage2 = psImageAlloc( IMAGE_X_SIZE*2, IMAGE_Y_SIZE*2, PS_TYPE_F32 );
    114114            tmpMask2 = psImageAlloc( IMAGE_X_SIZE*2, IMAGE_Y_SIZE*2, PS_TYPE_U8 );
    115             tmpImage = psImageSubset(tmpImage2, (psRegion) {
    116                                          IMAGE_X_SIZE/4, IMAGE_Y_SIZE/4,
    117                                          IMAGE_X_SIZE/4+IMAGE_X_SIZE, IMAGE_Y_SIZE/4+IMAGE_Y_SIZE
    118                                      }
    119                                     );
    120             tmpMask= psImageSubset(tmpMask2,(psRegion) {
    121                                        IMAGE_X_SIZE/4, IMAGE_Y_SIZE/4,
    122                                        IMAGE_X_SIZE/4+IMAGE_X_SIZE, IMAGE_Y_SIZE/4+IMAGE_Y_SIZE
    123                                    }
    124                                   );
     115            tmpImage = psImageSubset(tmpImage2, psRegionSet(IMAGE_X_SIZE/4, IMAGE_X_SIZE/4+IMAGE_X_SIZE,
     116                                     IMAGE_Y_SIZE/4, IMAGE_Y_SIZE/4+IMAGE_Y_SIZE));
     117            tmpMask= psImageSubset(tmpMask2, psRegionSet(IMAGE_X_SIZE/4, IMAGE_X_SIZE/4+IMAGE_X_SIZE,
     118                                   IMAGE_Y_SIZE/4, IMAGE_Y_SIZE/4+IMAGE_Y_SIZE));
    125119        }
    126120
     
    291285            tmpImage2 = psImageAlloc( IMAGE_X_SIZE*2, IMAGE_Y_SIZE*2, PS_TYPE_F32 );
    292286            tmpMask2 = psImageAlloc( IMAGE_X_SIZE*2, IMAGE_Y_SIZE*2, PS_TYPE_U8 );
    293             tmpImage = psImageSubset(tmpImage2,(psRegion) {
    294                                          IMAGE_X_SIZE/4, IMAGE_Y_SIZE/4,
    295                                          IMAGE_X_SIZE/4+IMAGE_X_SIZE, IMAGE_Y_SIZE/4+IMAGE_Y_SIZE
    296                                      }
    297                                     );
    298             tmpMask = psImageSubset(tmpMask2,(psRegion) {
    299                                         IMAGE_X_SIZE/4, IMAGE_Y_SIZE/4,
    300                                         IMAGE_X_SIZE/4+IMAGE_X_SIZE, IMAGE_Y_SIZE/4+IMAGE_Y_SIZE
    301                                     }
    302                                    );
    303         }
    304 
    305         for ( i = 0;i < tmpImage->numRows;i++ ) {
    306             for ( j = 0;j < tmpImage->numCols;j++ ) {
    307                 tmpImage->data.F32[ i ][ j ] = ( float ) ( i + j );
    308             }
    309         }
    310         for ( i = 0;i < tmpMask->numRows;i++ ) {
    311             for ( j = 0;j < tmpMask->numCols;j++ ) {
    312                 if ( ( i > ( tmpMask->numRows / 2 ) ) &&
    313                         ( j > ( tmpMask->numCols / 2 ) ) ) {
    314                     tmpMask->data.U8[ i ][ j ] = 1;
    315                 } else {
    316                     tmpMask->data.U8[ i ][ j ] = 0;
    317                 }
    318             }
    319         }
    320 
    321         myStats = psStatsAlloc( PS_STAT_SAMPLE_MEAN );
    322         /*************************************************************************/
    323         /*  Calculate Sample Mean with no mask                           */
    324         /*************************************************************************/
    325         psStats* tmpStats = myStats;
    326         myStats = psImageStats( myStats, tmpImage, NULL, 0 );
    327         if ( myStats != tmpStats ) {
    328             fprintf(stderr,"ERROR: input psStats not equal to return psStats\n");
    329             psAbort(__func__,"Failed input psStats equal to returned psStats");
    330         }
    331         fprintf(stderr, "The sample mean was %.2f\n", myStats->sampleMean );
    332 
    333         /*************************************************************************/
    334         /*  Calculate Sample Mean with mask                              */
    335         /*************************************************************************/
    336 
    337         myStats = psImageStats( myStats, tmpImage, tmpMask, 1 );
    338         fprintf(stderr, "The sample mean was %.2f\n", myStats->sampleMean );
    339 
    340         /*************************************************************************/
    341         /*  Deallocate data structures                                   */
    342         /*************************************************************************/
    343         psFree( myStats );
    344         psFree( tmpImage );
    345         psFree( tmpMask );
    346         psFree( tmpImage2 );
    347         psFree( tmpMask2 );
    348     }
    349 
    350     /*************************************************************************/
    351     /*  Test With Various Null Inputs                                        */
    352     /*************************************************************************/
    353 
    354     tmpImage = psImageAlloc( IMAGE_X_SIZE, IMAGE_Y_SIZE, PS_TYPE_F32 );
    355     tmpMask = psImageAlloc( IMAGE_X_SIZE, IMAGE_Y_SIZE, PS_TYPE_U8 );
    356     myStats = psStatsAlloc( 0 );
    357 
    358     myStats2 = psImageStats( myStats, NULL, NULL, 0 );
    359     if ( myStats2 != NULL ) {
    360         fprintf(stderr, "ERROR: myStats2 = psImageStats(myStats, NULL, NULL, 0) != NULL\n" );
    361     }
    362 
    363     myStats2 = psImageStats( NULL, tmpImage, NULL, 0 );
    364     if ( myStats2 != NULL ) {
    365         fprintf(stderr, "ERROR: myStats2 = psImageStats(NULL, tmpImage, NULL, 0) != NULL\n" );
    366     }
    367 
    368     myStats2 = psImageStats( myStats, tmpImage, NULL, 0 );
    369 
    370     psFree( myStats );
    371     psFree( tmpImage );
    372     psFree( tmpMask );
    373 
    374     tmpImage = psImageAlloc( IMAGE_X_SIZE, IMAGE_Y_SIZE, PS_TYPE_F32);
    375     tmpMask = psImageAlloc( IMAGE_X_SIZE, IMAGE_Y_SIZE, PS_TYPE_U32);
    376     myStats = psStatsAlloc( PS_STAT_SAMPLE_MEAN );
    377     myStats2 = psImageStats( myStats, tmpImage, tmpMask, 0 );
    378     if ( myStats2 != NULL ) {
    379         fprintf(stderr, "ERROR: psImageStats did not return null when mask is invalid type.\n");
    380     }
    381     psFree(tmpImage);
    382     psFree(tmpMask);
    383     psFree(myStats);
    384 
    385     return ( !testStatus );
     287            tmpImage = psImageSubset(tmpImage2, psRegionSet(IMAGE_X_SIZE/4, IMAGE_X_SIZE/4+IMAGE_X_SIZE,
     288                                     IMAGE_Y_SIZE/4, IMAGE_Y_SIZE/4+IMAGE_Y_SIZE
     289                                 }
     290                                                       );
     291        tmpMask = psImageSubset(tmpMask2, psRegionSet(IMAGE_X_SIZE/4, IMAGE_X_SIZE/4+IMAGE_X_SIZE,
     292                                IMAGE_Y_SIZE/4, IMAGE_Y_SIZE/4+IMAGE_Y_SIZE
     293                            }
     294                                                 );
     295}
     296
     297for ( i = 0;i < tmpImage->numRows;i++ )
     298{
     299    for ( j = 0;j < tmpImage->numCols;j++ ) {
     300        tmpImage->data.F32[ i ][ j ] = ( float ) ( i + j );
     301    }
     302}
     303for ( i = 0;i < tmpMask->numRows;i++ )
     304{
     305    for ( j = 0;j < tmpMask->numCols;j++ ) {
     306        if ( ( i > ( tmpMask->numRows / 2 ) ) &&
     307                ( j > ( tmpMask->numCols / 2 ) ) ) {
     308            tmpMask->data.U8[ i ][ j ] = 1;
     309        } else {
     310            tmpMask->data.U8[ i ][ j ] = 0;
     311        }
     312    }
     313}
     314
     315myStats = psStatsAlloc( PS_STAT_SAMPLE_MEAN );
     316/*************************************************************************/
     317/*  Calculate Sample Mean with no mask                           */
     318/*************************************************************************/
     319psStats* tmpStats = myStats;
     320myStats = psImageStats( myStats, tmpImage, NULL, 0 );
     321if ( myStats != tmpStats )
     322{
     323    fprintf(stderr,"ERROR: input psStats not equal to return psStats\n");
     324    psAbort(__func__,"Failed input psStats equal to returned psStats");
     325}
     326fprintf(stderr, "The sample mean was %.2f\n", myStats->sampleMean );
     327
     328/*************************************************************************/
     329/*  Calculate Sample Mean with mask                              */
     330/*************************************************************************/
     331
     332myStats = psImageStats( myStats, tmpImage, tmpMask, 1 );
     333fprintf(stderr, "The sample mean was %.2f\n", myStats->sampleMean );
     334
     335/*************************************************************************/
     336/*  Deallocate data structures                                   */
     337/*************************************************************************/
     338psFree( myStats );
     339psFree( tmpImage );
     340psFree( tmpMask );
     341psFree( tmpImage2 );
     342psFree( tmpMask2 );
     343}
     344
     345/*************************************************************************/
     346/*  Test With Various Null Inputs                                        */
     347/*************************************************************************/
     348
     349tmpImage = psImageAlloc( IMAGE_X_SIZE, IMAGE_Y_SIZE, PS_TYPE_F32 );
     350tmpMask = psImageAlloc( IMAGE_X_SIZE, IMAGE_Y_SIZE, PS_TYPE_U8 );
     351myStats = psStatsAlloc( 0 );
     352
     353myStats2 = psImageStats( myStats, NULL, NULL, 0 );
     354if ( myStats2 != NULL ) {
     355    fprintf(stderr, "ERROR: myStats2 = psImageStats(myStats, NULL, NULL, 0) != NULL\n" )
     356    ;
     357}
     358
     359myStats2 = psImageStats( NULL, tmpImage, NULL, 0 );
     360if ( myStats2 != NULL ) {
     361    fprintf(stderr, "ERROR: myStats2 = psImageStats(NULL, tmpImage, NULL, 0) != NULL\n" )
     362    ;
     363}
     364
     365myStats2 = psImageStats( myStats, tmpImage, NULL, 0 );
     366
     367psFree( myStats );
     368psFree( tmpImage );
     369psFree( tmpMask );
     370
     371tmpImage = psImageAlloc( IMAGE_X_SIZE, IMAGE_Y_SIZE, PS_TYPE_F32);
     372tmpMask = psImageAlloc( IMAGE_X_SIZE, IMAGE_Y_SIZE, PS_TYPE_U32);
     373myStats = psStatsAlloc( PS_STAT_SAMPLE_MEAN );
     374myStats2 = psImageStats( myStats, tmpImage, tmpMask, 0 );
     375if ( myStats2 != NULL ) {
     376    fprintf(stderr, "ERROR: psImageStats did not return null when mask is invalid type.\n")
     377    ;
     378}
     379psFree(tmpImage);
     380psFree(tmpMask);
     381psFree(myStats);
     382
     383return ( !testStatus );
    386384}
    387385
Note: See TracChangeset for help on using the changeset viewer.