Changeset 12523 for trunk/pswarp/src/pswarpMatchRange.c
- Timestamp:
- Mar 21, 2007, 12:09:22 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/pswarp/src/pswarpMatchRange.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pswarp/src/pswarpMatchRange.c
r10958 r12523 2 2 3 3 # 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); \ 10 11 *minX = PS_MIN (*minX, srcPix->x); \ 11 12 *minY = PS_MIN (*minY, srcPix->y); \ 12 13 *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); 14 16 15 17 // 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 17 20 bool pswarpMatchRange (int *minX, int *minY, int *maxX, int *maxY, pmReadout *dest, pmReadout *src) { 18 21 … … 30 33 pmFPA *fpaDest = chipDest->parent; 31 34 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); 36 40 37 41 // XXX save these as static for speed? 38 42 psPlane *srcPix = psPlaneAlloc(); 43 psPlane *srcFP = psPlaneAlloc(); 44 psPlane *srcTP = psPlaneAlloc(); 45 39 46 psPlane *destPix = psPlaneAlloc(); 47 psPlane *destFP = psPlaneAlloc(); 48 psPlane *destTP = psPlaneAlloc(); 40 49 41 psPlane *FP = psPlaneAlloc();42 psPlane *TP = psPlaneAlloc();43 50 psSphere *sky = psSphereAlloc(); 44 51 45 destPix->x = 0;46 destPix->y = 0;52 destPix->x = dest->image->col0; 53 destPix->y = dest->image->row0; 47 54 TEST_MINMAX; 48 55 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; 51 58 TEST_MINMAX; 52 59 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; 55 62 TEST_MINMAX; 56 63 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; 59 66 TEST_MINMAX; 60 67 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; 63 70 TEST_MINMAX; 64 71 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; 67 74 TEST_MINMAX; 68 75 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; 71 78 TEST_MINMAX; 72 79 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; 75 82 TEST_MINMAX; 76 83 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); 81 109 82 110 psFree (srcPix); 111 psFree (srcFP); 112 psFree (srcTP); 113 83 114 psFree (destPix); 84 psFree (FP); 85 psFree (TP); 115 psFree (destFP); 116 psFree (destTP); 117 86 118 psFree (sky); 87 119
Note:
See TracChangeset
for help on using the changeset viewer.
