Changeset 29544
- Timestamp:
- Oct 25, 2010, 2:46:07 PM (16 years ago)
- Location:
- trunk/psModules/src/camera
- Files:
-
- 3 edited
-
pmFPAMaskWeight.c (modified) (1 diff)
-
pmFPAMaskWeight.h (modified) (1 diff)
-
pmFPA_JPEG.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAMaskWeight.c
r26893 r29544 476 476 } 477 477 478 479 478 // find any pixels which are not already masked (with maskTest) which are not valid and raise maskSet bits 479 bool pmReadoutMaskInvalid (const pmReadout *readout, psImageMaskType maskTest, psImageMaskType maskSet) { 480 481 if (!readout) return true; 482 483 psImage *image = readout->image; 484 psImage *mask = readout->mask; 485 psImage *variance = readout->variance; 486 for (int y = 0; y < image->numRows; y++) { 487 for (int x = 0; x < image->numCols; x++) { 488 if (mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskTest) continue; 489 bool valid = false; 490 valid = isfinite(image->data.F32[y][x]); 491 if (valid && variance) { 492 valid &= isfinite(variance->data.F32[y][x]); 493 } 494 if (valid) continue; 495 mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= maskSet; 496 } 497 } 498 499 return true; 500 } 501 502 // raise maskVal for any invalid pixels 480 503 bool pmReadoutMaskNonfinite(pmReadout *readout, psImageMaskType maskVal) 481 504 { -
trunk/psModules/src/camera/pmFPAMaskWeight.h
r26076 r29544 99 99 ); 100 100 101 // find any pixels which are not already masked (with maskTest) which are not valid and raise maskSet bits 102 bool pmReadoutMaskInvalid (const pmReadout *readout, psImageMaskType maskTest, psImageMaskType maskSet); 103 101 104 /// Apply a mask to the image and variance map 102 105 /// -
trunk/psModules/src/camera/pmFPA_JPEG.c
r23259 r29544 179 179 psFree(stats); 180 180 181 // default options are: no flip in X or Y, scale bar on bottom 182 psImageJpegOptions *jpegOptions = psImageJpegOptionsAlloc(); 183 181 184 char *colormapName = psMetadataLookupStr(NULL, options, "COLORMAP"); // Name of colour map 182 185 if (!colormapName) { 183 186 colormapName = "-greyscale"; 184 187 } 188 psImageJpegColormapSet(jpegOptions, colormapName); 189 190 // set up the scale options 185 191 char *mode = psMetadataLookupStr(NULL, options, "SCALE.MODE"); // Mode for scaling image 186 192 if (!mode) { … … 195 201 fmax = +6.0; 196 202 } 197 198 float min = 0, max = 0; // Minimum and maximum for stretch199 200 203 if (!strcasecmp(mode, "RANGE")) { 201 min = mean + fmin*delta;202 max = mean + fmax*delta;204 jpegOptions->min = mean + fmin*delta; 205 jpegOptions->max = mean + fmax*delta; 203 206 } else if (!strcasecmp(mode, "FRACTION")) { 204 min = fmin*mean;205 max = fmax*mean;207 jpegOptions->min = fmin*mean; 208 jpegOptions->max = fmax*mean; 206 209 } else if (!strcasecmp(mode, "VALUE")) { 207 min = fmin;208 max = fmax;210 jpegOptions->min = fmin; 211 jpegOptions->max = fmax; 209 212 } else { 210 213 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Unrecognised scaling mode: %s", mode); 211 214 return false; 212 215 } 213 214 if (!isfinite(min) || !isfinite(max)) { 216 if (!isfinite(jpegOptions->min) || !isfinite(jpegOptions->max)) { 215 217 psLogMsg("psModules.jpeg", PS_LOG_WARN, 216 218 "The stretch parameters are not both finite --- writing blank jpeg"); 217 min = 0; 218 max = 1; 219 } 220 221 psImageJpegColormap *map = psImageJpegColormapSet(NULL, colormapName); 222 if (!map) { 223 map = psImageJpegColormapSet(NULL, "-greyscale"); 224 } 225 226 if (!psImageJpeg(map, readout->image, file->filename, min, max)) { 219 jpegOptions->min = 0; 220 jpegOptions->max = 1; 221 } 222 223 jpegOptions->showScale = PS_JPEG_SHOWSCALE_NONE; 224 jpegOptions->xFlip = false; 225 jpegOptions->yFlip = false; 226 227 char *userOptions = psMetadataLookupStr(&status, options, "OPTIONS"); // Mode for scaling image 228 if (userOptions) { 229 // just use strstr for now 230 if (strcasestr(userOptions, "+SB")) { 231 jpegOptions->showScale = PS_JPEG_SHOWSCALE_BOTTOM; 232 } 233 if (strcasestr(userOptions, "-X")) { 234 jpegOptions->xFlip = true; 235 } 236 if (strcasestr(userOptions, "-Y")) { 237 jpegOptions->yFlip = true; 238 } 239 } 240 241 // NOTE: we can overlay the location of the stars from the readout by passing a bDrawBuffer to this function 242 243 if (!psImageJpeg(jpegOptions, readout->image, NULL, file->filename)) { 227 244 psError(PS_ERR_UNKNOWN, false, "Unable to write JPEG image"); 228 psFree( map);229 return false; 230 } 231 232 psFree( map);233 return true; 234 } 245 psFree(jpegOptions); 246 return false; 247 } 248 249 psFree(jpegOptions); 250 return true; 251 }
Note:
See TracChangeset
for help on using the changeset viewer.
