IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 29, 2005, 10:53:49 AM (21 years ago)
Author:
rhl
Message:

Make poisRejectStamps return a list of rejected stamps

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pois/src/poisRejectStamps.c

    r3803 r3813  
    66#define SQUARE(x) ((x)*(x))
    77
    8 bool poisRejectStamps(psArray *stamps,  // Array of stamps
    9                       psImage *mask,    // Mask image
    10                       const psVector *deviations, // Vector of deviations for the stamps
    11                       const poisConfig *config // Configuration
     8psList *restrict poisRejectStamps(psArray *stamps, // Array of stamps
     9                                  psImage *mask,        // Mask image
     10                                  const psVector *deviations, // Vector of deviations for the stamps
     11                                  const poisConfig *config // Configuration
    1212    )
    1313{
     
    2121    assert(deviations->type.type == PS_TYPE_F32);
    2222
    23     bool masked = false;                // Have we masked any stamps?
    2423    psVector *devMask = psVectorAlloc(stamps->n, PS_TYPE_U8); // Mask for statistics
    2524
     
    3029        poisStamp *stamp = stamps->data[i];     // The stamp
    3130        // Only interested in the stamps that we're actually using
    32         if (stamp->status == POIS_STAMP_USED) {
     31        if (stamp != NULL && stamp->status == POIS_STAMP_USED) {
    3332            meanDev += SQUARE(deviations->data.F32[i]);
    3433            numDev++;
     
    4140
    4241    // Reject stamps
     42    psList *rejected = NULL;            // rejected stamps
    4343    for (int s = 0; s < deviations->n; s++) {
    4444        poisStamp *stamp = stamps->data[s];
     45        if (stamp == NULL) {
     46            continue;
     47        }
     48       
    4549        if (stamp->status == POIS_STAMP_USED && fabsf(deviations->data.F32[s]) > limit) {
    46             masked = true;
    4750            psTrace("pois.rejectStamps", 1, "Rejecting stamp %d (%d,%d): %f\n", s, stamp->x, stamp->y,
    4851                    deviations->data.F32[s]);
     
    5659           
    5760            // Mark stamp for replacement
    58             stamp->status = POIS_STAMP_RESET;
     61            stamps->data[s] = NULL;
     62           
     63            if (rejected == NULL) {
     64                rejected = psListAlloc(stamp);
     65            } else {
     66                bool failed = psListAdd(rejected, PS_LIST_TAIL, stamp);
     67                assert(!failed);
     68            }
     69            psFree(stamp);
    5970        } // Bad stamps
    6071    } // Iterating over stamps
     
    6273    psFree(devMask);
    6374
    64     return masked;
     75    return rejected;
    6576}
Note: See TracChangeset for help on using the changeset viewer.