- Timestamp:
- Dec 20, 2010, 2:30:45 PM (16 years ago)
- Location:
- branches/czw_branch/20101203
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
psLib/src/imageops (modified) (1 prop)
-
psLib/src/imageops/psImageMapFit.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20101203
- Property svn:mergeinfo changed
-
branches/czw_branch/20101203/psLib/src/imageops
-
Property svn:mergeinfo
set to
/branches/eam_branches/ipp-20101103/psLib/src/imageops merged eligible /branches/eam_branches/ipp-20101205/psLib/src/imageops merged eligible /trunk/psLib/src/imageops merged eligible
-
Property svn:mergeinfo
set to
-
branches/czw_branch/20101203/psLib/src/imageops/psImageMapFit.c
r25753 r30118 48 48 49 49 // map defines the output image dimensions and scaling. 50 bool psImageMapFit( psImageMap *map, const psVector *mask, psVectorMaskType maskValue,50 bool psImageMapFit(bool *pGoodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue, 51 51 const psVector *x, const psVector *y, const psVector *f, const psVector *df) 52 52 { 53 53 // XXX Add Asserts 54 55 *pGoodFit = false; 54 56 55 57 // dimensions of the output map image … … 81 83 map->map->data.F32[0][0] = psStatsGetValue(map->stats, mean); 82 84 map->error->data.F32[0][0] = psStatsGetValue(map->stats, stdev); 85 if (isfinite(map->map->data.F32[0][0]) && isfinite( map->error->data.F32[0][0])) { 86 *pGoodFit = true; 87 } 83 88 return true; 84 89 } … … 86 91 if (Nx == 1) { 87 92 bool status; 88 status = psImageMapFit1DinY ( map, mask, maskValue, x, y, f, df);93 status = psImageMapFit1DinY (pGoodFit, map, mask, maskValue, x, y, f, df); 89 94 return status; 90 95 } 91 96 if (Ny == 1) { 92 97 bool status; 93 status = psImageMapFit1DinX ( map, mask, maskValue, x, y, f, df);98 status = psImageMapFit1DinX (pGoodFit, map, mask, maskValue, x, y, f, df); 94 99 return status; 95 100 } … … 310 315 311 316 if (!psMatrixGJSolve(A, B)) { 312 psError(PS_ERR_UNKNOWN, false, "Could not solve linear equations. Returning NULL.\n");313 317 psFree (A); 314 318 psFree (B); 315 return false;319 return true; 316 320 } 317 321 … … 337 341 psFree (Empty); 338 342 343 *pGoodFit = true; 339 344 return true; 340 345 } 341 346 342 347 // measure residuals on each pass and clip outliers based on stats 343 bool psImageMapClipFit( psImageMap *map, psStats *stats, psVector *inMask, psVectorMaskType maskValue,348 bool psImageMapClipFit(bool *pGoodFit, psImageMap *map, psStats *stats, psVector *inMask, psVectorMaskType maskValue, 344 349 const psVector *x, const psVector *y, const psVector *f, const psVector *df) 345 350 { … … 351 356 psAssert(f, "impossible"); 352 357 358 *pGoodFit = false; 359 353 360 // the user supplies one of various stats option pairs, 354 361 // determine the desired mean and stdev STATS options: … … 393 400 psTrace("psLib.imageops", 6, "Loop iteration %d. Calling psImageMapFit()\n", N); 394 401 psS32 Nkeep = 0; 395 if (!psImageMapFit( map, mask, maskValue, x, y, f, df)) {402 if (!psImageMapFit(pGoodFit, map, mask, maskValue, x, y, f, df)) { 396 403 psError(PS_ERR_UNKNOWN, false, "Could not fit image map.\n"); 397 404 psFree(resid); … … 399 406 return false; 400 407 } 408 if (!*pGoodFit) { 409 psWarning ("bad fit to image map, try something else"); 410 return true; 411 } 401 412 402 413 psVector *fit = psImageMapEvalVector(map, mask, maskValue, x, y); … … 454 465 psFree(resid); 455 466 if (!inMask) psFree (mask); 467 *pGoodFit = true; // XXX probably don't need to set this (set by psImageMapFit) 456 468 return true; 457 469 } 458 470 459 471 // map defines the output image dimensions and scaling. 460 bool psImageMapFit1DinY( psImageMap *map, const psVector *mask, psVectorMaskType maskValue,472 bool psImageMapFit1DinY(bool *pGoodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue, 461 473 const psVector *x, const psVector *y, const psVector *f, const psVector *df) 462 474 { 463 475 // XXX Add Asserts 464 476 assert (map->binning->nXruff == 1); 477 478 *pGoodFit = false; 465 479 466 480 // dimensions of the output map image … … 578 592 579 593 if (!psMatrixGJSolve(A, B)) { 580 psError(PS_ERR_UNKNOWN, false, "Could not solve linear equations.\n");581 594 psFree (A); 582 595 psFree (B); 583 596 psFree (Empty); 584 return false;597 return true; 585 598 } 586 599 … … 602 615 psFree (Empty); 603 616 617 *pGoodFit = true; 604 618 return true; 605 619 } 606 620 607 621 // map defines the output image dimensions and scaling. 608 bool psImageMapFit1DinX( psImageMap *map, const psVector *mask, psVectorMaskType maskValue,622 bool psImageMapFit1DinX(bool *pGoodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue, 609 623 const psVector *x, const psVector *y, const psVector *f, const psVector *df) 610 624 { 611 625 // XXX Add Asserts 612 626 assert (map->binning->nYruff == 1); 627 628 *pGoodFit = false; 613 629 614 630 // dimensions of the output map image … … 726 742 727 743 if (!psMatrixGJSolve(A, B)) { 728 psError(PS_ERR_UNKNOWN, false, "Could not solve linear equations..\n");729 744 psFree (A); 730 745 psFree (B); 731 746 psFree (Empty); 732 return false;747 return true; 733 748 } 734 749 … … 750 765 psFree (Empty); 751 766 767 *pGoodFit = true; 752 768 return true; 753 769 }
Note:
See TracChangeset
for help on using the changeset viewer.
