IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 23, 2007, 11:50:52 AM (19 years ago)
Author:
bills
Message:

Extract postage stamp from chip mosaic image. Changed -celcenter to -skycenter
Range in celestial coordinates not specified with -arcrange (arcseconds)
Better error handling.
Allow files without WCS if we don't need it

Location:
trunk/ppstamp/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppstamp/src

    • Property svn:ignore
      •  

        old new  
        66config.h.in
        77stamp-h1
         8ppstampErrorCodes.c
         9ppstampErrorCodes.h
  • trunk/ppstamp/src/ppstampRegion.c

    r15323 r15363  
    2121    // pmReadoutExtent ignores the col0, row0 of the readout
    2222
    23     int col0 = image->col0;
    24     int row0 = image->row0;
     23    int col0 = 0;
     24    int row0 = 0;
     25   
     26#ifdef notdef
     27    if (image->parent) {
     28        // This is wrong. I'm trying to deal with the strange megacam 'spliced' images
     29        // which appear to have inconsistant CELL.X0 and readout.col0
     30        col0 = image->col0 - image->parent->col0;
     31        row0 = image->row0 - image->parent->row0;
     32    }
     33#endif
    2534
    2635    return psRegionAlloc(col0, col0 + image->numCols,
     
    4453        psFree(roExtent);
    4554    }
    46     // Unlike pmCellExtent we don't add in cell.x0, cell.y0. The appropriate offset
    47     // was included in the roExtent by ppstampReadoutRegion
     55
     56    bool mdok;                          // Status of MD lookup
     57    int cellX0 = psMetadataLookupS32(&mdok, cell->concepts, "CELL.X0"); // Cell x offset
     58    if (!mdok) {
     59        psError(PS_ERR_UNKNOWN, true, "Unable to find CELL.X0.\n");
     60        psFree(cellExtent);
     61        return NULL;
     62    }
     63
     64    int cellY0 = psMetadataLookupS32(&mdok, cell->concepts, "CELL.Y0"); // Cell y offset
     65    if (!mdok) {
     66        psError(PS_ERR_UNKNOWN, true, "Unable to find CELL.Y0.\n");
     67        psFree(cellExtent);
     68        return NULL;
     69    }
     70    int xParity = psMetadataLookupS32(NULL, cell->concepts, "CELL.XPARITY");
     71    int yParity = psMetadataLookupS32(NULL, cell->concepts, "CELL.YPARITY");
     72
     73    if (xParity >= 0) {
     74        cellExtent->x0 += cellX0;
     75        cellExtent->x1 += cellX0;
     76    } else {
     77        float x0 = cellX0 - cellExtent->x1;
     78        float x1 = cellX0 - cellExtent->x0;
     79        cellExtent->x0 = x0;
     80        cellExtent->x1 = x1;
     81    }
     82
     83    if (yParity >= 0) {
     84        cellExtent->y0 += cellY0;
     85        cellExtent->y1 += cellY0;
     86    } else {
     87        float y0 = cellY0 - cellExtent->y1;
     88        float y1 = cellY0 - cellExtent->y0;
     89        cellExtent->y0 = y0;
     90        cellExtent->y1 = y1;
     91    }
    4892
    4993    return cellExtent;
Note: See TracChangeset for help on using the changeset viewer.