- Timestamp:
- Mar 5, 2009, 11:13:29 AM (17 years ago)
- Location:
- branches/cnb_branches/cnb_branch_20090215
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
psModules/src/objects/pmModel.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/cnb_branches/cnb_branch_20090215
-
branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmModel.c
r21536 r23197 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1.2 7.4.1$ $Name: not supported by cvs2svn $9 * @date $Date: 2009-02-1 9 17:59:50$8 * @version $Revision: 1.28 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2009-02-16 22:30:26 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 235 235 236 236 if (model->residuals) { 237 DX = xBin*(image->col0 - xCenter - dx) + model->residuals->xCenter + 0.5;238 DY = yBin*(image->row0 - yCenter - dy) + model->residuals->yCenter + 0.5;239 Ro = (model->residuals->Ro) ? model->residuals->Ro->data.F32 : NULL;240 Rx = (model->residuals->Rx) ? model->residuals->Rx->data.F32 : NULL;241 Ry = (model->residuals->Ry) ? model->residuals->Ry->data.F32 : NULL;242 Rm = (model->residuals->mask) ? model->residuals->mask->data.PS_TYPE_IMAGE_MASK_DATA : NULL;243 if (Ro) {244 NX = model->residuals->Ro->numCols;245 NY = model->residuals->Ro->numRows;246 } 237 DX = xBin*(image->col0 - xCenter - dx) + model->residuals->xCenter + 0.5; 238 DY = yBin*(image->row0 - yCenter - dy) + model->residuals->yCenter + 0.5; 239 Ro = (model->residuals->Ro) ? model->residuals->Ro->data.F32 : NULL; 240 Rx = (model->residuals->Rx) ? model->residuals->Rx->data.F32 : NULL; 241 Ry = (model->residuals->Ry) ? model->residuals->Ry->data.F32 : NULL; 242 Rm = (model->residuals->mask) ? model->residuals->mask->data.PS_TYPE_IMAGE_MASK_DATA : NULL; 243 if (Ro) { 244 NX = model->residuals->Ro->numCols; 245 NY = model->residuals->Ro->numRows; 246 } 247 247 } 248 248 … … 256 256 257 257 // XXX should we use using 0.5 pixel offset? 258 // Convert to coordinate in parent image, with offset (dx,dy)258 // Convert to coordinate in parent image, with offset (dx,dy) 259 259 imageCol = ix + image->col0 - dx; 260 260 imageRow = iy + image->row0 - dy; … … 276 276 float rx = xBin*ix + DX; 277 277 278 int rx0 = rx - 0.5;279 int rx1 = rx + 0.5;280 int ry0 = ry - 0.5;281 int ry1 = ry + 0.5;282 283 if (rx0 < 0) goto skip;284 if (ry0 < 0) goto skip;285 if (rx1 >= NX) goto skip;286 if (ry1 >= NY) goto skip;287 288 // these go from 0.0 to 1.0 between the centers of the pixels 289 float fx = rx - 0.5 - rx0;290 float Fx = 1.0 - fx;291 float fy = ry - 0.5 - ry0;292 float Fy = 1.0 - fy;293 294 // check the residual image mask (if set). give up if any of the 4 pixels are masked.295 if (Rm) {296 if (Rm[ry0][rx0]) goto skip;297 if (Rm[ry0][rx1]) goto skip;298 if (Rm[ry1][rx0]) goto skip;299 if (Rm[ry1][rx1]) goto skip;300 }301 302 // a possible further optimization if we re-use these values303 // XXX allow for masked pixels, and add pixel weights304 float V0 = (Ro[ry0][rx0]*Fx + Ro[ry0][rx1]*fx);305 float V1 = (Ro[ry1][rx0]*Fx + Ro[ry1][rx1]*fx);306 float Vo = V0*Fy + V1*fy;307 if (!isfinite(Vo)) goto skip;308 309 float Vx = 0.0;310 float Vy = 0.0;311 312 // skip Rx,Ry if Ro is masked313 if (Rx && Ry && (mode & PM_MODEL_OP_RES1)) {314 V0 = (Rx[ry0][rx0]*Fx + Rx[ry0][rx1]*fx);315 V1 = (Rx[ry1][rx0]*Fx + Rx[ry1][rx1]*fx);316 Vx = V0*Fy + V1*fy;317 318 V0 = (Ry[ry0][rx0]*Fx + Ry[ry0][rx1]*fx);319 V1 = (Ry[ry1][rx0]*Fx + Ry[ry1][rx1]*fx);320 Vy = V0*Fy + V1*fy;321 }322 if (!isfinite(Vx)) goto skip;323 if (!isfinite(Vy)) goto skip;324 325 // 2D residual variations are set for the true source position326 pixelValue += Io*(Vo + XoSave*Vx + XoSave*Vy);278 int rx0 = rx - 0.5; 279 int rx1 = rx + 0.5; 280 int ry0 = ry - 0.5; 281 int ry1 = ry + 0.5; 282 283 if (rx0 < 0) goto skip; 284 if (ry0 < 0) goto skip; 285 if (rx1 >= NX) goto skip; 286 if (ry1 >= NY) goto skip; 287 288 // these go from 0.0 to 1.0 between the centers of the pixels 289 float fx = rx - 0.5 - rx0; 290 float Fx = 1.0 - fx; 291 float fy = ry - 0.5 - ry0; 292 float Fy = 1.0 - fy; 293 294 // check the residual image mask (if set). give up if any of the 4 pixels are masked. 295 if (Rm) { 296 if (Rm[ry0][rx0]) goto skip; 297 if (Rm[ry0][rx1]) goto skip; 298 if (Rm[ry1][rx0]) goto skip; 299 if (Rm[ry1][rx1]) goto skip; 300 } 301 302 // a possible further optimization if we re-use these values 303 // XXX allow for masked pixels, and add pixel weights 304 float V0 = (Ro[ry0][rx0]*Fx + Ro[ry0][rx1]*fx); 305 float V1 = (Ro[ry1][rx0]*Fx + Ro[ry1][rx1]*fx); 306 float Vo = V0*Fy + V1*fy; 307 if (!isfinite(Vo)) goto skip; 308 309 float Vx = 0.0; 310 float Vy = 0.0; 311 312 // skip Rx,Ry if Ro is masked 313 if (Rx && Ry && (mode & PM_MODEL_OP_RES1)) { 314 V0 = (Rx[ry0][rx0]*Fx + Rx[ry0][rx1]*fx); 315 V1 = (Rx[ry1][rx0]*Fx + Rx[ry1][rx1]*fx); 316 Vx = V0*Fy + V1*fy; 317 318 V0 = (Ry[ry0][rx0]*Fx + Ry[ry0][rx1]*fx); 319 V1 = (Ry[ry1][rx0]*Fx + Ry[ry1][rx1]*fx); 320 Vy = V0*Fy + V1*fy; 321 } 322 if (!isfinite(Vx)) goto skip; 323 if (!isfinite(Vy)) goto skip; 324 325 // 2D residual variations are set for the true source position 326 pixelValue += Io*(Vo + XoSave*Vx + XoSave*Vy); 327 327 } 328 328 329 skip:329 skip: 330 330 // add or subtract the value 331 331 if (add) {
Note:
See TracChangeset
for help on using the changeset viewer.
