Changeset 16820 for trunk/psphot/src/psphotMaskReadout.c
- Timestamp:
- Mar 4, 2008, 3:10:25 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotMaskReadout.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotMaskReadout.c
r13900 r16820 1 1 # include "psphotInternal.h" 2 2 3 bool psphotMaskReadout (pmReadout *readout, psMetadata *recipe, psMaskType maskVal) { 3 // generate mask and weight if not defined, additional mask for restricted subregion 4 bool psphotSetMaskAndWeight (pmConfig *config, pmReadout *readout, psMetadata *recipe) { 4 5 5 6 bool status; 7 8 // ** Interpret the mask values: 9 10 // single-bit named masks 11 psMaskType maskMark = pmConfigMask("MARK", config); // Mask value for marking 12 psMetadataAddU8 (recipe, PS_LIST_TAIL, "MASK.MARK", PS_META_REPLACE, "user-defined mask", maskMark); 13 14 psMaskType maskSat = pmConfigMask("SAT", config); // Mask value for saturated pixels 15 psMetadataAddU8 (recipe, PS_LIST_TAIL, "MASK.SAT", PS_META_REPLACE, "user-defined mask", maskSat); 16 17 psMaskType maskBad = pmConfigMask("BAD", config); // Mask value for bad pixels 18 psMetadataAddU8 (recipe, PS_LIST_TAIL, "MASK.BAD", PS_META_REPLACE, "user-defined mask", maskBad); 19 20 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set) 21 psMaskType maskVal = psMetadataLookupU8(&status, recipe, "PSPHOT"); // Mask value for bad pixels 22 if (!maskVal) { 23 const char *maskValStr = psMetadataLookupStr(NULL, recipe, "MASKVAL"); // String with mask names 24 if (!maskValStr) { 25 psError(PSPHOT_ERR_CONFIG, false, "Missing recipe item: MASKVAL(STR)"); 26 return false; 27 } 28 maskVal = pmConfigMask(maskValStr, config); // Mask values to mask against 29 psMetadataAddU8 (recipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask", maskVal); 30 assert (maskVal); 31 } 32 33 // generate mask & weight images if they don't already exit 34 if (!readout->mask) { 35 if (!pmReadoutGenerateMask(readout, maskSat, maskBad)) { 36 psError (PSPHOT_ERR_CONFIG, false, "trouble creating mask"); 37 return false; 38 } 39 } 40 if (!readout->weight) { 41 if (!pmReadoutGenerateWeight(readout, true)) { 42 psError (PSPHOT_ERR_CONFIG, false, "trouble creating weight"); 43 return false; 44 } 45 } 6 46 7 47 // mask the excluded outer pixels … … 19 59 20 60 // psImageKeepRegion assumes the region refers to the parent coordinates 21 psImageKeepRegion (readout->mask, keep, "OR", maskVal); 61 psImageKeepRegion (readout->mask, keep, "OR", maskBad); 62 63 // test output of files at this stage 64 if (psTraceGetLevel("psphot") >= 5) { 65 psphotSaveImage (NULL, readout->image, "image.fits"); 66 psphotSaveImage (NULL, readout->mask, "mask.fits"); 67 psphotSaveImage (NULL, readout->weight, "weight.fits"); 68 } 22 69 23 70 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
