IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4571


Ignore:
Timestamp:
Jul 15, 2005, 3:45:50 PM (21 years ago)
Author:
Paul Price
Message:

Centralised the check for bad stamps, allow multiple columns in stamps file, check that input stamps are OK before using

File:
1 edited

Legend:

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

    r4569 r4571  
    33#include "pois.h"
    44
     5#define MAXLINE 128                     // Maximum length of a line in the stamps file
     6
     7
    58psArray *poisReadStamps(psArray *stamps,// Stamps
    69                        FILE **stampFP, // File pointer for stamps file
     10                        const psImage *image, // Image for which to find stamps
     11                        const psImage *mask, // Mask image
    712                        const poisConfig *config // Configuration
    813    )
     
    2833                int xPixel, yPixel;     // Integer position
    2934                int result = 0;         // Result of fscanf
     35                bool badPixels = false; // Result of check on stamp footprint
     36                char line[MAXLINE];     // The line from the stamps file
     37                char *lineBack;         // The line back from fgets
    3038                do {
    31                     result = fscanf(fp, "%f %f", &x, &y);
     39                    lineBack = fgets(line, MAXLINE, fp);
     40                    result = sscanf(line, "%f %f", &x, &y);
     41
    3242                    // Add 0.5 for rounding, and subtract 1.0 for unit-offset to zero-offset
    3343                    xPixel = (int)(x - 0.5);
    3444                    yPixel = (int)(y - 0.5);
    35                 } while ((xPixel < config->footprint + config->xKernel ||
    36                           yPixel < config->footprint + config->yKernel ||
    37                           xPixel > config->xImage - config->footprint - config->xKernel ||
    38                           yPixel > config->yImage - config->footprint - config->yKernel) &&
    39                          result == 2);
    40                 if (result == 2) {
     45                } while (! poisCheckStamp(image, mask, xPixel, yPixel, config) && result == 2 && lineBack);
     46                if (result == 2 && lineBack) {
    4147                    stamp->x = xPixel;
    4248                    stamp->y = yPixel;
     
    4450                    psTrace("pois.readStamps", 7, "Stamp %d: %d,%d\n", i, stamp->x, stamp->y);
    4551                } else {
     52                    // We've run out of stamps in the file --- probably got EOF
    4653                    stamp->status = POIS_STAMP_BAD;
    4754                }
    4855            } else {
     56                // Stamp file isn't open!
    4957                stamp->status = POIS_STAMP_BAD;
    5058            }
Note: See TracChangeset for help on using the changeset viewer.