Changeset 12528 for trunk/pswarp/src/pswarpTransformReadout_Opt.c
- Timestamp:
- Mar 21, 2007, 2:16:47 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/pswarp/src/pswarpTransformReadout_Opt.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pswarp/src/pswarpTransformReadout_Opt.c
r12526 r12528 1 1 # include "pswarp.h" 2 psImageInterpolateMode psImageInterpolateModeFromString (char *name); 2 3 3 4 // NOTE: in this function, the coordinates are transformed from the OUTPUT to the INPUT 4 5 bool pswarpTransformReadout_Opt (pmReadout *output, pmReadout *input, pmConfig *config) { 5 6 7 bool status; 6 8 int minX, minY, maxX, maxY; 7 9 int gridXo, gridX, gridY, nextGridXo, nextGridX, nextGridY; 8 10 pswarpMap *map = NULL; 11 psImageInterpolateMode interpolationMode = PS_INTERPOLATE_NONE; 9 12 10 13 // XXX this implementation currently ignores the use of the region 11 14 psImage *region = NULL; 12 15 16 psTimerStart ("warp"); 17 13 18 // select the current recipe 14 // psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE); 19 psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSWARP_RECIPE); 20 if (!recipe) { 21 psError(PSWARP_ERR_CONFIG, true, "Can't find PSWARP recipe!\n"); 22 return false; 23 } 24 25 int nGridX = psMetadataLookupS32 (&status, recipe, "GRID.NX"); 26 if (!status) nGridX = 128; 27 int nGridY = psMetadataLookupS32 (&status, recipe, "GRID.NY"); 28 if (!status) nGridY = 128; 29 30 char *name = psMetadataLookupStr (&status, recipe, "INTERPOLATION.MODE"); 31 if (!name) { 32 interpolationMode = PS_INTERPOLATE_BILINEAR; 33 psLogMsg ("pswarp", 3, "defaulting to bilinear interpolation\n"); 34 } else { 35 interpolationMode = psImageInterpolateModeFromString (name); 36 if (interpolationMode == PS_INTERPOLATE_NONE) { 37 interpolationMode = PS_INTERPOLATE_BILINEAR; 38 psLogMsg ("pswarp", 3, "unknown interpolation mode %s, defaulting to bilinear interpolation\n", name); 39 } 40 } 15 41 16 42 psPlane *inPix = psPlaneAlloc(); // Coordinates on the input detector … … 33 59 // pswarpMapGridFromImage builds a set of locally-linear maps which convert the 34 60 // output coordinates to input coordinates 35 pswarpMapGrid *grid = pswarpMapGridFromImage (input, output, 128, 128);61 pswarpMapGrid *grid = pswarpMapGridFromImage (input, output, nGridX, nGridY); 36 62 37 63 // XXX need to modify the grid based on this result and force the maxError < XXX … … 81 107 if (inPix->y - inRow0 >= inImage->numRows) continue; 82 108 83 // XXX get interpolation method from the recipe84 109 // XXX include mask 85 110 // XXX apply scale and offset? 86 111 // psImagePixelInterpolate determines the value at pixel coordinate (x,y) in child coordinates 87 outData[y-outRow0][x-outCol0] = (psF32)psImagePixelInterpolate(inImage, inPix->x - inCol0, inPix->y - inRow0, NULL, 1, NAN, PS_INTERPOLATE_BILINEAR);112 outData[y-outRow0][x-outCol0] = (psF32)psImagePixelInterpolate(inImage, inPix->x - inCol0, inPix->y - inRow0, NULL, 1, NAN, interpolationMode); 88 113 } 89 114 } … … 91 116 psFree (inPix); 92 117 psFree (grid); 118 psLogMsg ("pswarp", 3, "warping analysis: %f sec\n", psTimerMark ("warp")); 119 93 120 return true; 94 121 }
Note:
See TracChangeset
for help on using the changeset viewer.
