Changeset 38267
- Timestamp:
- May 13, 2015, 11:11:15 AM (11 years ago)
- File:
-
- 1 edited
-
trunk/ppImage/src/ppImageSquashNANs.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/ppImageSquashNANs.c
r38233 r38267 4 4 5 5 #include "ppImage.h" 6 7 # define LO_16BIT -32768 8 # define HI_16BIT 32768 9 # define MX_16BIT 65536 10 11 bool ppImageSquashNANsImage (psImage *image, float minValue, float maxValue, float offset); 6 12 7 13 bool ppImageSquashNANs(pmConfig *config, ppImageOptions *options, pmFPAview *view) … … 18 24 19 25 psImage *image = readout->image; // Readout's image 26 27 // We are going to force the range to be (-999 to 2^16 - 1002, ie, 1 less on each end than 2^16. this allows for float round errors 28 int bzero = LO_16BIT - 0; 29 float minValue = HI_16BIT + bzero + 1; 30 float maxValue = MX_16BIT + minValue - 3; 31 32 if (image->parent) { 33 psImage *parent = (psImage *) image->parent; 34 ppImageSquashNANsImage (parent, minValue, maxValue, 500.0); 35 } else { 36 ppImageSquashNANsImage (image, minValue, maxValue, 500.0); 37 38 // squash NANs in overscan regions 39 psList *overscans = readout->bias; // List of the overscan images 40 psListIterator *iter = psListIteratorAlloc(overscans, PS_LIST_HEAD, false); // Iterator 41 psImage *overscan = NULL; // Overscan image from iterator 42 while ((overscan = psListGetAndIncrement(iter))) { 43 ppImageSquashNANsImage (overscan, minValue, maxValue, 500.0); 44 } 45 psFree(iter); 46 } 47 48 psLogMsg ("ppImage", 5, "squash NANs: %f sec\n", psTimerMark ("squash.NANs")); 49 return true; 50 } 51 52 bool ppImageSquashNANsImage (psImage *image, float minValue, float maxValue, float offset) { 53 20 54 int numCols = image->numCols, numRows = image->numRows; // Size of image 21 55 22 56 for (int y = 0; y < numRows; y++) { 23 57 for (int x = 0; x < numCols; x++) { 24 58 if (!isfinite(image->data.F32[y][x])) { 25 image->data.F32[y][x] = -500.0; 59 image->data.F32[y][x] = 1.0; 60 } else { 61 image->data.F32[y][x] = PS_MAX (minValue, PS_MIN (maxValue, image->data.F32[y][x] + 500.0)); 26 62 } 27 63 } 28 64 } 29 psLogMsg ("ppImage", 5, "squash NANs: %f sec\n", psTimerMark ("squash.NANs"));30 31 65 return true; 32 66 } 67
Note:
See TracChangeset
for help on using the changeset viewer.
