Changeset 11225
- Timestamp:
- Jan 21, 2007, 3:09:29 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmFPAMaskWeight.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAMaskWeight.c
r11157 r11225 142 142 } 143 143 144 // XXX this function creates the mask pixels, or uses the existing mask 145 // pixels. currently, it will set mask bits if (value <= BAD) or (value >= SATURATION) 146 // should we optionally ignore these tests? 144 147 bool pmReadoutGenerateMask(pmReadout *readout) 145 148 { … … 230 233 } 231 234 235 // this function creates the weight pixels, or uses the existing weight pixels. it will set 236 // the noise pixel values only if the weight image is not supplied 232 237 bool pmReadoutGenerateWeight(pmReadout *readout, bool poisson) 233 238 { … … 238 243 239 244 // Create the weight image if required 240 if (!readout->weight) { 241 psRegion *trimsec = psMetadataLookupPtr(&mdok, cell->concepts, "CELL.TRIMSEC"); // Trim section 242 if (!mdok || psRegionIsNaN(*trimsec)) { 243 psError(PS_ERR_IO, true, "CELL.TRIMSEC is not set --- unable to set weight.\n"); 244 return false; 245 } 246 247 pmHDU *hdu = pmHDUFromCell(cell); // The HDU containing the cell's pixels 248 PS_ASSERT_PTR_NON_NULL(hdu, false); 249 if (!hdu->images && !pmHDUGenerateForCell(cell)) { 250 psError(PS_ERR_UNKNOWN, false, "Unable to generate HDU for cell.\n"); 251 return false; 252 } 253 254 createParentWeights(hdu); 255 256 // Need to identify which readout we're working with.... 257 long index = identifyReadout(hdu, readout); // Index of the readout 258 if (index == -1) { 259 psError(PS_ERR_UNKNOWN, true, "Unable to identify readout image in HDU.\n"); 260 return false; 261 } 262 263 psImage *weight = psImageSubset(hdu->weights->data[index], *trimsec); // The weight pixels 264 if (!weight) { 265 psString trimsecString = psRegionToString(*trimsec); 266 psError(PS_ERR_UNKNOWN, false, "Unable to set weight from HDU with trimsec: %s.\n", 267 trimsecString); 268 psFree(trimsecString); 269 return false; 270 } 271 psImageInit(weight, 0); 272 readout->weight = weight; 273 } 245 if (readout->weight) 246 return true; 247 248 psRegion *trimsec = psMetadataLookupPtr(&mdok, cell->concepts, "CELL.TRIMSEC"); // Trim section 249 if (!mdok || psRegionIsNaN(*trimsec)) { 250 psError(PS_ERR_IO, true, "CELL.TRIMSEC is not set --- unable to set weight.\n"); 251 return false; 252 } 253 254 pmHDU *hdu = pmHDUFromCell(cell); // The HDU containing the cell's pixels 255 PS_ASSERT_PTR_NON_NULL(hdu, false); 256 if (!hdu->images && !pmHDUGenerateForCell(cell)) { 257 psError(PS_ERR_UNKNOWN, false, "Unable to generate HDU for cell.\n"); 258 return false; 259 } 260 261 createParentWeights(hdu); 262 263 // Need to identify which readout we're working with.... 264 long index = identifyReadout(hdu, readout); // Index of the readout 265 if (index == -1) { 266 psError(PS_ERR_UNKNOWN, true, "Unable to identify readout image in HDU.\n"); 267 return false; 268 } 269 270 psImage *weight = psImageSubset(hdu->weights->data[index], *trimsec); // The weight pixels 271 if (!weight) { 272 psString trimsecString = psRegionToString(*trimsec); 273 psError(PS_ERR_UNKNOWN, false, "Unable to set weight from HDU with trimsec: %s.\n", 274 trimsecString); 275 psFree(trimsecString); 276 return false; 277 } 278 psImageInit(weight, 0); 279 readout->weight = weight; 274 280 275 281 return pmReadoutSetWeight(readout, poisson);
Note:
See TracChangeset
for help on using the changeset viewer.
