IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 21, 2007, 12:09:22 PM (19 years ago)
Author:
eugene
Message:

fpa field is now determined by the header and/or the chip regions; pixel scale is not needed for readBilevelMosaic, etc; fixed trimsec errors on input/output; fixed errors on map boundaries

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pswarp/src/pswarpMatchRange.c

    r10958 r12523  
    22
    33# define TEST_MINMAX \
    4     psPlaneTransformApply(FP, chipDest->toFPA, destPix); \
    5     psPlaneTransformApply (TP, fpaDest->toTPA, FP); \
    6     psDeproject (sky, TP, fpaDest->toSky); \
    7     psProject (TP, sky, fpaSrc->toSky); \
    8     psPlaneTransformApply (FP, fpaSrc->fromTPA, TP); \
    9     psPlaneTransformApply (srcPix, chipSrc->fromFPA, FP); \
     4    psPlaneTransformApply(destFP, chipDest->toFPA, destPix); \
     5    psPlaneTransformApply (destTP, fpaDest->toTPA, destFP); \
     6    psDeproject (sky, destTP, fpaDest->toSky); \
     7    psProject (srcTP, sky, fpaSrc->toSky); \
     8    psPlaneTransformApply (srcFP, fpaSrc->fromTPA, srcTP); \
     9    psPlaneTransformApply (srcPix, chipSrc->fromFPA, srcFP); \
     10    fprintf (stderr, "%6.1f,%6.1f -> ", srcPix->x, srcPix->y); \
    1011    *minX = PS_MIN (*minX, srcPix->x); \
    1112    *minY = PS_MIN (*minY, srcPix->y); \
    1213    *maxX = PS_MAX (*maxX, srcPix->x); \
    13     *maxY = PS_MAX (*maxY, srcPix->y);
     14    *maxY = PS_MAX (*maxY, srcPix->y); \
     15    fprintf (stderr, "%4d,%4d - %4d,%4d\n", *minX, *minY, *maxX, *maxY);
    1416
    1517// we are warping from src to dest.  find the max overlapping pixels in the INPUT (src)
    16 // coordinate frame
     18// coordinate frame.  NOTE: these are in the parent pixel frame since the astrometric
     19// transformation refers to the parent frame
    1720bool pswarpMatchRange (int *minX, int *minY, int *maxX, int *maxY, pmReadout *dest, pmReadout *src) {
    1821
     
    3033    pmFPA *fpaDest = chipDest->parent;
    3134
    32     *minX = src->image->numCols;
    33     *minY = src->image->numRows;
    34     *maxX = 0;
    35     *maxY = 0;
     35    *minX = src->image->numCols + src->image->col0 - 1;
     36    *minY = src->image->numRows + src->image->row0 - 1;
     37    *maxX = src->image->col0;
     38    *maxY = src->image->row0;
     39    fprintf (stderr, "%4d,%4d - %4d,%4d\n", *minX, *minY, *maxX, *maxY);
    3640
    3741    // XXX save these as static for speed?
    3842    psPlane *srcPix = psPlaneAlloc();
     43    psPlane *srcFP  = psPlaneAlloc();
     44    psPlane *srcTP  = psPlaneAlloc();
     45
    3946    psPlane *destPix = psPlaneAlloc();
     47    psPlane *destFP  = psPlaneAlloc();
     48    psPlane *destTP  = psPlaneAlloc();
    4049
    41     psPlane *FP = psPlaneAlloc();
    42     psPlane *TP = psPlaneAlloc();
    4350    psSphere *sky = psSphereAlloc();
    4451
    45     destPix->x = 0;
    46     destPix->y = 0;
     52    destPix->x = dest->image->col0;
     53    destPix->y = dest->image->row0;
    4754    TEST_MINMAX;
    4855   
    49     destPix->x = dest->image->numCols;
    50     destPix->y = 0;
     56    destPix->x = dest->image->col0 + dest->image->numCols;
     57    destPix->y = dest->image->row0;
    5158    TEST_MINMAX;
    5259   
    53     destPix->x = dest->image->numCols;
    54     destPix->y = dest->image->numRows;
     60    destPix->x = dest->image->col0 + dest->image->numCols;
     61    destPix->y = dest->image->row0 + dest->image->numRows;
    5562    TEST_MINMAX;
    5663   
    57     destPix->x = 0;
    58     destPix->y = dest->image->numRows;
     64    destPix->x = dest->image->col0;
     65    destPix->y = dest->image->row0 + dest->image->numRows;
    5966    TEST_MINMAX;
    6067   
    61     destPix->x = 0.5*dest->image->numCols;
    62     destPix->y = 0.0;
     68    destPix->x = dest->image->col0 + 0.5*dest->image->numCols;
     69    destPix->y = dest->image->row0;
    6370    TEST_MINMAX;
    6471   
    65     destPix->x = 0.0;
    66     destPix->y = 0.5*dest->image->numRows;
     72    destPix->x = dest->image->col0;
     73    destPix->y = dest->image->row0 + 0.5*dest->image->numRows;
    6774    TEST_MINMAX;
    6875   
    69     destPix->x = 0.5*dest->image->numCols;
    70     destPix->y = dest->image->numRows;
     76    destPix->x = dest->image->col0 + 0.5*dest->image->numCols;
     77    destPix->y = dest->image->row0;
    7178    TEST_MINMAX;
    7279
    73     destPix->x = dest->image->numCols;
    74     destPix->y = 0.5*dest->image->numRows;
     80    destPix->x = dest->image->col0;
     81    destPix->y = dest->image->row0 + 0.5*dest->image->numRows;
    7582    TEST_MINMAX;
    7683
    77     *minX = PS_MAX (*minX, 0);
    78     *minY = PS_MAX (*minY, 0);
    79     *maxX = PS_MIN (*maxX, src->image->numCols);
    80     *maxY = PS_MIN (*maxY, src->image->numRows);
     84    *minX = PS_MAX (*minX, src->image->col0);
     85    *minY = PS_MAX (*minY, src->image->row0);
     86    *maxX = PS_MIN (*maxX, src->image->numCols + src->image->col0);
     87    *maxY = PS_MIN (*maxY, src->image->numRows + src->image->row0);
     88
     89    // demo forward and backward transformation
     90    srcPix->x = *minX;
     91    srcPix->y = *minY;
     92    psPlaneTransformApply(srcFP, chipSrc->toFPA, srcPix);
     93    psPlaneTransformApply (srcTP, fpaSrc->toTPA, srcFP);
     94    psDeproject (sky, srcTP, fpaSrc->toSky);
     95    psProject (destTP, sky, fpaDest->toSky);
     96    psPlaneTransformApply (destFP, fpaDest->fromTPA, destTP);
     97    psPlaneTransformApply (destPix, chipDest->fromFPA, destFP);
     98
     99    fprintf (stderr, "%f,%f -> %f,%f ", srcPix->x, srcPix->y, destPix->x, destPix->y);
     100
     101    psPlaneTransformApply(destFP, chipDest->toFPA, destPix);
     102    psPlaneTransformApply (destTP, fpaDest->toTPA, destFP);
     103    psDeproject (sky, destTP, fpaDest->toSky);
     104    psProject (srcTP, sky, fpaSrc->toSky);
     105    psPlaneTransformApply (srcFP, fpaSrc->fromTPA, srcTP);
     106    psPlaneTransformApply (srcPix, chipSrc->fromFPA, srcFP);
     107
     108    fprintf (stderr, "-> %f,%f ", srcPix->x, srcPix->y);
    81109
    82110    psFree (srcPix);
     111    psFree (srcFP);
     112    psFree (srcTP);
     113
    83114    psFree (destPix);
    84     psFree (FP);
    85     psFree (TP);
     115    psFree (destFP);
     116    psFree (destTP);
     117
    86118    psFree (sky);
    87119
Note: See TracChangeset for help on using the changeset viewer.