IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 28, 2009, 5:35:05 PM (17 years ago)
Author:
Paul Price
Message:

Reworking stack combination because there are *three* modes for pixels going into the final stack (after rejection), not just two: tested and good, tested and rejected, and not tested. The code did not recognise the third, which is a distinct state because we don't want these pixels grown, as we do for rejected pixels. This cannot be fixed merely by using the 'safe' combination because that would discard the 'tested and good' pixels that have only a single unrejected input but are good because they have survived the testing process. Needed to add a new state into the combination process. Now I add these pixels straight into the 'reject' list. This requires a little bit more fiddling around in ppStack. Not sure it's working yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pap/ppStack/src/ppStackReadout.c

    r25924 r25964  
    2525    psVector *addVariance = options->matchChi2; // Additional variance when rejecting
    2626
    27     psArray *inspect = ppStackReadoutInitial(config, outRO, thread->readouts, mask,
    28                                              weightings, addVariance);
    29 
    30     job->results = inspect;
     27    job->results = ppStackReadoutInitial(config, outRO, thread->readouts, mask,
     28                                         weightings, addVariance);
    3129    thread->busy = false;
    3230
    33     return inspect ? true : false;
     31    return job->results ? true : false;
    3432}
    3533
     
    4341    ppStackOptions *options = args->data[2]; // Options
    4442    pmConfig *config = args->data[3];   // Configuration
    45     bool full = PS_SCALAR_VALUE(args->data[4], U8); // Combine full image?
    46     bool safety = PS_SCALAR_VALUE(args->data[5], U8);    // Safety switch on?
    47     bool normalise = PS_SCALAR_VALUE(args->data[6], U8); // Normalise images?
     43    bool safety = PS_SCALAR_VALUE(args->data[4], U8);    // Safety switch on?
     44    bool normalise = PS_SCALAR_VALUE(args->data[5], U8); // Normalise images?
    4845
    4946    psVector *mask = options->inputMask; // Mask for inputs
     
    5451
    5552    bool status = ppStackReadoutFinal(config, target, thread->readouts, mask, rejected,
    56                                       weightings, addVariance, full, safety, norm); // Status of operation
     53                                      weightings, addVariance, safety, norm); // Status of operation
    5754
    5855    thread->busy = false;
     
    6764
    6865    psArray *args = job->args;  // Input arguments
    69     psArray *inspect = args->data[0]; // Array of pixel arrays
    70     int index = PS_SCALAR_VALUE(args->data[1], S32); // Index of interest
    71 
    72     psArray *inputs = inspect->data[index]; // Array of interest
    73     psPixels *output = NULL;    // Output pixel list
    74     for (int i = 0; i < inputs->n; i++) {
    75         psPixels *input = inputs->data[i]; // Input pixel list
    76         if (!input || input->n == 0) {
    77             continue;
    78         }
    79         output = psPixelsConcatenate(output, input);
    80     }
    81 
    82     if (!output) {
    83         // If there are no pixels to inspect, then just fake it
    84         output = psPixelsAllocEmpty(0);
    85     }
    86 
    87     psFree(inputs);
    88     inspect->data[index] = output;
     66    psArray *inspects = args->data[0]; // Array of pixel arrays
     67    psArray *rejects = args->data[1];  // Array of pixel arrays
     68    int index = PS_SCALAR_VALUE(args->data[2], S32); // Index of interest
     69
     70    psArray *inInspects = inspects->data[index]; // Array of interest
     71    psArray *inRejects = rejects->data[index]; // Array of interest
     72    psAssert(inInspects->n == inRejects->n, "Size should be the same");
     73    psPixels *outInspect = NULL, *outReject = NULL; // Output pixel lists
     74    for (int i = 0; i < inInspects->n; i++) {
     75        psPixels *inInspect = inInspects->data[i]; // Input pixel list
     76        if (inInspect && inInspect->n > 0) {
     77            outInspect = psPixelsConcatenate(outInspect, inInspect);
     78        }
     79        psPixels *inReject = inRejects->data[i]; // Input pixel list
     80        if (inReject && inReject->n > 0) {
     81            outReject = psPixelsConcatenate(outReject, inReject);
     82        }
     83    }
     84
     85    // If there are no pixels to inspect, then just fake it
     86    if (!outInspect) {
     87        outInspect = psPixelsAllocEmpty(0);
     88    }
     89    if (!outReject) {
     90        outReject = psPixelsAllocEmpty(0);
     91    }
     92
     93    psFree(inspects->data[index]);
     94    inspects->data[index] = outInspect;
     95    psFree(rejects->data[index]);
     96    rejects->data[index] = outReject;
    8997
    9098    return true;
     
    154162
    155163    if (!pmStackCombine(outRO, stack, maskVal | maskBad, maskBad, kernelSize, iter,
    156                         combineRej, combineSys, combineDiscard, true, useVariance, safe, false)) {
     164                        combineRej, combineSys, combineDiscard, useVariance, safe, false)) {
    157165        psError(PS_ERR_UNKNOWN, false, "Unable to combine input readouts with rejection.");
    158166        psFree(stack);
     
    160168    }
    161169
    162     // Save list of pixels to inspect
     170    // Save lists of pixels
    163171    psArray *inspect = psArrayAlloc(num); // List of pixels to inspect
     172    psArray *reject = psArrayAlloc(num);  // List of pixels rejected
    164173    for (int i = 0; i < num; i++) {
    165174        pmStackData *data = stack->data[i]; // Data for this image
     
    172181        }
    173182        inspect->data[i] = psMemIncrRefCounter(data->inspect);
     183        reject->data[i] = psMemIncrRefCounter(data->reject);
    174184    }
    175185    psFree(stack);
     
    177187    sectionNum++;
    178188
    179     return inspect;
     189    psArray *results = psArrayAlloc(2); // Array of results
     190    results->data[0] = inspect;
     191    results->data[1] = reject;
     192
     193    return results;
    180194}
    181195
     
    184198bool ppStackReadoutFinal(const pmConfig *config, pmReadout *outRO, const psArray *readouts,
    185199                         const psVector *mask, const psArray *rejected, const psVector *weightings,
    186                          const psVector *addVariance, bool full, bool safety, const psVector *norm)
     200                         const psVector *addVariance, bool safety, const psVector *norm)
    187201{
    188202    assert(config);
     
    225239    for (int i = 0; i < num; i++) {
    226240        pmReadout *ro = readouts->data[i];
    227         if (mask->data.U8[i] & (PPSTACK_MASK_REJECT | PPSTACK_MASK_BAD)) {
    228             // Image completely rejected since previous combination
    229             full = true;
    230             continue;
    231         } else if (mask->data.U8[i]) {
    232             // Image completely rejected before original combination
     241        if (mask->data.U8[i]) {
     242            // Image completely rejected
    233243            continue;
    234244        }
     
    262272    }
    263273
    264     if (!pmStackCombine(outRO, stack, maskVal | maskBad, maskBad, 0,
    265                         iter, combineRej, combineSys, combineDiscard,
    266                         full, useVariance, safe, !rejected)) {
     274    if (!pmStackCombine(outRO, stack, maskVal | maskBad, maskBad, 0, iter, combineRej,
     275                        combineSys, combineDiscard, useVariance, safe, !rejected)) {
    267276        psError(PS_ERR_UNKNOWN, false, "Unable to combine input readouts.");
    268277        psFree(stack);
Note: See TracChangeset for help on using the changeset viewer.