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/psModules/src/imcombine/pmImageCombine.c

    r12742 r21183  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2007-04-04 22:42:48 $
     10 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2009-01-27 06:39:38 $
    1212 *
    1313 *  XXX: pmRejectPixels() has a known bug with the pmImageTransform() call.
     
    1717 */
    1818
     19// XXX this is somewhat messy and unclear on the masking.
     20
    1921#ifdef HAVE_CONFIG_H
    2022#include <config.h>
     
    5355
    5456    buffer->pixels = psVectorAlloc(numImages, PS_TYPE_F32);
    55     buffer->masks = psVectorAlloc(numImages, PS_TYPE_MASK);
     57    buffer->masks = psVectorAlloc(numImages, PS_TYPE_VECTOR_MASK);
    5658    buffer->errors = psVectorAlloc(numImages, PS_TYPE_F32);
    5759    buffer->stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_STDEV);
     
    6769                          const psArray *errors, // Array of input error images
    6870                          const psArray *masks, // Array of input masks
    69                           psU32 maskVal, // Mask value
     71                          psImageMaskType maskVal, // Mask value
    7072                          psS32 numIter, // Number of rejection iterations
    7173                          psF32 sigmaClip, // Number of standard deviations at which to reject
     
    115117        if (masks) {
    116118            psImage *mask = masks->data[i]; // Mask of interest
    117             pixelMasks->data.U8[i] = mask->data.U8[y][x];
    118         }        // Set the pixel error data, if necessary
     119            pixelMasks->data.PS_TYPE_VECTOR_MASK_DATA[i] = (mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskVal);
     120        }       
     121        // Set the pixel error data, if necessary
    119122        if (errors) {
    120123            psImage *error = errors->data[i]; // Error image of interest
     
    128131    for (int iter = 0; iter < numIter; iter++) {
    129132        // Combine all the pixels, using the specified stat.
    130         if (!psVectorStats(stats, pixelData, pixelErrors, pixelMasks, maskVal)) {
     133        if (!psVectorStats(stats, pixelData, pixelErrors, pixelMasks, 0xff)) {
    131134            combine->data.F32[y][x] = NAN;
    132135            psFree(buffer);
     
    148151        float stdev = stats->sampleStdev;
    149152        for (int i = 0; i < numImages; i++) {
    150             if (!(pixelMasks->data.U8[i] & maskVal) &&
     153            if (!(pixelMasks->data.PS_TYPE_VECTOR_MASK_DATA[i] & 0xff) &&
    151154                    fabs(pixelData->data.F32[i] - combinedPixel) > sigmaClip * stdev) {
    152155                // Reject pixel as questionable
    153156                numRejects++;
    154                 pixelMasks->data.U8[i] = maskVal;
     157                pixelMasks->data.PS_TYPE_IMAGE_MASK_DATA[i] = 0xff;
    155158                if (questionablePixels) {
    156159                    // Mark the pixel as questionable
     
    191194    const psArray *errors,              ///< Array of input error images
    192195    const psArray *masks,               ///< Array of input masks
    193     psU32 maskVal,                      ///< Mask value
     196    psImageMaskType maskVal,                      ///< Mask value
    194197    const psPixels *pixels,             ///< Pixels to combine
    195198    psS32 numIter,                      ///< Number of rejection iterations
     
    231234            psImage *mask  = masks->data[i];
    232235            PS_ASSERT_IMAGE_SIZE(mask, numCols, numRows, NULL);
    233             PS_ASSERT_IMAGE_TYPE(mask, PS_TYPE_MASK, NULL);
     236            PS_ASSERT_IMAGE_TYPE(mask, PS_TYPE_IMAGE_MASK, NULL);
    234237        }
    235238    }
     
    319322    int num = 0;
    320323    psVector *pixels = psVectorAlloc(8, PS_TYPE_F32); // Array of pixels
    321     psVector *mask = psVectorAlloc(8, PS_TYPE_U8); // Corresponding mask
     324    psVector *mask = psVectorAlloc(8, PS_TYPE_VECTOR_MASK); // Corresponding mask
    322325
    323326    // Get limits
     
    329332        for (int j = yMin; j <= yMax; j++) {
    330333            for (int i = xMin; i <= xMax; i++) {
    331                 if ((i != x) && (j != y) && (0 == imageMask->data.U8[j][i])) {
     334                if ((i != x) && (j != y) && (0 == imageMask->data.PS_TYPE_IMAGE_MASK_DATA[j][i])) {
    332335                    pixels->data.F32[num] = image->data.F32[j][i];
    333                     mask->data.U8[num] = 0;
     336                    mask->data.PS_TYPE_VECTOR_MASK_DATA[num] = 0;
    334337                    num++;
    335338                } else {
    336                     mask->data.U8[num] = 1;
     339                    mask->data.PS_TYPE_VECTOR_MASK_DATA[num] = 1;
    337340                }
    338341            }
     
    347350                if ((i != x) && (j != y)) {
    348351                    pixels->data.F32[num] = image->data.F32[j][i];
    349                     mask->data.U8[num] = 0;
     352                    mask->data.PS_TYPE_VECTOR_MASK_DATA[num] = 0;
    350353                    num++;
    351354                } else {
    352                     mask->data.U8[num] = 1;
     355                    mask->data.PS_TYPE_VECTOR_MASK_DATA[num] = 1;
    353356                }
    354357            }
     
    473476    for (psS32 i = 0 ; i < image->numRows ; i++) {
    474477        for (psS32 j = 0 ; j < image->numCols ; j++) {
    475             imgF32->data.F32[i][j] = (psF32) image->data.U8[i][j];
     478            imgF32->data.F32[i][j] = (psF32) image->data.PS_TYPE_IMAGE_MASK_DATA[i][j];
    476479        }
    477480    }
     
    518521            PS_ASSERT_IMAGE_NON_NULL(tmpMask, NULL);
    519522            PS_ASSERT_IMAGE_NON_EMPTY(tmpMask, NULL);
    520             PS_ASSERT_IMAGE_TYPE(tmpMask, PS_TYPE_F32, NULL);
     523            PS_ASSERT_IMAGE_TYPE(tmpMask, PS_TYPE_F32, NULL); // XXX really F32??
    521524            PS_ASSERT_IMAGES_SIZE_EQUAL(tmpImage, tmpMask, NULL);
    522525        }
     
    571574
    572575        //
    573         // Create a psU8 mask image from the list of cosmic pixels.
     576        // Create a psImageMaskType mask image from the list of cosmic pixels.
    574577        //
    575578        psImage *maskImage = NULL;
Note: See TracChangeset for help on using the changeset viewer.