- Timestamp:
- Mar 29, 2010, 3:55:49 PM (16 years ago)
- Location:
- branches/eam_branches/20100225
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
magic/remove/src/streaksio.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20100225
- Property svn:mergeinfo changed
-
branches/eam_branches/20100225/magic/remove/src/streaksio.c
r26983 r27517 811 811 } 812 812 streaksVersionHeaderFull(sfile->header); 813 813 814 if (!psFitsWriteImage(sfile->fits, sfile->header, sfile->image, 0, extname)) { 814 815 psError(PS_ERR_IO, false, "failed to write image to %s extnum: %d", … … 871 872 closeImages(streakFiles *sf) 872 873 { 874 if (sf->stage == IPP_STAGE_RAW) { 875 if (sf->view) { 876 sf->view->readout = -1; 877 pmFPAfileIOChecks(sf->config, sf->view, PM_FPA_AFTER); 878 sf->view->cell = -1; 879 pmFPAfileIOChecks(sf->config, sf->view, PM_FPA_AFTER); 880 sf->view->chip = -1; 881 pmFPAfileIOChecks(sf->config, sf->view, PM_FPA_AFTER); 882 } 883 } 873 884 closeImage(sf->inImage); 874 885 closeImage(sf->outImage); … … 1123 1134 1124 1135 psImage *image = sfiles->outImage->image; 1136 int imageType = image->type.type; 1137 double exciseValue = sfiles->inImage->exciseValue; 1138 1125 1139 psImage *mask = sfiles->inMask->image; 1126 1140 psImage *weight = NULL; 1141 int weightType = 0; 1142 double weightExciseValue = NAN; 1127 1143 if (sfiles->outWeight) { 1128 1144 weight = sfiles->outWeight->image; 1129 } 1130 double exciseValue = sfiles->inImage->exciseValue; 1145 weightType = weight->type.type; 1146 weightExciseValue = sfiles->inWeight->exciseValue; 1147 } 1131 1148 1132 1149 if (printCounts) { … … 1138 1155 // these gets are not necessary, we could just set the pixels to nan 1139 1156 // but I want to get the counts 1140 double imageVal = image->data.F32[y][x]; 1141 psU32 maskVal; 1157 double imageVal = 0; // avoid compiler warning 1158 if (imageType == PS_TYPE_F32) { 1159 imageVal = image->data.F32[y][x]; 1160 } else if (imageType == PS_TYPE_S16) { 1161 imageVal = image->data.S16[y][x]; 1162 } else if (imageType == PS_TYPE_U16) { 1163 imageVal = image->data.U16[y][x]; 1164 } else { 1165 psError(PS_ERR_PROGRAMMING, true, "unexpected image type found: %d\n", 1166 imageType); 1167 streaksExit("", PS_EXIT_PROG_ERROR); 1168 } 1169 psU32 maskVal = 0; 1142 1170 if (sfiles->stage == IPP_STAGE_RAW) { 1143 1171 unsigned int xChip, yChip; … … 1149 1177 if (maskVal & maskMask) { 1150 1178 ++maskedPixels; 1151 if (!isExciseValue(imageVal, sfiles->inImage->exciseValue)) {1179 if (!isExciseValue(imageVal, exciseValue)) { 1152 1180 ++nandPixels; 1153 image->data.F32[y][x] = exciseValue; 1181 if (imageType == PS_TYPE_F32) { 1182 image->data.F32[y][x] = exciseValue; 1183 } else if (imageType == PS_TYPE_S16) { 1184 image->data.S16[y][x] = exciseValue; 1185 } else if (imageType == PS_TYPE_U16) { 1186 image->data.U16[y][x] = exciseValue; 1187 } else { 1188 psError(PS_ERR_PROGRAMMING, true, "unexpected image type found: %d\n", 1189 imageType); 1190 streaksExit("", PS_EXIT_PROG_ERROR); 1191 } 1154 1192 } 1155 1193 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; 1194 if (weightType == PS_TYPE_F32) { 1195 double weightVal = weight->data.F32[y][x]; 1196 if (!isnan(weightVal)) { 1197 ++nandWeights; 1198 weight->data.F32[y][x] = NAN; 1199 } 1200 } else if(weightType == PS_TYPE_S16) { 1201 double weightVal = weight->data.S16[y][x]; 1202 if (!isExciseValue(weightVal, weightExciseValue)) { 1203 ++nandWeights; 1204 image->data.S16[y][x] = weightExciseValue; 1205 } 1206 } else if (weightType == PS_TYPE_U16) { 1207 double weightVal = weight->data.U16[y][x]; 1208 if (!isExciseValue(weightVal, weightExciseValue)) { 1209 ++nandWeights; 1210 image->data.U16[y][x] = weightExciseValue; 1211 } 1212 } else { 1213 psError(PS_ERR_PROGRAMMING, true, "unexpected image type found: %d\n", 1214 weightType); 1215 streaksExit("", PS_EXIT_PROG_ERROR); 1160 1216 } 1161 1217 } … … 1188 1244 psMetadataAddU16(in->header, PS_LIST_TAIL, "BLANK", 0, "", 65535); 1189 1245 psMetadataAddU16(in->header, PS_LIST_TAIL, "ZBLANK", 0, "", 65535); 1190 } else { 1246 } else if (in->image->type.type == PS_TYPE_S16) { 1247 in->exciseValue = 32767; 1248 psMetadataAddU16(in->header, PS_LIST_TAIL, "BLANK", 0, "", 32767); 1249 psMetadataAddU16(in->header, PS_LIST_TAIL, "ZBLANK", 0, "", 32767); 1250 } else if (in->image->type.type == PS_TYPE_F32) { 1191 1251 in->exciseValue = NAN; 1252 } else { 1253 psError(PS_ERR_PROGRAMMING, true, "unexpected image type found: %d\n", in->image->type.type); 1254 streaksExit("", PS_EXIT_PROG_ERROR); 1192 1255 } 1193 1256 }
Note:
See TracChangeset
for help on using the changeset viewer.
