IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17006


Ignore:
Timestamp:
Mar 17, 2008, 11:39:43 AM (18 years ago)
Author:
Paul Price
Message:

Reject an entire image if the fraction of rejected pixels exceeds a recipe-defined limit. Cleared out old recipe inputs.

Location:
trunk/ppStack/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStackArguments.c

    r16830 r17006  
    129129    psMetadataAddS32(arguments, PS_LIST_TAIL, "-iter", 0, "Number of rejection iterations", 0);
    130130    psMetadataAddF32(arguments, PS_LIST_TAIL, "-combine-rej", 0, "Combination rejection thresold (sigma)", NAN);
    131     psMetadataAddF32(arguments, PS_LIST_TAIL, "-convolve-rej", 0, "Convolution rejection thresold (sigma)", NAN);
    132     psMetadataAddF32(arguments, PS_LIST_TAIL, "-extent", 0, "Extent of convolution (sigma)", NAN);
    133131    psMetadataAddU8(arguments,  PS_LIST_TAIL, "-mask-bad", 0, "Mask value for bad pixels", 0);
    134132    psMetadataAddU8(arguments,  PS_LIST_TAIL, "-mask-blank", 0, "Mask value for blank region", 0);
    135133    psMetadataAddF32(arguments, PS_LIST_TAIL, "-threshold-mask", 0, "Threshold for mask deconvolution", NAN);
     134    psMetadataAddF32(arguments, PS_LIST_TAIL, "-image-rej", 0, "Pixel rejection fraction threshold for rejecting entire image", NAN);
    136135    psMetadataAddS32(arguments, PS_LIST_TAIL, "-rows", 0, "Rows to read at once", 128);
    137136    psMetadataAddBool(arguments, PS_LIST_TAIL, "-photometry", 0, "Do photometry on stacked image?", false);
     
    180179    VALUE_ARG_RECIPE_INT("-iter",             "ITER",           S32, 0);
    181180    VALUE_ARG_RECIPE_FLOAT("-combine-rej",    "COMBINE.REJ",    F32);
    182     VALUE_ARG_RECIPE_FLOAT("-convolve-rej",   "CONVOLVE.REJ",   F32);
    183     VALUE_ARG_RECIPE_FLOAT("-extent",         "EXTENT",         F32);
    184181    VALUE_ARG_RECIPE_MASK("-mask-bad",        "MASK.BAD");
    185182    VALUE_ARG_RECIPE_MASK("-mask-blank",      "MASK.BLANK");
    186183    VALUE_ARG_RECIPE_FLOAT("-threshold-mask", "THRESHOLD.MASK", F32);
     184    VALUE_ARG_RECIPE_FLOAT("-image-rej",      "IMAGE.REJ",      F32);
    187185    VALUE_ARG_RECIPE_INT("-rows",             "ROWS",           S32, 0);
    188186
  • trunk/ppStack/src/ppStackLoop.c

    r16999 r17006  
    183183
    184184    float threshold = psMetadataLookupF32(NULL, config->arguments, "THRESHOLD.MASK"); // Threshold for mask deconvolution
     185    float imageRej = psMetadataLookupF32(NULL, config->arguments, "IMAGE.REJ"); // Maximum fraction of image to reject before rejecting entire image
    185186
    186187    const char *statsName = psMetadataLookupStr(&mdok, config->arguments, "STATS"); // Filename for statistics
     
    472473                                             subKernels->data[i]); // Pixels to reject
    473474            psFree(inspect);
    474             psTrace("ppStack", 5, "%ld pixels rejected from image %d", reject->n, i);
     475            float frac = reject->n / (float)(ro->image->numCols * ro->image->numRows); // Pixel fraction
     476            psTrace("ppStack", 5, "%ld pixels rejected from image %d (%.1f%%)", reject->n, i, frac * 100.0);
     477            if (frac > imageRej) {
     478                psWarning("Image %d rejected completely because rejection fraction (%.3f) "
     479                          "exceeds limit (%.3f)", i, frac, imageRej);
     480                psFree(reject);
     481                // reject == NULL means reject image completely
     482                reject = NULL;
     483            }
    475484            rejected->data[i] = reject;
    476485        }
     
    484493            psTrace("ppStack", 2, "Final stack of chunk %d....\n", numChunk);
    485494            for (int i = 0; i < num; i++) {
     495                if (!rejected->data[i]) {
     496                    continue;
     497                }
    486498                pmReadout *readout = readouts->data[i];
    487499                assert(readout);
  • trunk/ppStack/src/ppStackReadout.c

    r16987 r17006  
    6666    }
    6767
    68     if (!pmStackCombine(outRO, stack, maskBad, maskBlank, kernelSize, iter, combineRej, useVariance, safe)) {
     68    if (!pmStackCombine(outRO, stack, maskBad, maskBlank, kernelSize, iter, combineRej, true,
     69                        useVariance, safe)) {
    6970        psError(PS_ERR_UNKNOWN, false, "Unable to combine input readouts with rejection.");
    7071        psFree(stack);
     
    8586    for (int i = 0; i < stack->n; i++) {
    8687        pmStackData *data = stack->data[i]; // Data for this image
    87         psImage *inspected = psPixelsToMask(NULL, data->pixels,
     88        psImage *inspected = psPixelsToMask(NULL, data->inspect,
    8889                                            psRegionSet(0, outRO->image->numCols - 1,
    8990                                                        0, outRO->image->numRows - 1),
     
    105106        psMetadataAddPtr(readout->analysis, PS_LIST_TAIL, PPSTACK_INSPECT_PIXELS,
    106107                         PS_DATA_PIXELS | PS_META_DUPLICATE_OK, "Pixels to inspect from initial combination",
    107                          data->pixels);
    108     }
    109 
     108                         data->inspect);
     109    }
    110110    psFree(stack);
    111111
     
    144144    psList *fpaList = psListAlloc(NULL); // List of input FPAs, for concept averaging
    145145    psList *cellList = psListAlloc(NULL); // List of input cells, for concept averaging
     146    int numGood = num;                  // Number of good inputs: images that haven't been completely rejected
    146147    for (int i = 0; i < num; i++) {
     148        if (!rejected->data[i]) {
     149            // Image completely rejected
     150            numGood--;
     151            continue;
     152        }
     153
    147154        pmReadout *ro = readouts->data[i];
    148155        assert(ro);
     
    201208
    202209        pmStackData *data = pmStackDataAlloc(ro, weighting);
    203         data->pixels = psMemIncrRefCounter(rejected->data[i]);
     210        data->reject = psMemIncrRefCounter(rejected->data[i]);
    204211        stack->data[i] = data;
    205212    }
     
    212219                continue;
    213220            }
    214             psImage *reject = psPixelsToMask(NULL, data->pixels,
     221            psImage *reject = psPixelsToMask(NULL, data->reject,
    215222                                             psRegionSet(0, outRO->image->numCols - 1,
    216223                                                         0, outRO->image->numRows - 1),
     
    227234#endif
    228235
    229     if (!pmStackCombine(outRO, stack, maskBad, maskBlank, 0, 0, NAN, useVariance, false)) {
     236    if (!pmStackCombine(outRO, stack, maskBad, maskBlank, 0, 0, NAN, numGood != num, useVariance, false)) {
    230237        psError(PS_ERR_UNKNOWN, false, "Unable to combine input readouts.");
    231238        psFree(fpaList);
Note: See TracChangeset for help on using the changeset viewer.