IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 1, 2009, 7:13:00 PM (18 years ago)
Author:
eugene
Message:

convert mask references to abstract psImageMaskType and psVectorMaskType as needed

Location:
branches/eam_branch_20081230/psModules/src/imcombine
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20081230/psModules/src/imcombine/pmImageCombine.c

    r21072 r21079  
    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.12.78.1 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2009-01-02 05:13:00 $
    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;
  • branches/eam_branch_20081230/psModules/src/imcombine/pmStack.h

    r21072 r21079  
    88 * @author GLG, MHPCC
    99 *
    10  * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    11  * @date $Date: 2008-11-01 02:59:33 $
     10 * @version $Revision: 1.9.8.1 $ $Name: not supported by cvs2svn $
     11 * @date $Date: 2009-01-02 05:13:00 $
    1212 *
    1313 * Copyright 2004-2007 Institute for Astronomy, University of Hawaii
     
    4343bool pmStackCombine(pmReadout *combined,///< Combined readout (output)
    4444                    psArray *input,     ///< Input array of pmStackData
    45                     psMaskType maskVal, ///< Mask value of bad pixels
    46                     psMaskType bad,     ///< Mask value to give rejected pixels
     45                    psImageMaskType maskVal, ///< Mask value of bad pixels
     46                    psImageMaskType bad,     ///< Mask value to give rejected pixels
    4747                    int kernelSize,     ///< Half-size of the convolution kernel
    4848                    int numIter,        ///< Number of iterations
  • branches/eam_branch_20081230/psModules/src/imcombine/pmSubtraction.h

    r20568 r21079  
    66 * @author GLG, MHPCC
    77 *
    8  * @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
    9  * @date $Date: 2008-11-07 00:03:18 $
     8 * @version $Revision: 1.34.6.1 $ $Name: not supported by cvs2svn $
     9 * @date $Date: 2009-01-02 05:13:00 $
    1010 * Copyright 2004-207 Institute for Astronomy, University of Hawaii
    1111 */
     
    104104                           psImage *subMask, ///< Subtraction mask (or NULL)
    105105                           int stride,  ///< Size of convolution patches
    106                            psMaskType maskBad, ///< Mask value to give bad pixels
    107                            psMaskType maskPoor, ///< Mask value to give poor pixels
     106                           psImageMaskType maskBad, ///< Mask value to give bad pixels
     107                           psImageMaskType maskPoor, ///< Mask value to give poor pixels
    108108                           float poorFrac, ///< Fraction for "poor"
    109109                           float sysError, ///< Relative systematic error
  • branches/eam_branch_20081230/psModules/src/imcombine/pmSubtractionMask.h

    r21072 r21079  
    77psImage *pmSubtractionMask(const psImage *refMask, ///< Mask for the reference image (will be convolved)
    88                           const psImage *inMask, ///< Mask for the input image, or NULL
    9                            psMaskType maskVal, ///< Value to mask out
     9                           psImageMaskType maskVal, ///< Value to mask out
    1010                           int size, ///< Half-size of the kernel (pmSubtractionKernels.size)
    1111                           int footprint, ///< Half-size of the kernel footprint
     
    1919                         psImage *mask, ///< Mask (or NULL)
    2020                         int size,      ///< Kernel half-size
    21                          psMaskType blank ///< Mask value for blank regions
     21                         psImageMaskType blank ///< Mask value for blank regions
    2222    );
    2323
  • branches/eam_branch_20081230/psModules/src/imcombine/pmSubtractionMatch.h

    r20568 r21079  
    4040                        float rej,      ///< Rejection threshold
    4141                        float sysError, ///< Relative systematic error
    42                         psMaskType maskVal, ///< Value to mask for input
    43                         psMaskType maskBad, ///< Mask for output bad pixels
    44                         psMaskType maskPoor, ///< Mask for output poor pixels
     42                        psImageMaskType maskVal, ///< Value to mask for input
     43                        psImageMaskType maskBad, ///< Mask for output bad pixels
     44                        psImageMaskType maskPoor, ///< Mask for output poor pixels
    4545                        float poorFrac, ///< Fraction for "poor"
    4646                        float badFrac,   ///< Maximum fraction of bad input pixels to accept
Note: See TracChangeset for help on using the changeset viewer.