IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20991


Ignore:
Timestamp:
Dec 14, 2008, 2:48:22 PM (17 years ago)
Author:
eugene
Message:

when defining the CR mask, ignore masked pixels

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20081214/psphot/src/psphotSourceSize.c

    r20978 r20991  
    33
    44// XXX This should be a recipe variable
    5 # define SN_LIMIT 5.0
     5# define SN_LIMIT 3.0
    66
    77static float psphotModelContour(const psImage *image, const psImage *weight, const psImage *mask,
     
    330330    int xe = pixels->numCols;
    331331    for (int ix = xo; ix >= 0; ix--) {
     332        if (mask->data.U8[yo][ix] & maskVal) {
     333            continue;
     334        }
    332335        float SN = pixels->data.F32[yo][ix] / sqrt(weight->data.F32[yo][ix]);
    333336        if (SN < SN_LIMIT) {
    334             xs = ix + 1;
    335337            break;
    336338        }
     
    338340        psVectorAppend (xf, (float) ix);
    339341        psVectorAppend (yf, (float) yo);
     342        xs = ix;
    340343    }
    341344    for (int ix = xo + 1; ix < pixels->numCols; ix++) {
     345        if (mask->data.U8[yo][ix] & maskVal) {
     346            continue;
     347        }
    342348        float SN = pixels->data.F32[yo][ix] / sqrt(weight->data.F32[yo][ix]);
    343349        if (SN < SN_LIMIT) {
    344             xe = ix;
    345350            break;
    346351        }
     
    348353        psVectorAppend (xf, (float) ix);
    349354        psVectorAppend (yf, (float) yo);
    350     }
    351     psphotVisualShowCRMask (xf, yf);
     355        xe = ix + 1;
     356    }
     357    // psphotVisualShowCRMask (xf, yf);
     358    // fprintf (stderr, "first line: %d : %d - %d\n", yo, xs, xe);
    352359
    353360    int startXs = xs;
     
    369376        // first, try all of the pixels in the valid range (xs < x < xe guaranteed to be real pixels)
    370377        for (int ix = xs; ix < xe; ix++) {
     378            if (mask->data.U8[iy][ix] & maskVal) {
     379                continue;
     380            }
    371381            float SN = pixels->data.F32[iy][ix] / sqrt(weight->data.F32[iy][ix]);
    372382            if (SN < SN_LIMIT) {
     
    383393        // next, try the pixels to the left of the valid range for the previous row
    384394        for (int ix = xs - 1; ix >= 0; ix--) {
     395            if (mask->data.U8[iy][ix] & maskVal) {
     396                continue;
     397            }
    385398            float SN = pixels->data.F32[iy][ix] / sqrt(weight->data.F32[iy][ix]);
    386399            if (SN < SN_LIMIT) {
    387                 newXs = ix + 1;
    388400                break;
    389401            }
     
    392404            psVectorAppend (xf, (float) ix);
    393405            psVectorAppend (yf, (float) iy);
     406            newXs = ix;
    394407        }
    395408
    396409        // finally, try the pixels to the right of the valid range for the previous row
    397410        for (int ix = xe; ix < pixels->numCols; ix++) {
     411            if (mask->data.U8[iy][ix] & maskVal) {
     412                continue;
     413            }
    398414            float SN = pixels->data.F32[iy][ix] / sqrt(weight->data.F32[iy][ix]);
    399415            if (SN < SN_LIMIT) {
    400                 newXe = ix;
    401416                break;
    402417            }
     
    405420            psVectorAppend (xf, (float) ix);
    406421            psVectorAppend (yf, (float) iy);
    407         }
     422            newXe = ix + 1;
     423        }
     424        // fprintf (stderr, "down line: %d : %d - %d\n", iy, newXs, newXe);
    408425
    409426        xs = newXs;
    410427        xe = newXe;
    411428    }
    412     psphotVisualShowCRMask (xf, yf);
     429    // psphotVisualShowCRMask (xf, yf);
    413430
    414431    xs = startXs;
     
    430447        // first, try all of the pixels in the valid range (xs < x < xe guaranteed to be real pixels)
    431448        for (int ix = xs; ix < xe; ix++) {
     449            if (mask->data.U8[iy][ix] & maskVal) {
     450                continue;
     451            }
    432452            float SN = pixels->data.F32[iy][ix] / sqrt(weight->data.F32[iy][ix]);
    433453            if (SN < SN_LIMIT) {
     
    444464        // next, try the pixels to the left of the valid range for the previous row
    445465        for (int ix = xs - 1; ix >= 0; ix--) {
     466            if (mask->data.U8[iy][ix] & maskVal) {
     467                continue;
     468            }
    446469            float SN = pixels->data.F32[iy][ix] / sqrt(weight->data.F32[iy][ix]);
    447470            if (SN < SN_LIMIT) {
    448                 newXs = ix + 1;
    449471                break;
    450472            }
     
    453475            psVectorAppend (xf, (float) ix);
    454476            psVectorAppend (yf, (float) iy);
     477            newXs = ix;
    455478        }
    456479
    457480        // finally, try the pixels to the right of the valid range for the previous row
    458481        for (int ix = xe; ix < pixels->numCols; ix++) {
     482            if (mask->data.U8[iy][ix] & maskVal) {
     483                continue;
     484            }
    459485            float SN = pixels->data.F32[iy][ix] / sqrt(weight->data.F32[iy][ix]);
    460486            if (SN < SN_LIMIT) {
    461                 newXe = ix;
    462487                break;
    463488            }
     
    466491            psVectorAppend (xf, (float) ix);
    467492            psVectorAppend (yf, (float) iy);
    468         }
     493            newXe = ix + 1;
     494        }
     495        // fprintf (stderr, "up line: %d : %d - %d\n", iy, newXs, newXe);
    469496
    470497        xs = newXs;
     
    472499    }
    473500
    474     psphotVisualShowCRMask (xf, yf);
     501    // psphotVisualShowCRMask (xf, yf);
    475502    psFree (xf);
    476503    psFree (yf);
Note: See TracChangeset for help on using the changeset viewer.