IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36060


Ignore:
Timestamp:
Aug 30, 2013, 3:06:50 PM (13 years ago)
Author:
bills
Message:

In ppstamp check floating point stamp image and if no valid pixels are found
return new error PSTAMP_NO_VALID_PIXELS instead of writing out a completely
empty image

Location:
trunk/pstamp/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/src/Makefile.am

    r34089 r36060  
    1 bin_PROGRAMS = ppstamp pstamprequest pstampdump
     1bin_PROGRAMS = ppstamp pstampdump
    22
    33include_HEADERS = \
  • trunk/pstamp/src/ppstampMakeStamp.c

    r35893 r36060  
    2020static bool setMaskedToNAN(pmConfig *config, psImage *image, psImage *mask, psImage *variance);
    2121static bool copySources(pmReadout *outputReadout, pmReadout *inputReadout, pmReadout *astromReadout, psRegion extractRegion);
     22static bool imageHasValidPixels(psImage *image);
    2223
    2324// convert the input chip's transforms to the output
     
    337338            status = false;
    338339            break;
     340        }
     341        if (!imageHasValidPixels(outReadout->image)) {
     342            return PSTAMP_NO_VALID_PIXELS;
    339343        }
    340344        if (readout->variance) {
     
    885889    return true;
    886890}
     891
     892static bool
     893imageHasValidPixels(psImage *image) {
     894    // check F32 image and return true if any pixel is finite
     895    if (image->type.type != PS_TYPE_F32) {
     896        return true;
     897    }
     898    for (int y=0; y<image->numRows; y++) {
     899        for (int x=0; x<image->numCols; x++) {
     900            psF32 pixel = image->data.F32[y][x];
     901            if (isfinite(pixel)) {
     902                return true;
     903            }
     904        }
     905    }
     906    return false;
     907}
  • trunk/pstamp/src/pstamp.h

    r34596 r36060  
    1515        PSTAMP_DUP_REQUEST      = 20,
    1616        PSTAMP_INVALID_REQUEST  = 21,
    17         PSTAMP_UNKNOWN_PRODUCT  = 22,
     17        PSTAMP_UNKNOWN_PROJECT  = 22,
    1818        PSTAMP_NO_IMAGE_MATCH   = 23,
    1919        PSTAMP_NOT_DESTREAKED   = 24,
     
    2121        PSTAMP_GONE             = 26,
    2222        PSTAMP_NO_JOBS_QUEUED   = 27,
    23         PSTAMP_NO_OVERLAP       = 28
     23        PSTAMP_NO_OVERLAP       = 28,
     24        PSTAMP_NOT_AUTHORIZED   = 29,
     25        PSTAMP_NO_VALID_PIXELS  = 30,
    2426} pstampJobErrors;
    2527
     
    3436#define PSTAMP_SELECT_BACKMDL       32
    3537#define PSTAMP_SELECT_JPEG          64
    36 // unused                           128
    37 // unused                           256
     38#define PSTAMP_SELECT_EXP           128
     39#define PSTAMP_SELECT_NUM           256
    3840#define PSTAMP_SELECT_UNCOMPRESSED  512
    3941#define PSTAMP_SELECT_INVERSE       1024
     
    4446
    4547#define PSTAMP_NO_WAIT_FOR_UPDATE   32768
     48#ifdef notdef
    4649#define PSTAMP_REQUEST_UNCENSORED  0x10000
    4750#define PSTAMP_REQUIRE_UNCENSORED  0x20000
     51#endif
    4852
    4953#define PSTAMP_CENTER_IN_PIXELS 1
Note: See TracChangeset for help on using the changeset viewer.