IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 30, 2013, 4:48:58 PM (13 years ago)
Author:
eugene
Message:

updates from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130711/pstamp/src/ppstampMakeStamp.c

    r35611 r36071  
    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
     
    166167    ppstampVersionMetadata(outHDU->header, options);
    167168
     169    // copy any user supplied keywords
     170    if (options->headerAdditions) {
     171        if (!psMetadataOverlay(outHDU->header, options->headerAdditions)) {
     172            psError(PS_ERR_UNKNOWN, false, "Failed to copy header additions to output\n");
     173            return false;
     174        }
     175    }
     176
     177
    168178    return true;
    169179}
     
    328338            status = false;
    329339            break;
     340        }
     341        if (!imageHasValidPixels(outReadout->image)) {
     342            return PSTAMP_NO_VALID_PIXELS;
    330343        }
    331344        if (readout->variance) {
     
    876889    return true;
    877890}
     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}
Note: See TracChangeset for help on using the changeset viewer.