Changeset 20572 for trunk/magic/remove/src
- Timestamp:
- Nov 6, 2008, 6:12:10 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/magic/remove/src/warpedpixels.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/magic/remove/src/warpedpixels.c
r20520 r20572 1 1 #include "streaks.h" 2 2 #include "pmAstrometryWCS.h" 3 4 // #define DEBUG_PRINT 1 3 5 4 6 static void addTouchedPixels(streakFiles *sf, psString fileName); … … 31 33 } 32 34 33 psFits *fits = psFitsOpen("warpedpixels.fits", "w"); 34 psFitsWriteImage(fits, NULL, sf->warpedPixels, 0, NULL); 35 psFitsClose(fits); 36 37 exit (0); 35 bool writeTouchedPixels = false; 36 if (writeTouchedPixels) { 37 // write out the warped pixels 38 psMetadata * header = psMetadataAlloc(); 39 pmAstromWriteWCS(header, sf->inAstrom->fpa, sf->chip, 0.001); 40 psFits *fits = psFitsOpen("warpedpixels.fits", "w"); 41 42 psFitsWriteImage(fits, header, sf->warpedPixels, 0, NULL); 43 psFitsClose(fits); 44 } 38 45 } 39 46 … … 62 69 63 70 /* now set up our wrapper to the chip astrometry to apply to the whole chip */ 64 sf->astrom = streakSetAstrometry(sf->astrom, sf-> inAstrom->fpa, sf->chip, false, NULL,71 sf->astrom = streakSetAstrometry(sf->astrom, sf->stage, sf->inAstrom->fpa, sf->chip, false, NULL, 65 72 sf->warpedPixels->numCols, sf->warpedPixels->numRows); 66 73 … … 108 115 type = "2"; 109 116 } 117 #ifdef DEBUG_PRINT 110 118 printf("\nSKYCELL %s Type: %s\n", fileName, type); 111 119 for (int i=0; i<4; i++) { 112 120 printf("%f %f\n", pt[i].x, pt[i].y); 113 121 } 114 122 #endif 115 123 // Now set the touched pixels 116 124 int ymin = fmax(0, pt[1].y); 117 125 int ymax = fmin(pt[3].y, sf->warpedPixels->numRows); 126 #ifdef DEBUG_PRINT 118 127 printf("\nymin: %d ymax: %d\n", ymin, ymax); 128 #endif 119 129 for (int y = ymin ; y < ymax; y++) { 120 130 int xleft = xLeft(pt, y); … … 125 135 } 126 136 if (xleft > sf->warpedPixels->numCols) { 127 xleft = sf->warpedPixels->numCols - 1;137 continue; 128 138 } 129 139 if (xright < 0) { 130 xright = 0;140 continue; 131 141 } 132 142 if (xright >= sf->warpedPixels->numCols) { 133 143 xright = sf->warpedPixels->numCols - 1; 134 144 } 145 #ifdef DEBUG_PRINT 135 146 printf(" y: %d xleft: %d xright: %d\n", y, xleft, xright); 136 137 psU8 *scanline = sf->warpedPixels->data.U8[y]; 138 139 for (int x = xleft ; x <= xright; x++) { 140 scanline[x] = 1; 147 #endif 148 149 psU8 *rowPixels = sf->warpedPixels->data.U8[y]; 150 151 int n = xright - xleft + 1; 152 if (n > 0) { 153 memset(&rowPixels[xleft], 255, n); 141 154 } 142 155 }
Note:
See TracChangeset
for help on using the changeset viewer.
