- Timestamp:
- Oct 2, 2009, 12:11:34 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090715/psModules/src/objects/pmModel.c
r25503 r25745 87 87 tmp->modelParamsFromPSF = class->modelParamsFromPSF; 88 88 tmp->modelFitStatus = class->modelFitStatus; 89 tmp->modelSetLimits = class->modelSetLimits; 89 90 90 91 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); … … 256 257 continue; 257 258 258 // Convert to coordinate in parent image, with offset (dx,dy)259 // Convert to coordinate in parent image, with offset (dx,dy) 259 260 // 0.5 PIX: the model take pixel coordinates so convert the pixel index here 260 261 imageCol = ix + 0.5 + image->col0 - dx; … … 277 278 float rx = xBin*ix + DX; 278 279 279 int rx0 = rx - 0.5;280 int rx1 = rx + 0.5;281 int ry0 = ry - 0.5;282 int ry1 = ry + 0.5;283 284 if (rx0 < 0) goto skip;285 if (ry0 < 0) goto skip;286 if (rx1 >= NX) goto skip;287 if (ry1 >= NY) goto skip;288 289 // these go from 0.0 to 1.0 between the centers of the pixels 290 float fx = rx - 0.5 - rx0;291 float Fx = 1.0 - fx;292 float fy = ry - 0.5 - ry0;293 float Fy = 1.0 - fy;294 295 // check the residual image mask (if set). give up if any of the 4 pixels are masked.296 if (Rm) {297 if (Rm[ry0][rx0]) goto skip;298 if (Rm[ry0][rx1]) goto skip;299 if (Rm[ry1][rx0]) goto skip;300 if (Rm[ry1][rx1]) goto skip;301 }302 303 // a possible further optimization if we re-use these values304 // XXX allow for masked pixels, and add pixel weights305 float V0 = (Ro[ry0][rx0]*Fx + Ro[ry0][rx1]*fx);306 float V1 = (Ro[ry1][rx0]*Fx + Ro[ry1][rx1]*fx);307 float Vo = V0*Fy + V1*fy;308 if (!isfinite(Vo)) goto skip;309 310 float Vx = 0.0;311 float Vy = 0.0;312 313 // skip Rx,Ry if Ro is masked314 if (Rx && Ry && (mode & PM_MODEL_OP_RES1)) {315 V0 = (Rx[ry0][rx0]*Fx + Rx[ry0][rx1]*fx);316 V1 = (Rx[ry1][rx0]*Fx + Rx[ry1][rx1]*fx);317 Vx = V0*Fy + V1*fy;318 319 V0 = (Ry[ry0][rx0]*Fx + Ry[ry0][rx1]*fx);320 V1 = (Ry[ry1][rx0]*Fx + Ry[ry1][rx1]*fx);321 Vy = V0*Fy + V1*fy;322 }323 if (!isfinite(Vx)) goto skip;324 if (!isfinite(Vy)) goto skip;325 326 // 2D residual variations are set for the true source position327 pixelValue += Io*(Vo + XoSave*Vx + XoSave*Vy);280 int rx0 = rx - 0.5; 281 int rx1 = rx + 0.5; 282 int ry0 = ry - 0.5; 283 int ry1 = ry + 0.5; 284 285 if (rx0 < 0) goto skip; 286 if (ry0 < 0) goto skip; 287 if (rx1 >= NX) goto skip; 288 if (ry1 >= NY) goto skip; 289 290 // these go from 0.0 to 1.0 between the centers of the pixels 291 float fx = rx - 0.5 - rx0; 292 float Fx = 1.0 - fx; 293 float fy = ry - 0.5 - ry0; 294 float Fy = 1.0 - fy; 295 296 // check the residual image mask (if set). give up if any of the 4 pixels are masked. 297 if (Rm) { 298 if (Rm[ry0][rx0]) goto skip; 299 if (Rm[ry0][rx1]) goto skip; 300 if (Rm[ry1][rx0]) goto skip; 301 if (Rm[ry1][rx1]) goto skip; 302 } 303 304 // a possible further optimization if we re-use these values 305 // XXX allow for masked pixels, and add pixel weights 306 float V0 = (Ro[ry0][rx0]*Fx + Ro[ry0][rx1]*fx); 307 float V1 = (Ro[ry1][rx0]*Fx + Ro[ry1][rx1]*fx); 308 float Vo = V0*Fy + V1*fy; 309 if (!isfinite(Vo)) goto skip; 310 311 float Vx = 0.0; 312 float Vy = 0.0; 313 314 // skip Rx,Ry if Ro is masked 315 if (Rx && Ry && (mode & PM_MODEL_OP_RES1)) { 316 V0 = (Rx[ry0][rx0]*Fx + Rx[ry0][rx1]*fx); 317 V1 = (Rx[ry1][rx0]*Fx + Rx[ry1][rx1]*fx); 318 Vx = V0*Fy + V1*fy; 319 320 V0 = (Ry[ry0][rx0]*Fx + Ry[ry0][rx1]*fx); 321 V1 = (Ry[ry1][rx0]*Fx + Ry[ry1][rx1]*fx); 322 Vy = V0*Fy + V1*fy; 323 } 324 if (!isfinite(Vx)) goto skip; 325 if (!isfinite(Vy)) goto skip; 326 327 // 2D residual variations are set for the true source position 328 pixelValue += Io*(Vo + XoSave*Vx + XoSave*Vy); 328 329 } 329 330 330 skip:331 skip: 331 332 // add or subtract the value 332 333 if (add) {
Note:
See TracChangeset
for help on using the changeset viewer.
