Changeset 15699 for trunk/psModules/src/objects/pmModel.c
- Timestamp:
- Nov 27, 2007, 11:16:45 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/objects/pmModel.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmModel.c
r15587 r15699 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $9 * @date $Date: 2007-11- 11 21:49:18$8 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-11-27 21:16:45 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 57 57 tmp->type = type; 58 58 tmp->chisq = 0.0; 59 tmp->chisqNorm = 0.0; 59 60 tmp->nDOF = 0; 60 61 tmp->nIter = 0; … … 76 77 } 77 78 78 tmp->modelFunc = class->modelFunc;79 tmp->modelFlux = class->modelFlux;80 tmp->modelRadius = class->modelRadius;81 tmp->modelLimits = class->modelLimits;79 tmp->modelFunc = class->modelFunc; 80 tmp->modelFlux = class->modelFlux; 81 tmp->modelRadius = class->modelRadius; 82 tmp->modelLimits = class->modelLimits; 82 83 tmp->modelGuess = class->modelGuess; 83 84 tmp->modelFromPSF = class->modelFromPSF; … … 172 173 bool add, 173 174 psMaskType maskVal, 174 int dx,175 int dy175 int dx, 176 int dy 176 177 ) 177 178 { … … 225 226 psImageInterpolateOptions *Ry = NULL; 226 227 if (model->residuals && (mode & (PM_MODEL_OP_RES0 | PM_MODEL_OP_RES1))) { 227 // if the residual image and object image don't match, 228 // supply an appropriately overlapped residual image229 psImage *inRo = model->residuals->Ro;230 psImage *inRx = model->residuals->Rx;231 psImage *inRy = model->residuals->Ry;232 if ((image->numCols != inRo->numCols) || 233 (image->numRows != inRo->numRows)) {234 myRo = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);235 myRx = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);236 myRy = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);237 dx = (int)(inRx->numCols / 2) - (xPos - image->col0); 238 dy = (int)(inRx->numCols / 2) - (xPos - image->col0); 239 for (int iy = 0; iy < myRo->numRows; iy++) {240 int jy = iy + dy;241 if ((jy < 0) || (jy >= inRo->numRows)) {242 for (int ix = 0; ix < myRo->numCols; ix++) {243 myRo->data.F32[iy][ix] = 0.0;244 myRx->data.F32[iy][ix] = 0.0;245 myRy->data.F32[iy][ix] = 0.0;246 }247 continue;248 }249 for (int ix = 0; ix < myRo->numCols; ix++) {250 int jx = ix + dx;251 if ((jx < 0) || (jx >= inRo->numCols)) {252 myRo->data.F32[iy][ix] = 0.0;253 myRx->data.F32[iy][ix] = 0.0;254 myRy->data.F32[iy][ix] = 0.0;255 } else {256 myRo->data.F32[iy][ix] = inRo->data.F32[jy][jx];257 myRx->data.F32[iy][ix] = inRx->data.F32[jy][jx];258 myRy->data.F32[iy][ix] = inRy->data.F32[jy][jx];259 }260 }261 } 262 } else {263 myRo = psMemIncrRefCounter (inRo);264 myRx = psMemIncrRefCounter (inRx);265 myRy = psMemIncrRefCounter (inRy);266 }228 // if the residual image and object image don't match, 229 // supply an appropriately overlapped residual image 230 psImage *inRo = model->residuals->Ro; 231 psImage *inRx = model->residuals->Rx; 232 psImage *inRy = model->residuals->Ry; 233 if ((image->numCols != inRo->numCols) || 234 (image->numRows != inRo->numRows)) { 235 myRo = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32); 236 myRx = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32); 237 myRy = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32); 238 dx = (int)(inRx->numCols / 2) - (xPos - image->col0); 239 dy = (int)(inRx->numCols / 2) - (xPos - image->col0); 240 for (int iy = 0; iy < myRo->numRows; iy++) { 241 int jy = iy + dy; 242 if ((jy < 0) || (jy >= inRo->numRows)) { 243 for (int ix = 0; ix < myRo->numCols; ix++) { 244 myRo->data.F32[iy][ix] = 0.0; 245 myRx->data.F32[iy][ix] = 0.0; 246 myRy->data.F32[iy][ix] = 0.0; 247 } 248 continue; 249 } 250 for (int ix = 0; ix < myRo->numCols; ix++) { 251 int jx = ix + dx; 252 if ((jx < 0) || (jx >= inRo->numCols)) { 253 myRo->data.F32[iy][ix] = 0.0; 254 myRx->data.F32[iy][ix] = 0.0; 255 myRy->data.F32[iy][ix] = 0.0; 256 } else { 257 myRo->data.F32[iy][ix] = inRo->data.F32[jy][jx]; 258 myRx->data.F32[iy][ix] = inRx->data.F32[jy][jx]; 259 myRy->data.F32[iy][ix] = inRy->data.F32[jy][jx]; 260 } 261 } 262 } 263 } else { 264 myRo = psMemIncrRefCounter (inRo); 265 myRx = psMemIncrRefCounter (inRx); 266 myRy = psMemIncrRefCounter (inRy); 267 } 267 268 268 269 Ro = psImageInterpolateOptionsAlloc(PS_INTERPOLATE_BILINEAR, myRo, NULL, mask, 0, 0.0, 0.0, 1, 0, 0.0); … … 302 303 float oy = yBin*(imageRow + 0.5 - yCenter) + yResidCenter; 303 304 304 psU8 mflux = 0;305 psU8 mflux = 0; 305 306 if (mode & PM_MODEL_OP_RES0) { 306 307 double Fo = 0.0; … … 310 311 } 311 312 } 312 // skip Rx,Ry if Ro is masked313 // skip Rx,Ry if Ro is masked 313 314 if (!mflux && (mode & PM_MODEL_OP_RES1)) { 314 315 double Fx = 0.0; … … 379 380 *****************************************************************************/ 380 381 bool pmModelAddWithOffset(psImage *image, 381 psImage *mask,382 pmModel *model,383 pmModelOpMode mode,384 psMaskType maskVal,385 int dx,386 int dy)382 psImage *mask, 383 pmModel *model, 384 pmModelOpMode mode, 385 psMaskType maskVal, 386 int dx, 387 int dy) 387 388 { 388 389 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__); … … 395 396 *****************************************************************************/ 396 397 bool pmModelSubWithOffset(psImage *image, 397 psImage *mask,398 pmModel *model,399 pmModelOpMode mode,400 psMaskType maskVal,401 int dx,402 int dy)398 psImage *mask, 399 pmModel *model, 400 pmModelOpMode mode, 401 psMaskType maskVal, 402 int dx, 403 int dy) 403 404 { 404 405 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
Note:
See TracChangeset
for help on using the changeset viewer.
