Changeset 34471
- Timestamp:
- Sep 25, 2012, 6:08:46 PM (14 years ago)
- Location:
- branches/czw_branch/20120906
- Files:
-
- 6 edited
-
psLib/src/imageops/psImageInterpolate.c (modified) (3 diffs)
-
pswarp/src/pswarp.h (modified) (1 diff)
-
pswarp/src/pswarpLoop.c (modified) (2 diffs)
-
pswarp/src/pswarpMapGrid.c (modified) (1 diff)
-
pswarp/src/pswarpTransformReadout.c (modified) (2 diffs)
-
pswarp/src/pswarpTransformTile.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20120906/psLib/src/imageops/psImageInterpolate.c
r34470 r34471 951 951 if (xl < 0) { xl = 0; } 952 952 if (xl >= image->numCols) {xl = image->numCols - 1; } 953 //{ *imageValue = NAN; return PS_INTERPOLATE_STATUS_GOOD; }954 953 xh = xl + 1; 955 954 if (xh >= image->numCols) {xh = image->numCols - 1; } 956 //{ *imageValue = NAN; return PS_INTERPOLATE_STATUS_GOOD; } 957 // 955 958 956 yl = floor(y); 959 957 if (yl < 0) { yl = 0; } 960 958 if (yl >= image->numRows) {yl = image->numRows - 1; } 961 //{ *imageValue = NAN; return PS_INTERPOLATE_STATUS_GOOD; }962 //963 959 yh = yl + 1; 964 960 if (yh >= image->numRows) {yh = image->numRows - 1; } 965 //{ *imageValue = NAN; return PS_INTERPOLATE_STATUS_GOOD; } 966 // 961 967 962 if (imageValue && image) { 968 963 if (image->data.F32[yl][xl] == image->data.F32[yl][xh]) { … … 989 984 } 990 985 } 986 #if (0) 991 987 if (*imageValue == 0.0) { 992 988 fprintf(stderr,"IJK: Zero!: %g %g [%d %d %d %d] %g %g (%g %g %g %g)\n", … … 995 991 ); 996 992 } 993 #endif 997 994 return PS_INTERPOLATE_STATUS_GOOD; 998 995 } -
branches/czw_branch/20120906/pswarp/src/pswarp.h
r34470 r34471 94 94 95 95 pswarpMapGrid *pswarpMapGridFromImage (pmReadout *dest, pmReadout *src, int nXpix, int nYpix); 96 pswarpMapGrid *pswarpMapGridFromImageForBackground (pmReadout *dest, pmReadout *src, int nXpix, int nYpix);97 96 bool pswarpMapGridSetGrid (pswarpMapGrid *grid, int ix, int iy, int *gridX, int *gridY); 98 97 bool pswarpMapGridCoordRange (pswarpMapGrid *grid, int gridX, int gridY, psPlane *min, psPlane *max); -
branches/czw_branch/20120906/pswarp/src/pswarpLoop.c
r34470 r34471 159 159 } 160 160 } 161 pmAstromWCS *WCSF = pmAstromWCSfromHeader(phu->header); 162 163 fprintf(stderr,"WCSFI: %g %g : %g %g : %g %g : %g %g %g %g : %g %g\n", 164 WCSF->crval1,WCSF->crval2, 165 WCSF->crpix1,WCSF->crpix2, 166 WCSF->cdelt1,WCSF->cdelt2, 167 WCSF->trans->x->coeff[1][0], 168 WCSF->trans->x->coeff[0][1], 169 WCSF->trans->y->coeff[1][0], 170 WCSF->trans->y->coeff[0][1], 171 -1.0,-1.0); 172 psFree(WCSF); 161 173 162 psList *cells = psListAlloc(NULL); // List of cells, for concepts averaging 174 163 … … 208 197 } 209 198 } 210 pmAstromWCS *WCSF = pmAstromWCSfromHeader(hdu->header);211 212 fprintf(stderr,"WCSFIB: %g %g : %g %g : %g %g : %g %g %g %g : %g %g\n",213 WCSF->crval1,WCSF->crval2,214 WCSF->crpix1,WCSF->crpix2,215 WCSF->cdelt1,WCSF->cdelt2,216 WCSF->trans->x->coeff[1][0],217 WCSF->trans->x->coeff[0][1],218 WCSF->trans->y->coeff[1][0],219 WCSF->trans->y->coeff[0][1],220 -1.0,-1.0);221 psFree(WCSF);222 223 199 224 200 pmCell *cell; -
branches/czw_branch/20120906/pswarp/src/pswarpMapGrid.c
r34470 r34471 52 52 return grid; 53 53 } 54 /**55 * pswarpMapGridFromImageForBackground builds a set (a grid) of locally-linear maps which convert the source56 * coordinates (src) to destination coordinates (dest). we construct a grid with superpixel57 * spacing of nXpix, nYpix. The transformation for each grid cell is valid for the superpixel.58 * The grid over-fills the source image so every source image pixel is guaranteed to have a map.59 */60 pswarpMapGrid *pswarpMapGridFromImageForBackground (pmReadout *dest, pmReadout *src, int nXpix, int nYpix) {61 62 int i, ni;63 int j, nj;64 65 // start counting from the center of the superpixels66 double xMin = 0.5*nXpix;67 double yMin = 0.5*nYpix;68 69 // the map is defined for coordinates in the image parent frame.70 int Nx = src->image->numCols + src->image->col0;71 int Ny = src->image->numRows + src->image->row0;72 73 // always allocate an extra superpixel to handle spillover74 int nXpts = (int)(Nx / nXpix) + 1;75 int nYpts = (int)(Ny / nYpix) + 1;76 77 // create the grid of maps78 pswarpMapGrid *grid = pswarpMapGridAlloc (nXpts, nYpts);79 80 // measure the map for the center of each superpixel81 for (ni = 0, i = xMin; ni < nXpts; i += nXpix, ni++) {82 for (nj = 0, j = yMin; nj < nYpts; j += nYpix, nj++) {83 pswarpMapSetLocalModel (grid->maps[ni][nj], dest, src, i, j);84 /* grid->maps[ni][nj]->Xo += (13.0 * 400.0 - 4846.0) / 2.0; */85 /* grid->maps[ni][nj]->Yo += (13.0 * 400.0 - 4868.0) / 2.0; */86 }87 }88 89 grid->nXpix = nXpix;90 grid->nYpix = nYpix;91 grid->xMin = xMin;92 grid->yMin = yMin;93 return grid;94 }95 54 96 55 /** -
branches/czw_branch/20120906/pswarp/src/pswarpTransformReadout.c
r34470 r34471 60 60 // pswarpMapGridFromImage builds a set of locally-linear maps which convert the 61 61 // output coordinates to input coordinates 62 pswarpMapGrid *grid; 63 if (psMetadataLookupBool(NULL,config->arguments,"BACKGROUND_WARPING")) { 64 grid = pswarpMapGridFromImageForBackground(input, output, nGridX, nGridY); 65 } 66 else { 67 grid = pswarpMapGridFromImage(input, output, nGridX, nGridY); 68 } 62 pswarpMapGrid *grid = pswarpMapGridFromImage(input, output, nGridX, nGridY); 63 // if (psMetadataLookupBool(NULL,config->arguments,"BACKGROUND_WARPING")) { 64 69 65 // XXX optionally modify the grid based on this result and force the maxError < XXX 70 66 double maxError = pswarpMapGridMaxError(grid); // Maximum (positional) error from using grid … … 177 173 } else { 178 174 pswarpTransformTileArgs *args = job->args->data[0]; 179 // fprintf (stderr, "finished job %d,%d, Nargs: %ld (%d %d %d %d) (%d %d %d %d)\n", args->gridX, args->gridY, job->args->n,180 // xMin,xMax,yMin,yMax,args->xMin,args->xMax,args->yMin,args->yMax);181 175 goodPixels += args->goodPixels; 182 176 xMin = PS_MIN(args->xMin, xMin); -
branches/czw_branch/20120906/pswarp/src/pswarpTransformTile.c
r34470 r34471 83 83 // Iterate over the output image pixels (parent frame) 84 84 long goodPixels = 0; ///< Number of input pixels landing on the output image 85 psTrace("pswarp",3,"Size: %d %d\n",xMax,yMax); 85 86 86 for (int y = yMin; y < yMax; y++) { 87 87 for (int x = xMin; x < xMax; x++) { … … 95 95 pswarpMapApply(&xIn, &yIn, map, x + 0.5, y + 0.5); 96 96 97 // This needs to use a more reliable method to do this offset and limiting 97 98 if (args->interp->mode == 8) { 98 xIn += 177.0 / 400.0; 99 yIn += 166.0 / 400.0; 99 double xOffset = 177.0 / 400.0; // (modelsize * modelbinning - xsize) / 2.0 100 double yOffset = 166.0 / 400.0; // (modelsize * modelbinning - ysize) / 2.0 101 xIn += xOffset; 102 yIn += yOffset; 100 103 101 if ((xIn > inNumCols - 177.0/ 400.0)|| 102 (yIn > inNumRows - 166.0/ 400.0)|| 103 (xIn < 177.0/ 400.0)|| 104 (yIn < 166.0/ 400.0) 105 106 ) { 107 fprintf(stderr,"\n"); 104 if ((xIn > inNumCols - xOffset)|| 105 (yIn > inNumRows - yOffset)|| 106 (xIn < xOffset)|| 107 (yIn < yOffset)) { 108 108 continue; 109 109 } … … 124 124 int xOut = x - outCol0, yOut = y - outRow0; ///< Position on output image 125 125 126 if (((xOut % 500) == 0)&&((yOut % 500) == 0)) {127 fprintf(stderr,"%d %d %g %g %d %d (%d %d %d %d) %g %g %g\n",128 x,y,xIn,yIn,xOut,yOut,xMin,xMax,yMin,yMax,imageValue,129 (4846 - 400 * (12)) / 2.0,130 (4868 - 400 * (12)) / 2.0131 132 );133 }134 135 /* if ((xIn >= args->interp->image->numCols - 1)|| */136 /* (yIn >= args->interp->image->numRows - 1)) { */137 /* imageValue = NAN; */138 /* } */139 126 if (outImageData) { 140 127 outImageData[yOut][xOut] = imageValue * jacobian;
Note:
See TracChangeset
for help on using the changeset viewer.
