Changeset 1832 for trunk/psModules/src/pmMaskBadPixels.c
- Timestamp:
- Sep 20, 2004, 10:36:46 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/pmMaskBadPixels.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/pmMaskBadPixels.c
r1822 r1832 16 16 * pixel on the mask. In the event that the mask image is too small (i.e., pixels on the input image refer to 17 17 * pixels outside the range of the mask image), the function shall generate an error. 18 18 19 * @author Ross Harman, MHPCC 19 20 * 20 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $21 * @date $Date: 2004-09- 17 00:49:04$21 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 22 * @date $Date: 2004-09-20 20:36:46 $ 22 23 * 23 24 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 40 41 int jj = 0; 41 42 int ii = 0; 43 int rRound = 0; 42 44 int rowMin = 0; 43 45 int rowMax = 0; … … 46 48 int totOffCol = 0; 47 49 int totOffRow = 0; 48 float r = 0.0 ;50 float r = 0.0f; 49 51 psElemType inType; 50 52 psElemType maskType; … … 63 65 64 66 inImage = in->image; 65 inMask = in->mask;66 67 if (inImage == NULL) { 67 68 psError(__func__, " : Line %d - Null not allowed for input image", __LINE__); 68 69 return false; 69 70 } else if(inMask == NULL) { 70 in Mask = psImageAlloc(inImage->numCols, inImage->numRows, PS_TYPE_MASK);71 in->mask = psImageAlloc(inImage->numCols, inImage->numRows, PS_TYPE_MASK); 71 72 } 73 inMask = in->mask; 72 74 73 75 // Check input image and its mask are not larger than mask … … 135 137 // Macro for all PS types 136 138 #define PM_BAD_PIXELS(TYPE) \ 137 case PS_TYPE_##TYPE: \ 138 for(j=totOffRow; j<inImage->numRows; j++) { \ 139 for(i=totOffCol; i<inImage->numCols; i++) { \ 140 if(inImage->data.TYPE[j][i] > sat) { \ 141 /* Pixels with flux greater than sat shall be masked */ \ 142 inMask->data.PS_TYPE_MASK_DATA[j][i] |= PM_MASK_SAT; \ 143 } \ 144 if(mask->data.PS_TYPE_MASK_DATA[j][i] & maskVal) { \ 145 /* Pixels in mask which satisfy maskVal shall have their pixels masked in inMask */ \ 146 inMask->data.PS_TYPE_MASK_DATA[j][i] |= mask->data.PS_TYPE_MASK_DATA[j][i]|maskVal; \ 147 } \ 148 rowMin = MAX(j-grow, 0); \ 149 rowMax = MIN(j+grow, inImage->numRows-1); \ 150 colMin = MAX(i-grow, 0); \ 151 colMax = MIN(i+grow, inImage->numCols-1); \ 152 for(jj=rowMin; jj<rowMax; jj++) { \ 153 for(ii=colMin; ii<colMax; ii++) { \ 154 if(mask->data.PS_TYPE_MASK_DATA[j][i] & growVal) { \ 155 r = sqrtf((ii-i)*(ii-i)+(jj-j)*(jj-j)); \ 156 if(r <= grow) { \ 157 /* Pixels in mask which satisfy growVal shall have their corresponding \ 158 pixels,along with all pixels within the grow radius masked */ \ 159 inMask->data.PS_TYPE_MASK_DATA[j][i] |= \ 160 mask->data.PS_TYPE_MASK_DATA[j][i]&growVal; \ 161 } \ 162 } \ 163 } \ 164 } \ 165 } \ 166 } \ 139 case PS_TYPE_##TYPE: \ 140 for(j=totOffRow; j<inImage->numRows; j++) { \ 141 for(i=totOffCol; i<inImage->numCols; i++) { \ 142 \ 143 /* Pixels with flux greater than sat shall be masked */ \ 144 if(inImage->data.TYPE[j][i] > sat) { \ 145 inMask->data.PS_TYPE_MASK_DATA[j][i] |= PM_MASK_SAT; \ 146 } \ 147 \ 148 /* Pixels which satisfy maskVal shall be masked */ \ 149 inMask->data.PS_TYPE_MASK_DATA[j][i] |= (mask->data.PS_TYPE_MASK_DATA[j][i]&maskVal); \ 150 \ 151 /* Pixels which satisfy growVal and within the grow radius shall be masked */ \ 152 if(mask->data.PS_TYPE_MASK_DATA[j][i] & growVal) { \ 153 rowMin = MAX(j-grow, 0); \ 154 rowMax = MIN(j+grow+1, inImage->numRows); \ 155 colMin = MAX(i-grow, 0); \ 156 colMax = MIN(i+grow+1, inImage->numCols); \ 157 for(jj=rowMin; jj<rowMax; jj++) { \ 158 for(ii=colMin; ii<colMax; ii++) { \ 159 r = sqrtf((ii-i)*(ii-i)+(jj-j)*(jj-j)); \ 160 rRound = r + 0.5; \ 161 if(rRound <= grow) { \ 162 inMask->data.PS_TYPE_MASK_DATA[jj][ii] |= \ 163 (mask->data.PS_TYPE_MASK_DATA[j][i]&growVal); \ 164 } \ 165 } \ 166 } \ 167 } \ 168 } \ 169 } \ 167 170 break; 168 171
Note:
See TracChangeset
for help on using the changeset viewer.
