Changeset 30031 for trunk/psLib/src/imageops
- Timestamp:
- Dec 14, 2010, 9:29:23 AM (15 years ago)
- Location:
- trunk/psLib/src/imageops
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
psImageMapFit.c (modified) (13 diffs)
-
psImageMapFit.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/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
-
Property svn:mergeinfo
set to
-
trunk/psLib/src/imageops/psImageMapFit.c
r25753 r30031 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 *goodFit, 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 *goodFit = 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 *goodFit = true; 83 86 return true; 84 87 } … … 86 89 if (Nx == 1) { 87 90 bool status; 88 status = psImageMapFit1DinY ( map, mask, maskValue, x, y, f, df);91 status = psImageMapFit1DinY (goodFit, map, mask, maskValue, x, y, f, df); 89 92 return status; 90 93 } 91 94 if (Ny == 1) { 92 95 bool status; 93 status = psImageMapFit1DinX ( map, mask, maskValue, x, y, f, df);96 status = psImageMapFit1DinX (goodFit, map, mask, maskValue, x, y, f, df); 94 97 return status; 95 98 } … … 310 313 311 314 if (!psMatrixGJSolve(A, B)) { 312 psError(PS_ERR_UNKNOWN, false, "Could not solve linear equations. Returning NULL.\n");313 315 psFree (A); 314 316 psFree (B); 315 return false;317 return true; 316 318 } 317 319 … … 337 339 psFree (Empty); 338 340 341 *goodFit = true; 339 342 return true; 340 343 } 341 344 342 345 // measure residuals on each pass and clip outliers based on stats 343 bool psImageMapClipFit( psImageMap *map, psStats *stats, psVector *inMask, psVectorMaskType maskValue,346 bool psImageMapClipFit(bool *goodFit, psImageMap *map, psStats *stats, psVector *inMask, psVectorMaskType maskValue, 344 347 const psVector *x, const psVector *y, const psVector *f, const psVector *df) 345 348 { … … 351 354 psAssert(f, "impossible"); 352 355 356 *goodFit = false; 357 353 358 // the user supplies one of various stats option pairs, 354 359 // determine the desired mean and stdev STATS options: … … 393 398 psTrace("psLib.imageops", 6, "Loop iteration %d. Calling psImageMapFit()\n", N); 394 399 psS32 Nkeep = 0; 395 if (!psImageMapFit( map, mask, maskValue, x, y, f, df)) {400 if (!psImageMapFit(goodFit, map, mask, maskValue, x, y, f, df)) { 396 401 psError(PS_ERR_UNKNOWN, false, "Could not fit image map.\n"); 397 402 psFree(resid); … … 399 404 return false; 400 405 } 406 if (!goodFit) { 407 psWarning ("bad fit to image map, try something else"); 408 return true; 409 } 401 410 402 411 psVector *fit = psImageMapEvalVector(map, mask, maskValue, x, y); … … 454 463 psFree(resid); 455 464 if (!inMask) psFree (mask); 465 *goodFit = true; // XXX probably don't need to set this (set by psImageMapFit) 456 466 return true; 457 467 } 458 468 459 469 // map defines the output image dimensions and scaling. 460 bool psImageMapFit1DinY( psImageMap *map, const psVector *mask, psVectorMaskType maskValue,470 bool psImageMapFit1DinY(bool *goodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue, 461 471 const psVector *x, const psVector *y, const psVector *f, const psVector *df) 462 472 { 463 473 // XXX Add Asserts 464 474 assert (map->binning->nXruff == 1); 475 476 *goodFit = false; 465 477 466 478 // dimensions of the output map image … … 578 590 579 591 if (!psMatrixGJSolve(A, B)) { 580 psError(PS_ERR_UNKNOWN, false, "Could not solve linear equations.\n");581 592 psFree (A); 582 593 psFree (B); 583 594 psFree (Empty); 584 return false;595 return true; 585 596 } 586 597 … … 602 613 psFree (Empty); 603 614 615 *goodFit = true; 604 616 return true; 605 617 } 606 618 607 619 // map defines the output image dimensions and scaling. 608 bool psImageMapFit1DinX( psImageMap *map, const psVector *mask, psVectorMaskType maskValue,620 bool psImageMapFit1DinX(bool *goodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue, 609 621 const psVector *x, const psVector *y, const psVector *f, const psVector *df) 610 622 { 611 623 // XXX Add Asserts 612 624 assert (map->binning->nYruff == 1); 625 626 *goodFit = false; 613 627 614 628 // dimensions of the output map image … … 726 740 727 741 if (!psMatrixGJSolve(A, B)) { 728 psError(PS_ERR_UNKNOWN, false, "Could not solve linear equations..\n");729 742 psFree (A); 730 743 psFree (B); 731 744 psFree (Empty); 732 return false;745 return true; 733 746 } 734 747 … … 750 763 psFree (Empty); 751 764 765 *goodFit = true; 752 766 return true; 753 767 } -
trunk/psLib/src/imageops/psImageMapFit.h
r25753 r30031 8 8 9 9 // fit the image map to a set of points 10 bool psImageMapFit(psImageMap *map, 10 bool psImageMapFit(bool *goodFit, 11 psImageMap *map, 11 12 const psVector *mask, 12 13 psVectorMaskType maskValue, // … … 18 19 19 20 // fit the image map to a set of points 20 bool psImageMapClipFit(psImageMap *map, 21 bool psImageMapClipFit(bool *goodFit, 22 psImageMap *map, 21 23 psStats *stats, 22 24 psVector *mask, // WARNING: Mask is modified! … … 28 30 ); 29 31 30 bool psImageMapFit1DinY(psImageMap *map, 32 bool psImageMapFit1DinY(bool *goodFit, 33 psImageMap *map, 31 34 const psVector *mask, 32 35 psVectorMaskType maskValue, … … 37 40 ); 38 41 39 bool psImageMapFit1DinX(psImageMap *map, 42 bool psImageMapFit1DinX(bool *goodFit, 43 psImageMap *map, 40 44 const psVector *mask, 41 45 psVectorMaskType maskValue,
Note:
See TracChangeset
for help on using the changeset viewer.
