Changeset 27233
- Timestamp:
- Mar 10, 2010, 2:37:51 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/magic/remove/src/streaksio.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/magic/remove/src/streaksio.c
r26983 r27233 1123 1123 1124 1124 psImage *image = sfiles->outImage->image; 1125 double exciseValue = sfiles->inImage->exciseValue; 1126 1125 1127 psImage *mask = sfiles->inMask->image; 1126 1128 psImage *weight = NULL; 1129 int weightType = 0; 1130 double weightExciseValue = NAN; 1127 1131 if (sfiles->outWeight) { 1128 1132 weight = sfiles->outWeight->image; 1129 } 1130 double exciseValue = sfiles->inImage->exciseValue; 1133 weightType = weight->type.type; 1134 weightExciseValue = sfiles->inWeight->exciseValue; 1135 } 1131 1136 1132 1137 if (printCounts) { … … 1149 1154 if (maskVal & maskMask) { 1150 1155 ++maskedPixels; 1151 if (!isExciseValue(imageVal, sfiles->inImage->exciseValue)) {1156 if (!isExciseValue(imageVal, exciseValue)) { 1152 1157 ++nandPixels; 1153 1158 image->data.F32[y][x] = exciseValue; 1154 1159 } 1155 1160 if (weight) { 1156 double weightVal = weight ? weight->data.F32[y][x] : 0; 1157 if (!isnan(weightVal)) { 1158 ++nandWeights; 1159 weight->data.F32[y][x] = NAN; 1161 if (weightType == PS_TYPE_F32) { 1162 double weightVal = weight->data.F32[y][x]; 1163 if (!isnan(weightVal)) { 1164 ++nandWeights; 1165 weight->data.F32[y][x] = NAN; 1166 } 1167 } else if(weightType == PS_TYPE_S16) { 1168 double weightVal = weight->data.S16[y][x]; 1169 if (!isExciseValue(weightVal, weightExciseValue)) { 1170 ++nandWeights; 1171 image->data.S16[y][x] = weightExciseValue; 1172 } 1173 } else if (weightType == PS_TYPE_U16) { 1174 double weightVal = weight->data.U16[y][x]; 1175 if (!isExciseValue(weightVal, weightExciseValue)) { 1176 ++nandWeights; 1177 image->data.U16[y][x] = weightExciseValue; 1178 } 1179 } else { 1180 psError(PS_ERR_PROGRAMMING, true, "unexpected image type found: %d\n", 1181 weightType); 1182 streaksExit("", PS_EXIT_PROG_ERROR); 1160 1183 } 1161 1184 } … … 1188 1211 psMetadataAddU16(in->header, PS_LIST_TAIL, "BLANK", 0, "", 65535); 1189 1212 psMetadataAddU16(in->header, PS_LIST_TAIL, "ZBLANK", 0, "", 65535); 1190 } else { 1213 } else if (in->image->type.type == PS_TYPE_S16) { 1214 in->exciseValue = 32767; 1215 psMetadataAddU16(in->header, PS_LIST_TAIL, "BLANK", 0, "", 32767); 1216 psMetadataAddU16(in->header, PS_LIST_TAIL, "ZBLANK", 0, "", 32767); 1217 } else if (in->image->type.type == PS_TYPE_F32) { 1191 1218 in->exciseValue = NAN; 1219 } else { 1220 psError(PS_ERR_PROGRAMMING, true, "unexpected image type found: %d\n", in->image->type.type); 1221 streaksExit("", PS_EXIT_PROG_ERROR); 1192 1222 } 1193 1223 }
Note:
See TracChangeset
for help on using the changeset viewer.
