IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 20, 2004, 10:36:46 AM (22 years ago)
Author:
harman
Message:

Updated tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/pmMaskBadPixels.c

    r1822 r1832  
    1616 * pixel on the mask. In the event that the mask image is too small (i.e., pixels on the input image refer to
    1717 * pixels outside the range of the mask image), the function shall generate an error.
     18 
    1819 *  @author Ross Harman, MHPCC
    1920 *
    20  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    21  *  @date $Date: 2004-09-17 00:49:04 $
     21 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     22 *  @date $Date: 2004-09-20 20:36:46 $
    2223 *
    2324 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4041    int jj = 0;
    4142    int ii = 0;
     43    int rRound = 0;
    4244    int rowMin = 0;
    4345    int rowMax = 0;
     
    4648    int totOffCol = 0;
    4749    int totOffRow = 0;
    48     float r = 0.0;
     50    float r = 0.0f;
    4951    psElemType inType;
    5052    psElemType maskType;
     
    6365
    6466    inImage = in->image;
    65     inMask = in->mask;
    6667    if (inImage == NULL) {
    6768        psError(__func__, " : Line %d - Null not allowed for input image", __LINE__);
    6869        return false;
    6970    } else if(inMask == NULL) {
    70         inMask = psImageAlloc(inImage->numCols, inImage->numRows, PS_TYPE_MASK);
     71        in->mask = psImageAlloc(inImage->numCols, inImage->numRows, PS_TYPE_MASK);
    7172    }
     73    inMask = in->mask;
    7274
    7375    // Check input image and its mask are not larger than mask
     
    135137    // Macro for all PS types
    136138    #define PM_BAD_PIXELS(TYPE)                                                                              \
    137 case PS_TYPE_##TYPE:                                                                                 \
    138     for(j=totOffRow; j<inImage->numRows; j++) {                                                      \
    139         for(i=totOffCol; i<inImage->numCols; i++) {                                                  \
    140             if(inImage->data.TYPE[j][i] > sat) {                                                     \
    141                 /* Pixels with flux greater than sat shall be masked */                              \
    142                 inMask->data.PS_TYPE_MASK_DATA[j][i] |= PM_MASK_SAT;                                 \
    143             }                                                                                        \
    144             if(mask->data.PS_TYPE_MASK_DATA[j][i] & maskVal) {                                       \
    145                 /* Pixels in mask which satisfy maskVal shall have their pixels masked in inMask */  \
    146                 inMask->data.PS_TYPE_MASK_DATA[j][i] |= mask->data.PS_TYPE_MASK_DATA[j][i]|maskVal;  \
    147             }                                                                                        \
    148             rowMin = MAX(j-grow, 0);                                                                 \
    149             rowMax = MIN(j+grow, inImage->numRows-1);                                                \
    150             colMin = MAX(i-grow, 0);                                                                 \
    151             colMax = MIN(i+grow, inImage->numCols-1);                                                \
    152             for(jj=rowMin; jj<rowMax; jj++) {                                                        \
    153                 for(ii=colMin; ii<colMax; ii++) {                                                    \
    154                     if(mask->data.PS_TYPE_MASK_DATA[j][i] & growVal) {                               \
    155                         r = sqrtf((ii-i)*(ii-i)+(jj-j)*(jj-j));                                      \
    156                         if(r <= grow) {                                                              \
    157                             /* Pixels in mask which satisfy growVal shall have their corresponding   \
    158                             pixels,along with all pixels within the grow radius masked */            \
    159                             inMask->data.PS_TYPE_MASK_DATA[j][i] |=                                  \
    160                                     mask->data.PS_TYPE_MASK_DATA[j][i]&growVal;                          \
    161                         }                                                                            \
    162                     }                                                                                \
    163                 }                                                                                    \
    164             }                                                                                        \
    165         }                                                                                            \
    166     }                                                                                                \
     139case PS_TYPE_##TYPE:                                                                                         \
     140    for(j=totOffRow; j<inImage->numRows; j++) {                                                              \
     141        for(i=totOffCol; i<inImage->numCols; i++) {                                                          \
     142            \
     143            /* Pixels with flux greater than sat shall be masked */                                          \
     144            if(inImage->data.TYPE[j][i] > sat) {                                                             \
     145                inMask->data.PS_TYPE_MASK_DATA[j][i] |= PM_MASK_SAT;                                         \
     146            }                                                                                                \
     147            \
     148            /* Pixels which satisfy maskVal shall be masked */                                               \
     149            inMask->data.PS_TYPE_MASK_DATA[j][i] |= (mask->data.PS_TYPE_MASK_DATA[j][i]&maskVal);            \
     150            \
     151            /* Pixels which satisfy growVal and within the grow radius shall be masked */                    \
     152            if(mask->data.PS_TYPE_MASK_DATA[j][i] & growVal) {                                               \
     153                rowMin = MAX(j-grow, 0);                                                                     \
     154                rowMax = MIN(j+grow+1, inImage->numRows);                                                    \
     155                colMin = MAX(i-grow, 0);                                                                     \
     156                colMax = MIN(i+grow+1, inImage->numCols);                                                    \
     157                for(jj=rowMin; jj<rowMax; jj++) {                                                            \
     158                    for(ii=colMin; ii<colMax; ii++) {                                                        \
     159                        r = sqrtf((ii-i)*(ii-i)+(jj-j)*(jj-j));                                              \
     160                        rRound = r + 0.5;                                                                    \
     161                        if(rRound <= grow) {                                                                 \
     162                            inMask->data.PS_TYPE_MASK_DATA[jj][ii] |=                                        \
     163                                    (mask->data.PS_TYPE_MASK_DATA[j][i]&growVal);                            \
     164                        }                                                                                    \
     165                    }                                                                                        \
     166                }                                                                                            \
     167            }                                                                                                \
     168        }                                                                                                    \
     169    }                                                                                                        \
    167170    break;
    168171
Note: See TracChangeset for help on using the changeset viewer.