Changeset 12744 for trunk/pswarp/src/pswarpTransformReadout.c
- Timestamp:
- Apr 4, 2007, 12:54:56 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/pswarp/src/pswarpTransformReadout.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pswarp/src/pswarpTransformReadout.c
r10958 r12744 3 3 bool pswarpTransformReadout (pmReadout *output, pmReadout *input, pmConfig *config) { 4 4 5 // XXX this implementation currently ignores the use of the region 5 // XXX this implementation currently ignores the use of the region 6 6 psImage *region = NULL; 7 7 pmCell *cell = NULL; … … 13 13 int outNy = output->image->numRows; 14 14 15 psPlane *inPix = psPlaneAlloc(); // Coordinates on the input detector16 psPlane *outPix = psPlaneAlloc(); // Coordinates on the output detector15 psPlane *inPix = psPlaneAlloc(); // Coordinates on the input detector 16 psPlane *outPix = psPlaneAlloc(); // Coordinates on the output detector 17 17 18 psPlane *FP = psPlaneAlloc(); // Coordinates on the focal plane19 psPlane *TP = psPlaneAlloc(); // Coordinates on the tangent plane20 psSphere *sky = psSphereAlloc(); // Coordinates on the sky18 psPlane *FP = psPlaneAlloc(); // Coordinates on the focal plane 19 psPlane *TP = psPlaneAlloc(); // Coordinates on the tangent plane 20 psSphere *sky = psSphereAlloc(); // Coordinates on the sky 21 21 22 22 cell = input->parent; … … 31 31 psImage *inImage = input->image; 32 32 33 psImageInterpolateOptions *interp = psImageInterpolateOptionsAlloc(PS_INTERPOLATE_BILINEAR, inImage, 34 NULL, NULL, 0, NAN, NAN, 0, 0, 0.0); 35 33 36 // Iterate over the output image pixels 34 37 for (int y = 0; y < outNy; y++) { 35 for (int x = 0; x < outNx; x++) {36 // Only transform those pixels requested37 if (region && region->data.U8[y][x]) continue;38 for (int x = 0; x < outNx; x++) { 39 // Only transform those pixels requested 40 if (region && region->data.U8[y][x]) continue; 38 41 39 // XXX double check this 1/2 pixel offset40 outPix->x = (double)x + 0.5;41 outPix->y = (double)y + 0.5;42 // XXX double check this 1/2 pixel offset 43 outPix->x = (double)x + 0.5; 44 outPix->y = (double)y + 0.5; 42 45 43 psPlaneTransformApply(FP, chipOutput->toFPA, outPix); 44 psPlaneTransformApply (TP, fpaOutput->toTPA, FP); 45 psDeproject (sky, TP, fpaOutput->toSky); 46 47 psProject (TP, sky, fpaInput->toSky); 48 psPlaneTransformApply (FP, fpaInput->fromTPA, TP); 49 psPlaneTransformApply (inPix, chipInput->fromFPA, FP); 46 psPlaneTransformApply(FP, chipOutput->toFPA, outPix); 47 psPlaneTransformApply (TP, fpaOutput->toTPA, FP); 48 psDeproject (sky, TP, fpaOutput->toSky); 50 49 51 // XXX get interpolation method from the recipe 52 outData[y][x] = (psF32)psImagePixelInterpolate(inImage, inPix->x, inPix->y, NULL, 1, NAN, PS_INTERPOLATE_BILINEAR); 53 // outData[y][x] = (psF32)psImagePixelInterpolate(inImage, inPix->x, inPix->y, mask, 1, NAN, PS_INTERPOLATE_BILINEAR); 54 // modify zero and scale? 55 } 50 psProject (TP, sky, fpaInput->toSky); 51 psPlaneTransformApply (FP, fpaInput->fromTPA, TP); 52 psPlaneTransformApply (inPix, chipInput->fromFPA, FP); 53 54 // XXX get interpolation method from the recipe 55 double value; 56 if (!psImageInterpolate(&value, NULL, NULL, inPix->x, inPix->y, interp)) { 57 psError(PS_ERR_UNKNOWN, false, "Unable to interpolate image."); 58 psFree(interp); 59 psFree(inPix); 60 psFree(outPix); 61 psFree(FP); 62 psFree(TP); 63 psFree(sky); 64 return false; 65 } 66 67 outData[y][x] = value; 68 // modify zero and scale? 69 } 56 70 } 57 58 psFree (inPix);59 psFree (outPix);60 psFree (FP);61 psFree (TP);62 psFree (sky);71 psFree(interp); 72 psFree(inPix); 73 psFree(outPix); 74 psFree(FP); 75 psFree(TP); 76 psFree(sky); 63 77 64 78 return true; 65 79 } 66 67 # if (0)68 if (error) {69 // Error is actually the variance70 outError->data.F32[y][x] = (psF32)p_psImageErrorInterpolateBILINEAR_F32(error,71 detector->x,72 detector->y,73 mask, 1, NAN);74 }75 if (error) {76 outError->data.F32[y][x] = outError->data.F32[y][x] / SQUARE(scale);77 }78 # endif
Note:
See TracChangeset
for help on using the changeset viewer.
