IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35533


Ignore:
Timestamp:
May 8, 2013, 1:38:20 PM (13 years ago)
Author:
bills
Message:

compute number of additional pixels masked by the auxilary mask and save it
in the statistic MASKFRAC_MAGIC

Location:
trunk/ppImage/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppImage.h

    r35531 r35533  
    315315void ppImageRandomGaussianFree(void);
    316316
    317 bool ppImageAuxiliaryMask(pmConfig *config, const pmFPAview *view, const ppImageOptions *options);
     317bool ppImageAuxiliaryMask(pmConfig *config, const pmFPAview *view, const ppImageOptions *options, psMetadata *stats);
    318318
    319319#endif
  • trunk/ppImage/src/ppImageAuxiliaryMask.c

    r35531 r35533  
    5353
    5454// In this function, we augment the mask with the more conservative auxiliary mask
    55 bool ppImageAuxiliaryMask(pmConfig *config, const pmFPAview *view, const ppImageOptions *options)
     55bool ppImageAuxiliaryMask(pmConfig *config, const pmFPAview *view, const ppImageOptions *options, psMetadata *stats)
    5656{
    5757    psAssert(config, "Need configuration");
     
    6060
    6161    if (!options->doAuxMask) {
     62        psLogMsg ("ppImage", PS_LOG_INFO, "Auxiliary mask not enabled.");
    6263        return true;
    6364    }
     
    139140         return false;
    140141    }
     142    psLogMsg ("ppImage", PS_LOG_INFO, "Auxiliary mask file: %s", auxMaskFileName);
    141143
    142144    psFree(results);
     
    160162            return false;
    161163        }
     164        psLogMsg ("ppImage", PS_LOG_INFO, "Auxiliary video mask file: %s", options->auxVideoMask);
    162165        pmConfigRunFilenameAddRead(config, "PPIMAGE.AUXVIDEOMASK", options->auxVideoMask);
    163166        recordFileInHeader(chip, "DETREND.AUXVIDEOMASK", "auxiliary video mask", options->auxVideoMask);
     
    179182    psImageMaskType maskDetector = pmConfigMaskGet("DETECTOR", config);
    180183
     184    psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, "PPIMAGE");
     185    psAssert(recipe, "Need recipe!");
     186    psImageMaskType staticMaskVal = psMetadataLookupImageMask(&status, recipe, "MASKSTAT.STATIC");
     187    psAssert(staticMaskVal, "Need staticMaskVal!");
     188
    181189    int numCols = mask->numCols, numRows = mask->numRows; // Size of image
     190    unsigned long numMasked = 0;
    182191    for (int y = 0; y < numRows; y++) {
    183192        for (int x = 0; x < numCols; x++) {
     
    185194            // XXX: support other types and get the mask value from the header
    186195            if (auxMask->data.F32[y][x] == 0) {
    187                 mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= maskDetector;
     196                if ((mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & staticMaskVal) == 0) {
     197                    // pixel was not previously included in the static mask so mask it
     198                    ++numMasked;
     199                    mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= maskDetector;
     200                }
    188201                // I don't need to do this.
    189202                // The background subtraction code runs after us and will do it there
     
    193206    }
    194207
     208    float maskedFrac = (float) numMasked / (numRows * numCols);
     209    psLogMsg ("ppImage", PS_LOG_INFO, "Auxiliary masks masked %ld aditional pixels. Masked fraction: %f", numMasked, maskedFrac);
     210    if (stats) {
     211        psMetadataAddF32(stats,PS_LIST_TAIL, "MASKFRAC_MAGIC", PS_META_REPLACE,
     212                   "Fraction of pixels masked by auxiliary masks", maskedFrac);
     213    }
     214
    195215    psFree(auxMask);
    196216
  • trunk/ppImage/src/ppImageLoop.c

    r35531 r35533  
    189189        }
    190190
    191         if (!ppImageAuxiliaryMask(config, view, options)) {
     191        if (!ppImageAuxiliaryMask(config, view, options, stats)) {
    192192            ESCAPE("Unable to apply auxiliary mask");
    193193        }
Note: See TracChangeset for help on using the changeset viewer.