- Timestamp:
- Jan 11, 2012, 11:19:21 PM (15 years ago)
- Location:
- branches/meh_branches/ppsub_test
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
psphot (modified) (1 prop)
-
psphot/src (modified) (2 props)
-
psphot/src/psphotRadiusChecks.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/meh_branches/ppsub_test
- Property svn:mergeinfo changed
-
branches/meh_branches/ppsub_test/psphot
- Property svn:mergeinfo changed
-
branches/meh_branches/ppsub_test/psphot/src
- Property svn:ignore
-
old new 22 22 psphotMakePSF 23 23 psphotStack 24 psphotModelTest
-
- Property svn:mergeinfo set to
- Property svn:ignore
-
branches/meh_branches/ppsub_test/psphot/src/psphotRadiusChecks.c
r31452 r33098 142 142 } 143 143 144 # define MIN_WINDOW 5.0 145 # define SCALE1 5.0 146 # define SCALE2 12.0 147 148 // call this function whenever you (re)-define the EXT model 149 // XXX this function does not shrink the window 150 bool psphotSetRadiusMoments (float *fitRadius, float *windowRadius, pmReadout *readout, pmSource *source, psImageMaskType markVal) { 151 152 psAssert (source, "source not defined??"); 153 psAssert (source->moments, "moments not defined??"); 154 155 *fitRadius = SCALE1 * source->moments->Mrf; 156 *fitRadius = PS_MIN (PS_MAX(*fitRadius, MIN_WINDOW), EXT_FIT_MAX_RADIUS); 157 158 *windowRadius = SCALE2 * source->moments->Mrf; 159 *windowRadius = PS_MIN (PS_MAX(*windowRadius, 2.5*MIN_WINDOW), 2.5*EXT_FIT_MAX_RADIUS); 160 161 // redefine the pixels if needed 162 pmSourceRedefinePixels (source, readout, source->peak->xf, source->peak->yf, *windowRadius); 163 164 // set the mask to flag the excluded pixels 165 psImageKeepCircle (source->maskObj, source->peak->xf, source->peak->yf, *fitRadius, "OR", markVal); 166 167 return true; 168 } 169 # undef SCALE1 170 # undef SCALE2 171 # undef MIN_WINDOW 172 173 # define MIN_WINDOW 5.0 174 # define SCALE1 5.0 175 # define PAD_WINDOW 3.0 176 177 // call this function whenever you (re)-define the EXT model 178 // XXX alternate function to set exactly the desired window size 179 bool psphotSetRadiusMomentsExact (float *fitRadius, float *windowRadius, pmReadout *readout, pmSource *source, psImageMaskType markVal) { 180 181 psRegion newRegion; 182 183 psAssert (source, "source not defined??"); 184 psAssert (source->moments, "moments not defined??"); 185 186 *fitRadius = SCALE1 * source->moments->Mrf; 187 *fitRadius = PS_MIN (PS_MAX(*fitRadius, MIN_WINDOW), EXT_FIT_MAX_RADIUS); 188 189 *windowRadius = *fitRadius + PAD_WINDOW; 190 191 // check to see if new region is completely contained within old region 192 newRegion = psRegionForSquare (source->peak->xf, source->peak->yf, *windowRadius); 193 newRegion = psRegionForImage (readout->image, newRegion); 194 195 // redefine the pixels to match 196 pmSourceRedefinePixelsByRegion (source, readout, newRegion); 197 198 // set the mask to flag the excluded pixels 199 psImageKeepCircle (source->maskObj, source->peak->xf, source->peak->yf, *fitRadius, "OR", markVal); 200 201 return true; 202 } 203 144 204 // call this function whenever you (re)-define the EXT model 145 205 bool psphotSetRadiusFootprint (float *radius, pmReadout *readout, pmSource *source, psImageMaskType markVal, float factor) { … … 181 241 } 182 242 243 // call this function whenever you (re)-define the EXT model 244 bool psphotMaskFootprint (pmReadout *readout, pmSource *source, psImageMaskType markVal) { 245 246 psAssert (source, "source not defined??"); 247 psAssert (source->peak, "peak not defined??"); 248 249 pmPeak *peak = source->peak; 250 251 // set the radius based on the footprint: 252 if (!peak->footprint) return false; 253 pmFootprint *footprint = peak->footprint; 254 if (!footprint->spans) return false; 255 if (footprint->spans->n < 1) return false; 256 257 int Xo = source->maskObj->col0; 258 int Yo = source->maskObj->row0; 259 260 // mark all pixels 261 for (int j = 0; j < source->maskObj->numRows; j++) { 262 for (int i = 0; i < source->maskObj->numCols; i++) { 263 source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[j][i] |= markVal; 264 } 265 } 266 267 psImageMaskType clearVal = PS_NOT_IMAGE_MASK(markVal); 268 269 for (int j = 0; j < footprint->spans->n; j++) { 270 pmSpan *span = footprint->spans->data[j]; 271 272 // mask the rows before and after each span 273 int minX = span->x0 - Xo - 2; 274 int maxX = span->x1 - Xo + 2; 275 int myY = span->y - Yo; 276 277 // unmark pixels inside the footprint 278 for (int i = minX; i <= maxX; i++) { 279 source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[myY][i] &= clearVal; 280 } 281 } 282 return true; 283 } 284 183 285 // alternative EXT radius based on model guess (for use without footprints) 184 286 bool psphotSetRadiusModel (pmModel *model, pmReadout *readout, pmSource *source, psImageMaskType markVal, bool deep) {
Note:
See TracChangeset
for help on using the changeset viewer.
