- Timestamp:
- Oct 22, 2010, 11:39:15 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100823/psModules/src/camera/pmFPA_JPEG.c
r29514 r29522 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 bool haveBar = psMetadataLookupBool(&status, options, "SCALE.BAR"); // Mode for scaling image198 if (!status) {199 haveBar = false;200 }201 202 float min = 0, max = 0; // Minimum and maximum for stretch203 204 203 if (!strcasecmp(mode, "RANGE")) { 205 min = mean + fmin*delta;206 max = mean + fmax*delta;204 jpegOptions->min = mean + fmin*delta; 205 jpegOptions->max = mean + fmax*delta; 207 206 } else if (!strcasecmp(mode, "FRACTION")) { 208 min = fmin*mean;209 max = fmax*mean;207 jpegOptions->min = fmin*mean; 208 jpegOptions->max = fmax*mean; 210 209 } else if (!strcasecmp(mode, "VALUE")) { 211 min = fmin;212 max = fmax;210 jpegOptions->min = fmin; 211 jpegOptions->max = fmax; 213 212 } else { 214 213 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Unrecognised scaling mode: %s", mode); 215 214 return false; 216 215 } 217 218 if (!isfinite(min) || !isfinite(max)) { 216 if (!isfinite(jpegOptions->min) || !isfinite(jpegOptions->max)) { 219 217 psLogMsg("psModules.jpeg", PS_LOG_WARN, 220 218 "The stretch parameters are not both finite --- writing blank jpeg"); 221 min = 0; 222 max = 1; 223 } 224 225 psImageJpegOptions *jpegOptions = psImageJpegOptionsAlloc(); 226 psImageJpegColormapSet(jpegOptions, colormapName); 227 228 // default options are: no flip in X or Y, scale bar on bottom 229 jpegOptions->min = min; 230 jpegOptions->max = max; 231 232 if (haveBar) { 233 jpegOptions->showScale = PS_JPEG_SHOWSCALE_BOTTOM; 234 } else { 235 jpegOptions->showScale = PS_JPEG_SHOWSCALE_NONE; 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 } 236 239 } 237 240
Note:
See TracChangeset
for help on using the changeset viewer.
