IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 25, 2007, 5:09:31 PM (19 years ago)
Author:
bills
Message:

Shift the transform by the stamps integer offset from the original
image.
Added ugly temporary hack to work around the megacam problem.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppstamp/src/ppstampMakeStamp.c

    r15363 r15388  
    44
    55#include "ppstamp.h"
    6 #include "pmFPAAstrometry.h"
    76#include "pmAstrometryUtils.h"
    87
     
    2524    PS_ASSERT_PTR_NON_NULL(hdu->header, 1)
    2625
    27     outChip->toFPA   = psPlaneTransformSetCenter(NULL, inChip->toFPA, roi->x0, roi->y0);
     26    // Change the reference pixel to account for the change in origin between the stamp and
     27    // the original image
     28    outChip->toFPA   = psPlaneTransformSetCenter(NULL, inChip->toFPA, (int) roi->x0, (int) roi->y0);
    2829
    2930    outChip->fromFPA = psPlaneTransformInvert(NULL, outChip->toFPA, *roi, 50);
     31
     32    // remove these keys which may have been copied from the input header
     33    // XXX pmAstromWriteWCS should do this since it's the one that's inserting
     34    // the PC00* style keywords
     35    if (psMetadataLookup(outHDU->header, "CD1_1")) {
     36        psMetadataRemoveKey(outHDU->header, "CD1_1");
     37        psMetadataRemoveKey(outHDU->header, "CD1_2");
     38        psMetadataRemoveKey(outHDU->header, "CD2_1");
     39        psMetadataRemoveKey(outHDU->header, "CD2_2");
     40    }
    3041
    3142    if (!pmAstromWriteWCS(outHDU->header, outFPA, outChip, WCS_NONLIN_TOL)) {
     
    6172        outHDU->header = psMetadataAlloc();
    6273    }
     74
    6375
    6476    // If input had WCS convert it for stamp
     
    182194            break;
    183195        }
     196
     197        psRegion extractRegion = options->roi;
     198
     199        // Close your eyes while I hack around bug 986
     200        if (ppstampMegacamWorkaround) {
     201            // the coordinates of the mosaic are shifted 32 pixels from the chip
     202            extractRegion.x0 -= 32;
     203            extractRegion.x1 -= 32;
     204        }
    184205   
    185         psImage *subsetImage = psImageSubset(readout->image, options->roi);
     206        psImage *subsetImage = psImageSubset(readout->image, extractRegion);
     207
    186208        if (subsetImage) {
    187209            // make a copy since we're going to change the image's internals
Note: See TracChangeset for help on using the changeset viewer.