Changeset 23851 for trunk/psModules/src/imcombine/pmSubtractionMask.c
- Timestamp:
- Apr 14, 2009, 10:40:50 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/imcombine/pmSubtractionMask.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/imcombine/pmSubtractionMask.c
r23849 r23851 38 38 39 39 psImage *pmSubtractionMask(const psImage *mask1, const psImage *mask2, psImageMaskType maskVal, 40 int size, int footprint, float badFrac, bool useFFT)40 int size, int footprint, float badFrac, pmSubtractionMode mode) 41 41 { 42 42 PS_ASSERT_IMAGE_NON_NULL(mask1, NULL); … … 114 114 } 115 115 116 // XXX Could do something smarter here --- we will get images that are predominantly masked (where the117 // skycell isn't overlapped by a large fraction by the observation), so that convolving around every bad118 // pixel is wasting time. As a first cut, I've put in a check on the fraction of bad pixels, but we could119 // imagine looking for the edge of big regions and convolving just at the edge. As a second cut, allow120 // use of FFT convolution.121 122 116 for (int y = 0; y < numRows; y++) { 123 117 for (int x = 0; x < numCols; x++) { … … 131 125 } 132 126 133 // Block out the entire stamp footprint around bad input pixels.134 135 127 // We want to block out with the CONVOLVE mask anything that would be bad if we convolved with a bad 136 // reference pixel (within 'size'). Then we want to block out with the FOOTPRINTmask everything within a128 // reference pixel (within 'size'). Then we want to block out with the REJ mask everything within a 137 129 // footprint's distance of those (within 'footprint'). 138 130 139 131 bool oldThreads = psImageConvolveSetThreads(true); // Old value of threading for psImageConvolve 140 132 133 // Pixels that will be bad (or poor) if we convolve with a bad reference pixel 141 134 if (!psImageConvolveMask(mask, mask, PM_SUBTRACTION_MASK_BAD_1, PM_SUBTRACTION_MASK_CONVOLVE_1, 142 135 -size, size, -size, size)) { … … 148 141 -size, size, -size, size)) { 149 142 psError(PS_ERR_UNKNOWN, false, "Unable to convolve bad pixels from mask 2."); 143 psFree(mask); 144 return NULL; 145 } 146 147 // Pixels that should not be chosen as stamps 148 psImageMaskType maskRej = PM_SUBTRACTION_MASK_BAD_1 | PM_SUBTRACTION_MASK_BAD_2 | 149 PM_SUBTRACTION_MASK_BORDER; // Mask value for rejection 150 switch (mode) { 151 case PM_SUBTRACTION_MODE_1: 152 maskRej |= PM_SUBTRACTION_MASK_CONVOLVE_1; 153 break; 154 case PM_SUBTRACTION_MODE_2: 155 maskRej |= PM_SUBTRACTION_MASK_CONVOLVE_2; 156 break; 157 case PM_SUBTRACTION_MODE_UNSURE: 158 case PM_SUBTRACTION_MODE_DUAL: 159 maskRej |= PM_SUBTRACTION_MASK_CONVOLVE_1 | PM_SUBTRACTION_MASK_CONVOLVE_2; 160 break; 161 default: 162 psAbort("Unsupported subtraction mode: %x", mode); 163 } 164 if (!psImageConvolveMask(mask, mask, maskRej, PM_SUBTRACTION_MASK_REJ, 165 -footprint, footprint, -footprint, footprint)) { 166 psError(PS_ERR_UNKNOWN, false, "Unable to convolve bad pixels."); 150 167 psFree(mask); 151 168 return NULL;
Note:
See TracChangeset
for help on using the changeset viewer.
