IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 26, 2009, 8:40:07 PM (17 years ago)
Author:
eugene
Message:

incorporating changes from 16bit mask upgrades (eam_branch_20081230)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/imageops/psImageGeomManip.c

    r20299 r21183  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2008-10-21 22:10:53 $
     12 *  @version $Revision: 1.45 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2009-01-27 06:39:37 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3939                      const psImage* in,
    4040                      const psImage* mask,
    41                       psMaskType maskVal,
     41                      psImageMaskType maskVal,
    4242                      int scale,
    4343                      const psStats* stats)
     
    4747    psS32 outRows;
    4848    psS32 outCols;
    49     psVector* vec;                     // vector to hold the values of a single bin.
    50     psVector* maskVec = NULL;          // vector to hold the mask of a single bin.
    51     psMaskType* maskData = NULL;
    52     psStats* myStats;
     49    psVector *vec;                     // vector to hold the values of a single bin.
     50    psVector *maskVec = NULL;          // vector to hold the mask of a single bin.
     51    psVectorMaskType *maskData = NULL;
     52    psStats *myStats;
    5353
    5454    if (in == NULL) {
     
    8686
    8787    if (mask != NULL) {
    88         if (mask->type.type != PS_TYPE_MASK) {
     88        if (mask->type.type != PS_TYPE_IMAGE_MASK) {
    8989            char* typeStr;
    9090            PS_TYPE_NAME(typeStr,mask->type.type);
    9191            psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    9292                    _("Input psImage mask type, %s, is not the supported mask datatype of %s."),
    93                     typeStr, PS_TYPE_MASK_NAME);
     93                    typeStr, PS_TYPE_IMAGE_MASK_NAME);
    9494            psFree(out);
    9595            psFree(vec);
    9696            return NULL;
    9797        }
    98         maskVec = psVectorAllocEmpty(scale * scale, PS_TYPE_MASK);
    99         maskData = maskVec->data.PS_TYPE_MASK_DATA;
     98        maskVec = psVectorAllocEmpty(scale * scale, PS_TYPE_VECTOR_MASK);
     99        maskData = maskVec->data.PS_TYPE_VECTOR_MASK_DATA;
    100100    }
    101101
     
    114114        ps##TYPE *outRowData; \
    115115        ps##TYPE *vecData = vec->data.TYPE; \
    116         psMaskType *inRowMask = NULL; \
     116        psImageMaskType *inRowMask = NULL; \
    117117        for (psS32 row = 0; row < outRows; row++) { \
    118118            outRowData = out->data.TYPE[row]; \
     
    126126                    ps##TYPE* inRowData = in->data.TYPE[inRow]; \
    127127                    if (mask != NULL) { \
    128                         inRowMask = mask->data.PS_TYPE_MASK_DATA[inRow]; \
     128                        inRowMask = mask->data.PS_TYPE_IMAGE_MASK_DATA[inRow]; \
    129129                    } \
    130130                    for (psS32 inCol = inCurrentCol; inCol < inNextCol && inCol < inCols; inCol++) { \
    131131                        if (maskData != NULL) { \
    132                             maskData[n] = inRowMask[inCol]; \
     132                            maskData[n] = (inRowMask[inCol] & maskVal); \
    133133                        } \
    134134                        vecData[n++] = inRowData[inCol]; \
     
    139139                    maskVec->n = n; \
    140140                } \
    141                 psVectorStats(myStats, vec, NULL, maskVec, maskVal); \
     141                 psVectorStats(myStats, vec, NULL, maskVec, 0xff); /* the mask vector has only 0 or 1 */ \
    142142                outRowData[col] = (ps##TYPE)psStatsGetValue(myStats, statistic); \
    143143            } \
     
    659659
    660660bool psImageShiftMask(psImage **out, psImage **outMask, const psImage* in, const psImage *inMask,
    661                       psMaskType maskVal, float dx, float dy, double exposed, psMaskType blank,
     661                      psImageMaskType maskVal, float dx, float dy, double exposed, psImageMaskType blank,
    662662                      psImageInterpolateMode mode)
    663663{
     
    667667        PS_ASSERT_IMAGE_NON_NULL(inMask, false);
    668668        PS_ASSERT_IMAGES_SIZE_EQUAL(in, inMask, false);
    669         PS_ASSERT_IMAGE_TYPE(inMask, PS_TYPE_MASK, false);
     669        PS_ASSERT_IMAGE_TYPE(inMask, PS_TYPE_IMAGE_MASK, false);
    670670    }
    671671
     
    675675    *out = psImageRecycle(*out, numCols, numRows, type);
    676676    if (outMask) {
    677         *outMask = psImageRecycle(*outMask, numCols, numRows, PS_TYPE_MASK);
     677        *outMask = psImageRecycle(*outMask, numCols, numRows, PS_TYPE_IMAGE_MASK);
    678678    }
    679679
     
    702702    for (int row = 0; row < numRows; row++) { \
    703703        ps##TYPE* outRow = (*out)->data.TYPE[row]; \
    704         psMaskType *outMaskRow = (outMask ? (*outMask)->data.PS_TYPE_MASK_DATA[row] : NULL); \
     704        psImageMaskType *outMaskRow = (outMask ? (*outMask)->data.PS_TYPE_IMAGE_MASK_DATA[row] : NULL); \
    705705        float y = row + 0.5 - dy; \
    706706        for (int col = 0; col < numCols; col++) { \
    707707            float x = col + 0.5 - dx; \
    708708            double value; \
    709             psMaskType valueMask = 0; \
     709            psImageMaskType valueMask = 0; \
    710710            if (!psImageInterpolate(&value, NULL, &valueMask, x, y, interp)) { \
    711711                psError(PS_ERR_UNKNOWN, false, "Unable to interpolate image."); \
     
    750750                          const psImage *input,
    751751                          const psImage *inputMask,
    752                           psMaskType inputMaskVal,
     752                          psImageMaskType inputMaskVal,
    753753                          const psPlaneTransform *outToIn,
    754754                          psRegion region,
     
    778778            return NULL;
    779779        }
    780         if (inputMask->type.type != PS_TYPE_MASK) {
     780        if (inputMask->type.type != PS_TYPE_IMAGE_MASK) {
    781781            char* typeStr;
    782782            PS_TYPE_NAME(typeStr,inputMask->type.type);
    783783            psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    784784                    _("Input psImage mask type, %s, is not the supported mask datatype of %s."),
    785                     typeStr, PS_TYPE_MASK_NAME);
     785                    typeStr, PS_TYPE_IMAGE_MASK_NAME);
    786786            psFree(output);
    787787            return NULL;
Note: See TracChangeset for help on using the changeset viewer.