Changeset 7204 for trunk/psModules/src/camera/pmFPARead.c
- Timestamp:
- May 24, 2006, 6:06:28 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmFPARead.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPARead.c
r7186 r7204 118 118 } 119 119 120 psTrace(__func__, 5, "Reading section [%.0f:%.0f,%.0f:%.0f]\n", 121 toRead.x0, toRead.x1, toRead.y0, toRead.y1); 120 122 psImage *image = psFitsReadImage(fits, toRead, z); // Desired pixels 123 psTrace(__func__, 7, "Image is %dx%d\n", image->numCols, image->numRows); 121 124 122 125 // XXX: We only support F32 for now … … 129 132 if (resize) { 130 133 // For some reason, the region of interest is smaller than the number of pixels we want. 134 psTrace(__func__, 5, "Resizing image to %.0fx%.0f\n", 135 fullSize.x1 - fullSize.x0, fullSize.y1 - fullSize.y0); 131 136 psImage *temp = psImageAlloc(fullSize.x1 - fullSize.x0, fullSize.y1 - fullSize.y0, image->type.type); 132 137 psImageInit(temp, bad); … … 232 237 } 233 238 239 int maxSize; // Number of cols,rows in image 240 if (readdir == 1) { 241 maxSize = PS_MIN(naxis2, trimsec->y1); 242 } else { 243 maxSize = PS_MIN(naxis1, trimsec->x1); 244 } 245 234 246 // Read the FITS image 235 247 int offset = 0; // The offset from the start of the image to where we are now … … 245 257 } 246 258 } 247 if ((readdir == 1 && offset >= naxis2) || (readdir == 2 && offset > naxis1)) { 248 // We've read everything there is 249 return false; 250 } 251 int upper = offset + numScans; // The upper limit for the pixel read 252 if (readdir == 1 && upper > naxis2) { 253 upper = naxis2; 254 } else if (readdir == 2 && upper > naxis1) { 255 upper = naxis1; 256 } 257 258 // Blow away existing data 259 260 // Blow away existing data. 261 // Do this before returning, so that we're not returning data from a previous read 259 262 psFree(readout->image); 263 readout->image = NULL; 260 264 while (readout->bias->n > 0) { 261 265 psListRemove(readout->bias, PS_LIST_HEAD); 262 266 } 267 268 if (offset >= maxSize) { 269 // We've read everything there is 270 psTrace(__func__, 7, "Read everything.\n"); 271 psFree(readout->image); 272 return false; 273 } 274 int upper = PS_MIN(offset + numScans, maxSize); // The upper limit for the pixel read 275 psTrace(__func__, 7, "offset=%d, upper = %d, image is %dx%d, trimsec [%.0f:%.0f,%.0f:%.0f]\n", 276 offset, upper, naxis1, naxis2, trimsec->x0, trimsec->x1, trimsec->y0, trimsec->y1); 263 277 264 278 // Get the new the trim section
Note:
See TracChangeset
for help on using the changeset viewer.
