Changeset 13607 for trunk/ppStats/src/ppStatsLoop.c
- Timestamp:
- Jun 3, 2007, 4:27:58 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ppStats/src/ppStatsLoop.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStats/src/ppStatsLoop.c
r10165 r13607 109 109 } 110 110 111 if (!data->doStats ) {111 if (!data->doStats && psListLength(data->summary)) { 112 112 // Nothing further to do --- don't want to waste our time reading the data 113 113 if (psListLength(cellResults->list) > 0) { … … 143 143 } 144 144 145 // Do the statistics145 // Measure basic image statistics (means, stdevs, etc). 146 146 if (data->sample <= 0.0) { 147 147 if (!psImageStats(data->stats, readout->image, readout->mask, data->maskVal)) { 148 148 psLogMsg(__func__, PS_LOG_WARN, "Unable to perform statistics on cell %s --- " 149 149 "ignored.\n", cellName); 150 goto cellDone;150 goto statsDone; 151 151 } 152 152 } else { … … 175 175 psFree(sampleValues); 176 176 psFree(sampleMask); 177 goto cellDone;177 goto statsDone; 178 178 } 179 179 psFree(sampleValues); … … 201 201 WRITE_STAT(PS_STAT_CLIPPED_STDEV, "CLIPPED_STDEV", clippedStdev); 202 202 203 // measure other types of statistics tests 204 205 statsDone: 206 // count saturated pixels 207 if (psListLength(data->summary) > 0) { 208 bool get_nSatPixels = false; 209 bool get_fSatPixels = false; 210 211 psListIterator *iterator = psListIteratorAlloc(data->summary, PS_LIST_HEAD, false); 212 psString choice; 213 while ((choice = psListGetAndIncrement(iterator))) { 214 if (!strcasecmp (choice, "SAT_PIXEL_NUM")) get_nSatPixels = true; 215 if (!strcasecmp (choice, "SAT_PIXEL_FRAC")) get_fSatPixels = true; 216 } 217 218 if (!get_nSatPixels && !get_fSatPixels) goto cellDone; 219 220 // Get the "concepts" of interest 221 float saturation = psMetadataLookupF32(&mdok, cell->concepts, "CELL.SATURATION"); // Saturation level 222 if (!mdok || isnan(saturation)) { 223 psLogMsg(__func__, PS_LOG_WARN, "CELL.SATURATION is not set --- unable to measure N_SAT_PIXELS.\n"); 224 goto cellDone; 225 } 226 227 int nSatPixels = 0; 228 for (int j = 0; j < readout->image->numRows; j++) { 229 for (int i = 0; i < readout->image->numCols; i++) { 230 if (readout->image->data.F32[j][i] >= saturation) { 231 nSatPixels ++; 232 } 233 } 234 } 235 if (get_nSatPixels) psMetadataAddS32(cellResults, PS_LIST_TAIL, "SAT_PIXEL_NUM", 0, NULL, nSatPixels); 236 if (get_fSatPixels) psMetadataAddF32(cellResults, PS_LIST_TAIL, "SAT_PIXEL_FRAC", 0, NULL, nSatPixels / (double)(readout->image->numRows * readout->image->numCols)); 237 } 238 203 239 cellDone: 204 240 // Add the cell results to the chip
Note:
See TracChangeset
for help on using the changeset viewer.
