Changeset 21183 for trunk/pswarp/src/pswarpSetMaskBits.c
- Timestamp:
- Jan 26, 2009, 8:40:07 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/pswarp/src/pswarpSetMaskBits.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pswarp/src/pswarpSetMaskBits.c
r18558 r21183 10 10 bool pswarpSetMaskBits (pmConfig *config) { 11 11 12 psMaskType maskIn = 0x00; // mask for the input image 13 psMaskType markIn = 0x00; // mark for the input image 14 psMaskType maskOut = 0x00; // mask for the output image 15 psMaskType markOut = 0x00; // mark for the output image 12 psImageMaskType maskIn = 0x00; // mask for the input image 13 psImageMaskType markIn = 0x00; // mark for the input image 14 psImageMaskType maskOut = 0x00; // mask for the output image 16 15 17 16 // this function sets the required single-image mask bits … … 22 21 23 22 // mask for non-linear flat regions (default to DETECTOR if not defined) 24 ps MaskType badMask = pmConfigMaskGet("BAD.WARP", config);23 psImageMaskType badMask = pmConfigMaskGet("BAD.WARP", config); 25 24 if (!badMask) { 26 25 badMask = 0x01; … … 30 29 31 30 // mask for non-linear flat regions (default to DETECTOR if not defined) 32 ps MaskType poorMask = pmConfigMaskGet("POOR.WARP", config);31 psImageMaskType poorMask = pmConfigMaskGet("POOR.WARP", config); 33 32 if (!poorMask) { 34 33 poorMask = 0x02; … … 38 37 39 38 // search for an unset bit to use for MARK: 40 markOut = 0x80; 39 psImageMaskType markOut = 0x00; 40 psImageMaskType markTrial = 0x01; 41 41 42 int nBits = sizeof(ps MaskType) * 8;42 int nBits = sizeof(psImageMaskType) * 8; 43 43 for (int i = 0; !markOut && (i < nBits); i++) { 44 if (maskOut & markOut) {45 markOut >>= 1;46 } else {47 markOut = markOut;48 }44 if (maskOut & markTrial) { 45 markTrial <<= 1; 46 } else { 47 markOut = markTrial; 48 } 49 49 } 50 51 50 if (!markOut) { 52 psError (PS_ERR_UNKNOWN, true, "Unable to define the MARK bit mask: all bits taken!");53 return false;51 psError (PS_ERR_UNKNOWN, true, "Unable to define the MARK bit mask: all bits taken!"); 52 return false; 54 53 } 55 54 … … 63 62 // set maskOut and markOut in the psphot recipe 64 63 // NOTE: psphot works on the output images, not input images, so set the MARK and MASK correctly here 65 psMetadataAdd U8(warpRecipe, PS_LIST_TAIL, "MASK.INPUT", PS_META_REPLACE, "user-defined mask", maskIn);66 psMetadataAdd U8(warpRecipe, PS_LIST_TAIL, "MARK.INPUT", PS_META_REPLACE, "user-defined mask", markIn);67 psMetadataAdd U8(warpRecipe, PS_LIST_TAIL, "MASK.OUTPUT", PS_META_REPLACE, "user-defined mask", maskOut);68 psMetadataAdd U8(warpRecipe, PS_LIST_TAIL, "MARK.OUTPUT", PS_META_REPLACE, "user-defined mask", markOut);64 psMetadataAddImageMask (warpRecipe, PS_LIST_TAIL, "MASK.INPUT", PS_META_REPLACE, "user-defined mask", maskIn); 65 psMetadataAddImageMask (warpRecipe, PS_LIST_TAIL, "MARK.INPUT", PS_META_REPLACE, "user-defined mask", markIn); 66 psMetadataAddImageMask (warpRecipe, PS_LIST_TAIL, "MASK.OUTPUT", PS_META_REPLACE, "user-defined mask", maskOut); 67 psMetadataAddImageMask (warpRecipe, PS_LIST_TAIL, "MARK.OUTPUT", PS_META_REPLACE, "user-defined mask", markOut); 69 68 70 69 // update the psphot recipe … … 77 76 // set maskOut and markOut in the psphot recipe 78 77 // NOTE: psphot works on the output images, not input images, so set the MARK and MASK correctly here 79 psMetadataAdd U8(psphotRecipe, PS_LIST_TAIL, "MARK.PSPHOT", PS_META_REPLACE, "user-defined mask", markOut);80 psMetadataAdd U8(psphotRecipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask", maskOut);78 psMetadataAddImageMask (psphotRecipe, PS_LIST_TAIL, "MARK.PSPHOT", PS_META_REPLACE, "user-defined mask", markOut); 79 psMetadataAddImageMask (psphotRecipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask", maskOut); 81 80 82 81 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
