Changeset 21142
- Timestamp:
- Jan 19, 2009, 4:56:04 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20081230/ppStats/src/ppStatsReadout.c
r21087 r21142 64 64 psVector *sampleValues = psVectorAlloc(numSamples, PS_TYPE_F32); // Vector of samples 65 65 psVector *sampleMask = psVectorAlloc(numSamples, PS_TYPE_VECTOR_MASK); // Corresponding mask 66 if (!mask) { 67 psVectorInit(sampleMask, 0); 68 } 66 psVectorInit(sampleMask, 0); 67 69 68 for (int i = 0; i < numSamples; i++) { 70 69 int j = i * sampleSpace; … … 72 71 int x = j % image->numCols; 73 72 sampleValues->data.F32[i] = image->data.F32[y][x]; 74 if ((!mask || !(mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & data->maskVal)) && !isfinite(sampleValues->data.F32[i])) { 75 if (!warnNonFinite) { 76 psWarning("Unmasked non-finite value detected at %d,%d; suppressing further warnings", x, y); 77 warnNonFinite = true; 78 } 73 74 // ignore the sampleMask if there is no input mask 75 if (!mask) continue; 76 77 // if this pixel is masked, set the sample mask 78 if (mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & data->maskVal) { 79 sampleMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = 1; 80 continue; 81 } 82 83 // mask any unmasked NAN/INF values 84 if (!isfinite(sampleValues->data.F32[i])) { 85 // warn for the first unmasked NAN/INF value 86 if (!warnNonFinite) { 87 psWarning("Unmasked non-finite value detected at %d,%d; suppressing further warnings", x, y); 88 warnNonFinite = true; 89 } 79 90 sampleMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = 1; 80 } else if (mask) { 81 sampleMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = 1; 82 } 91 } 83 92 } 84 93 if (!psVectorStats(data->stats, sampleValues, NULL, sampleMask, 1)) {
Note:
See TracChangeset
for help on using the changeset viewer.
