Changeset 25754 for trunk/psModules/src/objects/pmModel.c
- Timestamp:
- Oct 2, 2009, 3:11:32 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/objects/pmModel.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmModel.c
r25738 r25754 56 56 57 57 tmp->type = type; 58 tmp->chisq = 0.0; 59 tmp->chisqNorm = 0.0; 58 tmp->mag = NAN; 59 tmp->chisq = NAN; 60 tmp->chisqNorm = NAN; 60 61 tmp->nDOF = 0; 61 62 tmp->nPix = 0; 62 63 tmp->nIter = 0; 63 tmp-> radiusFit= 0;64 tmp->fitRadius = 0; 64 65 tmp->flags = PM_MODEL_STATUS_NONE; 65 66 tmp->residuals = NULL; // XXX should the model own this memory? … … 109 110 new->nIter = model->nIter; 110 111 new->flags = model->flags; 111 new-> radiusFit = model->radiusFit;112 new->fitRadius = model->fitRadius; 112 113 113 114 for (int i = 0; i < new->params->n; i++) { … … 190 191 psVector *params = model->params; 191 192 192 psS32imageCol;193 psS32imageRow;194 psF32pixelValue;193 float imageCol; 194 float imageRow; 195 float pixelValue; 195 196 196 197 // save original values; restore before returning … … 233 234 psF32 **Rx = NULL; 234 235 psF32 **Ry = NULL; 235 p sImageMaskType **Rm = NULL;236 pmResidMaskType **Rm = NULL; 236 237 237 238 if (model->residuals) { 238 DX = xBin*(image->col0 - xCenter - dx) + model->residuals->xCenter + 0.5;239 DY = yBin*(image->row0 - yCenter - dy) + model->residuals->yCenter + 0.5;240 Ro = (model->residuals->Ro) ? model->residuals->Ro->data.F32 : NULL;241 Rx = (model->residuals->Rx) ? model->residuals->Rx->data.F32 : NULL;242 Ry = (model->residuals->Ry) ? model->residuals->Ry->data.F32 : NULL;243 Rm = (model->residuals->mask) ? model->residuals->mask->data.PS_TYPE_IMAGE_MASK_DATA : NULL;244 if (Ro) {245 NX = model->residuals->Ro->numCols;246 NY = model->residuals->Ro->numRows;247 } 239 DX = xBin*(image->col0 - xCenter - dx) + model->residuals->xCenter + 0.5; 240 DY = yBin*(image->row0 - yCenter - dy) + model->residuals->yCenter + 0.5; 241 Ro = (model->residuals->Ro) ? model->residuals->Ro->data.F32 : NULL; 242 Rx = (model->residuals->Rx) ? model->residuals->Rx->data.F32 : NULL; 243 Ry = (model->residuals->Ry) ? model->residuals->Ry->data.F32 : NULL; 244 Rm = (model->residuals->mask) ? model->residuals->mask->data.PM_TYPE_RESID_MASK_DATA : NULL; 245 if (Ro) { 246 NX = model->residuals->Ro->numCols; 247 NY = model->residuals->Ro->numRows; 248 } 248 249 } 249 250 … … 256 257 continue; 257 258 258 // XXX should we use using 0.5 pixel offset?259 259 // Convert to coordinate in parent image, with offset (dx,dy) 260 imageCol = ix + image->col0 - dx; 261 imageRow = iy + image->row0 - dy; 262 263 x->data.F32[0] = (float) imageCol; 264 x->data.F32[1] = (float) imageRow; 260 // 0.5 PIX: the model take pixel coordinates so convert the pixel index here 261 imageCol = ix + 0.5 + image->col0 - dx; 262 imageRow = iy + 0.5 + image->row0 - dy; 263 264 x->data.F32[0] = imageCol; 265 x->data.F32[1] = imageRow; 265 266 266 267 pixelValue = 0.0;
Note:
See TracChangeset
for help on using the changeset viewer.
