IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 15, 2010, 11:25:46 AM (15 years ago)
Author:
bills
Message:

Fix checking of good fit. Changed name to pGoodFit to emphasize that it is a pointer.
Fix a segv in trace code by checking for null pointers

Location:
trunk/psLib/src/imageops
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/imageops/psImageMapFit.c

    r30031 r30044  
    4848
    4949// map defines the output image dimensions and scaling.
    50 bool psImageMapFit(bool *goodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue,
     50bool psImageMapFit(bool *pGoodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue,
    5151                   const psVector *x, const psVector *y, const psVector *f, const psVector *df)
    5252{
    5353    // XXX Add Asserts
    5454
    55     *goodFit = false;
     55    *pGoodFit = false;
    5656
    5757    // dimensions of the output map image
     
    8383        map->map->data.F32[0][0]   = psStatsGetValue(map->stats, mean);
    8484        map->error->data.F32[0][0] = psStatsGetValue(map->stats, stdev);
    85         *goodFit = true;
     85        *pGoodFit = true;
    8686        return true;
    8787    }
     
    8989    if (Nx == 1) {
    9090        bool status;
    91         status = psImageMapFit1DinY (goodFit, map, mask, maskValue, x, y, f, df);
     91        status = psImageMapFit1DinY (pGoodFit, map, mask, maskValue, x, y, f, df);
    9292        return status;
    9393    }
    9494    if (Ny == 1) {
    9595        bool status;
    96         status = psImageMapFit1DinX (goodFit, map, mask, maskValue, x, y, f, df);
     96        status = psImageMapFit1DinX (pGoodFit, map, mask, maskValue, x, y, f, df);
    9797        return status;
    9898    }
     
    339339    psFree (Empty);
    340340
    341     *goodFit = true;
     341    *pGoodFit = true;
    342342    return true;
    343343}
    344344
    345345// measure residuals on each pass and clip outliers based on stats
    346 bool psImageMapClipFit(bool *goodFit, psImageMap *map, psStats *stats, psVector *inMask, psVectorMaskType maskValue,
     346bool psImageMapClipFit(bool *pGoodFit, psImageMap *map, psStats *stats, psVector *inMask, psVectorMaskType maskValue,
    347347                       const psVector *x, const psVector *y, const psVector *f, const psVector *df)
    348348{
     
    354354    psAssert(f, "impossible");
    355355
    356     *goodFit = false;
     356    *pGoodFit = false;
    357357
    358358    // the user supplies one of various stats option pairs,
     
    398398        psTrace("psLib.imageops", 6, "Loop iteration %d.  Calling psImageMapFit()\n", N);
    399399        psS32 Nkeep = 0;
    400         if (!psImageMapFit(goodFit, map, mask, maskValue, x, y, f, df)) {
     400        if (!psImageMapFit(pGoodFit, map, mask, maskValue, x, y, f, df)) {
    401401            psError(PS_ERR_UNKNOWN, false, "Could not fit image map.\n");
    402402            psFree(resid);
     
    404404            return false;
    405405        }
    406         if (!goodFit) {
     406        if (!*pGoodFit) {
    407407            psWarning ("bad fit to image map, try something else");
    408408            return true;
     
    463463    psFree(resid);
    464464    if (!inMask) psFree (mask);
    465     *goodFit = true; // XXX probably don't need to set this (set by psImageMapFit)
     465    *pGoodFit = true; // XXX probably don't need to set this (set by psImageMapFit)
    466466    return true;
    467467}
    468468
    469469// map defines the output image dimensions and scaling.
    470 bool psImageMapFit1DinY(bool *goodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue,
     470bool psImageMapFit1DinY(bool *pGoodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue,
    471471                        const psVector *x, const psVector *y, const psVector *f, const psVector *df)
    472472{
     
    474474    assert (map->binning->nXruff == 1);
    475475
    476     *goodFit = false;
     476    *pGoodFit = false;
    477477
    478478    // dimensions of the output map image
     
    613613    psFree (Empty);
    614614
    615     *goodFit = true;
     615    *pGoodFit = true;
    616616    return true;
    617617}
    618618
    619619// map defines the output image dimensions and scaling.
    620 bool psImageMapFit1DinX(bool *goodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue,
     620bool psImageMapFit1DinX(bool *pGoodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue,
    621621                        const psVector *x, const psVector *y, const psVector *f, const psVector *df)
    622622{
     
    624624    assert (map->binning->nYruff == 1);
    625625
    626     *goodFit = false;
     626    *pGoodFit = false;
    627627
    628628    // dimensions of the output map image
     
    763763    psFree (Empty);
    764764
    765     *goodFit = true;
     765    *pGoodFit = true;
    766766    return true;
    767767}
  • trunk/psLib/src/imageops/psImageMapFit.h

    r30031 r30044  
    88
    99// fit the image map to a set of points
    10 bool psImageMapFit(bool *goodFit,
     10bool psImageMapFit(bool *pGoodFit,
    1111                   psImageMap *map,
    1212                   const psVector *mask,
     
    1919
    2020// fit the image map to a set of points
    21 bool psImageMapClipFit(bool *goodFit,
     21bool psImageMapClipFit(bool *pGoodFit,
    2222                       psImageMap *map,
    2323                       psStats *stats,
     
    3030    );
    3131
    32 bool psImageMapFit1DinY(bool *goodFit,
     32bool psImageMapFit1DinY(bool *pGoodFit,
    3333                        psImageMap *map,
    3434                        const psVector *mask,
     
    4040    );
    4141
    42 bool psImageMapFit1DinX(bool *goodFit,
     42bool psImageMapFit1DinX(bool *pGoodFit,
    4343                        psImageMap *map,
    4444                        const psVector *mask,
Note: See TracChangeset for help on using the changeset viewer.