Changeset 23996 for trunk/ppSkycell/src/ppSkycellLoop.c
- Timestamp:
- Apr 28, 2009, 6:49:00 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ppSkycell/src/ppSkycellLoop.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSkycell/src/ppSkycellLoop.c
r23992 r23996 10 10 11 11 #define BUFFER 16 // Size of buffer for projections 12 13 // List of input files14 static const char *inFiles[] = { "PPSKYCELL.IMAGE", "PPSKYCELL.MASK", NULL };15 16 // List of output files17 //static const char *outFiles[] = { "PPSKYCELL.JPEG1", "PPSKYCELL.JPEG2", NULL };18 19 12 20 13 static void regionMinMax(psRegion *base,// Base region; modified … … 41 34 fromCoords->y = (Y); \ 42 35 psPlaneTransformApply(toCoords, wcs->trans, fromCoords); \ 36 toCoords->x /= wcs->cdelt1; \ 37 toCoords->y /= wcs->cdelt2; \ 43 38 toCoords->x += wcs->crpix1; \ 44 39 toCoords->y += wcs->crpix2; \ … … 137 132 138 133 for (int i = 0; i < data->numInputs; i++) { 139 pmFPAfile *file = pmFPAfileSelectSingle(data->config->files, "PPSKYCELL.I NPUT", i); // File to examine134 pmFPAfile *file = pmFPAfileSelectSingle(data->config->files, "PPSKYCELL.IMAGE", i); // File to examine 140 135 // Header in the FPA should have been read as a part of defining the file... 141 136 #if 0 … … 157 152 158 153 psRegion *region = imageRegions->data[i] = skycellRegion(wcs, numCols, numRows); // Region of image 154 psTrace("ppSkycell", 5, "Image region %d is: [%.0f:%.0f,%.0f:%.0f]\n", 155 i, region->x0, region->x1, region->y0, region->y1); 159 156 160 157 bool found = false; // Found a projection? 161 158 for (int j = 0; j < numProj && !found; j++) { 162 if (wcs->crval1 == crval1->data.F64[j] && 163 wcs->crval2 == crval2->data.F64[j] && 164 wcs->cdelt1 == cdelt1->data.F64[j] && 165 wcs->cdelt2 == cdelt1->data.F64[j]) { 159 if (wcs->crval1 == crval1->data.F64[j] && wcs->crval2 == crval2->data.F64[j] && 160 wcs->cdelt1 == cdelt1->data.F64[j] && wcs->cdelt2 == cdelt1->data.F64[j]) { 166 161 regionMinMax(projRegions->data[j], region); 167 162 target->data.S32[i] = j; 168 skycellRegion(wcs, numCols, numRows);169 163 found = true; 164 psTrace("ppSkycell", 3, "Image %d uses projection %d\n", i, j); 170 165 } 171 166 } … … 176 171 psVectorAppend(cdelt1, wcs->cdelt1); 177 172 psVectorAppend(cdelt2, wcs->cdelt2); 178 psArrayAdd(projRegions, projRegions->n, region); 173 psRegion *projRegion = psRegionAlloc(region->x0, region->x1, region->y0, region->y1); 174 psArrayAdd(projRegions, projRegions->n, projRegion); 175 psFree(projRegion); 179 176 target->data.S32[i] = numProj; 177 psTrace("ppSkycell", 3, "Image %d uses new projection\n", i); 180 178 181 179 numProj++; … … 187 185 for (int i = 0; i < numProj; i++) { 188 186 psRegion *projRegion = projRegions->data[i]; // Region for skycell projection 189 int xSize = projRegion->x1 - projRegion->x0 ; // Size of unbinned image190 int ySize = projRegion->y1 - projRegion->y0 ; // Size of unbinned image187 int xSize = projRegion->x1 - projRegion->x0 + 1; // Size of unbinned image 188 int ySize = projRegion->y1 - projRegion->y0 + 1; // Size of unbinned image 191 189 // Size of binned image 1 192 int numCols1 = xSize / (float)data->bin1 + 0.5, numRows1 = ySize / (float)data->bin1 + 0.5;190 int numCols1 = xSize / (float)data->bin1 + 1.5, numRows1 = ySize / (float)data->bin1 + 1.5; 193 191 // Size of binned image 2 194 int numCols2 = numCols1 / (float)data->bin2 + 0.5, numRows2 = numRows2 / (float)data->bin1 + 0.5;192 int numCols2 = numCols1 / (float)data->bin2 + 1.5, numRows2 = numRows1 / (float)data->bin2 + 1.5; 195 193 196 194 psImage *image1 = psImageAlloc(numCols1, numRows1, PS_TYPE_F32); // Binned image … … 204 202 } 205 203 206 fileActivationSingle(data->config, inFiles, true, j); 204 pmFPAfileActivateSingle(data->config->files, true, "PPSKYCELL.IMAGE", j); 205 if (data->masksName) { 206 pmFPAfileActivateSingle(data->config->files, true, "PPSKYCELL.MASK", j); 207 } 208 207 209 pmFPAview *view = filesIterateDown(data->config); // View to readout 208 210 if (!view) { … … 230 232 psRegion *imageRegion = imageRegions->data[j]; // Region for image 231 233 // Offsets for image on skycell 232 int xOffset1 = (imageRegion->x0 - projRegion->x0) / (float)data->bin1 + 0.5;233 int yOffset1 = (imageRegion->y0 - projRegion->y0) / (float)data->bin1 + 0.5;234 int xOffset2 = xOffset1 / (float)data->bin2 + 0.5, yOffset2 = yOffset1 / (float)data->bin2 + 0.5;234 int xOffset1 = (imageRegion->x0 - projRegion->x0) / (float)data->bin1; 235 int yOffset1 = (imageRegion->y0 - projRegion->y0) / (float)data->bin1; 236 int xOffset2 = xOffset1 / (float)data->bin2, yOffset2 = yOffset1 / (float)data->bin2; 235 237 236 238 // XXX Completely neglecting rotations … … 242 244 psFree(bin2RO); 243 245 filesIterateUp(data->config); 246 psFree(file->fpa); 247 file->fpa = NULL; 248 pmFPAfileActivate(data->config->files, false, NULL); 249 250 psTrace("ppSkycell", 10, "Blah blah blah\n"); 244 251 } 245 252
Note:
See TracChangeset
for help on using the changeset viewer.
