IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33316


Ignore:
Timestamp:
Feb 21, 2012, 11:15:01 AM (14 years ago)
Author:
watersc1
Message:

Fix pattern cotinuity correction when one cell has impossible values.

Location:
tags/ipp-20120216/psModules/src/detrend
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-20120216/psModules/src/detrend

  • tags/ipp-20120216/psModules/src/detrend/pmPattern.c

    r33243 r33316  
    565565    psImage *C = psImageAlloc(8,8,PS_TYPE_F64); // Right edge
    566566    psImage *D = psImageAlloc(8,8,PS_TYPE_F64); // Left edge
     567    psImageInit(A,0.0);
     568    psImageInit(B,0.0);
     569    psImageInit(C,0.0);
     570    psImageInit(D,0.0);
    567571   
    568572    for (int i = 0; i < numCells; i++) {
     
    611615            continue; // Move on to next edge, as only part of this cell may be a problem
    612616          }
    613 
     617 
    614618          // If the returned value is zero, assume something is wrong.  Do I still need this?
    615619          if (psStatsGetValue(bgStats,bgStat) < 1e-6) {
     
    632636            else if (j == 3) { D->data.F64[y][x] = psStatsGetValue(bgStats,bgStat); }
    633637          }
     638
     639          for (int u = 0; u < subset->numCols; u++) {
     640            for (int v = 0; v < subset->numRows; v++) {
     641              psTrace("psModules.detrend.cont",10,"BOX: %d %d (%d %d) (%d %d) %f %d",
     642                      i,j,x,y,u,v,subset->data.F32[v][u],submask->data.PS_TYPE_IMAGE_MASK_DATA[v][u]);
     643            }
     644          }       
     645         
    634646          psFree(subset);
    635647          psFree(submask);
     
    638650        psTrace("psModules.detrend.cont",5, "OTA: %d (%d %d) A: %f B: %f C: %f D: %f",
    639651                i,x,y,
    640                 A->data.F32[y][x],B->data.F32[y][x],C->data.F32[y][x],D->data.F32[y][x]);               
     652                A->data.F64[y][x],B->data.F64[y][x],C->data.F64[y][x],D->data.F64[y][x]);               
    641653    }
    642654    psFree(bgStats);
     
    661673      int x = (i - y) / 8;
    662674      int j;
     675      double critical_value = 0.0;
    663676      if (meanMask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PM_PATTERN_IGNORE) {
    664677        continue;
     
    666679      if (x + 1 < 8) {  // We have a neighbor adjacent in the +x direction
    667680        j = 8 * (x + 1) + y; // Determine that neighbor's index
     681        if (fabs(C->data.F64[y][x]) > fabs(D->data.F64[y][x+1])) {
     682          critical_value = 2.0 * fabs(D->data.F64[y][x+1] / C->data.F64[y][x]);
     683        }
     684        else {
     685          critical_value = 2.0 * fabs(C->data.F64[y][x] / D->data.F64[y][x+1]);
     686        }
    668687        psTrace("psModules.detrend.cont",5,"CmD %d %d %d %d %g %g", // diagnostic
    669688                i,x,y,j,
     
    672691                );
    673692        if (!(meanMask->data.PS_TYPE_VECTOR_MASK_DATA[j] & PM_PATTERN_IGNORE)&&  // If there are no errors with the neighbor,
    674             (isfinite(C->data.F64[y][x]))&&(isfinite(D->data.F64[y][x+1]))) {    // and all edges have valid values:
     693            (isfinite(C->data.F64[y][x]))&&(isfinite(D->data.F64[y][x+1]))&&     // and all edges have valid values,
     694            (fabs(C->data.F64[y][x] - D->data.F64[y][x+1]) < critical_value)     // and there are no large discontinuities,
     695            ) {   
    675696          solution->data.F64[i] += C->data.F64[y][x] - D->data.F64[y][x+1];     // Take the difference
    676697          XX->data.F64[i][i] += 1;                                              // increment our relation with ourself
     
    685706                C->data.F64[y][x-1]
    686707                );
    687 
     708        if (fabs(C->data.F64[y][x-1]) > fabs(D->data.F64[y][x])) {
     709          critical_value = 2.0 * fabs(D->data.F64[y][x] / C->data.F64[y][x-1]);
     710        }
     711        else {
     712          critical_value = 2.0 * fabs(C->data.F64[y][x-1] / D->data.F64[y][x]);
     713        }
    688714        if (!(meanMask->data.PS_TYPE_VECTOR_MASK_DATA[j] & PM_PATTERN_IGNORE)&&
    689             (isfinite(D->data.F64[y][x]))&&(isfinite(C->data.F64[y][x-1]))) {
     715            (isfinite(D->data.F64[y][x]))&&(isfinite(C->data.F64[y][x-1]))&&
     716            (fabs(D->data.F64[y][x] - C->data.F64[y][x-1]) < critical_value)
     717            ) {
    690718          solution->data.F64[i] += D->data.F64[y][x] - C->data.F64[y][x-1];
    691719          XX->data.F64[i][i] += 1;
     
    700728                B->data.F64[y+1][x]
    701729                );
    702 
     730        if (fabs(A->data.F64[y][x]) > fabs(B->data.F64[y+1][x])) {
     731          critical_value = 2.0 * fabs(B->data.F64[y+1][x] / A->data.F64[y][x]);
     732        }
     733        else {
     734          critical_value = 2.0 * fabs(A->data.F64[y][x] / B->data.F64[y+1][x]);
     735        }
    703736        if (!(meanMask->data.PS_TYPE_VECTOR_MASK_DATA[j] & PM_PATTERN_IGNORE)&&
    704             (isfinite(A->data.F64[y][x]))&&(isfinite(B->data.F64[y+1][x]))) {
     737            (isfinite(A->data.F64[y][x]))&&(isfinite(B->data.F64[y+1][x]))&&
     738            (fabs(A->data.F64[y][x] - B->data.F64[y+1][x]) < critical_value)
     739            ) {
    705740          solution->data.F64[i] += A->data.F64[y][x] - B->data.F64[y+1][x];
    706741          XX->data.F64[i][i] += 1;
     
    715750                A->data.F64[y-1][x]
    716751                );
    717 
     752        if (fabs(A->data.F64[y-1][x]) > fabs(B->data.F64[y][x])) {
     753          critical_value = 2.0 * fabs(B->data.F64[y][x] / A->data.F64[y-1][x]);
     754        }
     755        else {
     756          critical_value = 2.0 * fabs(A->data.F64[y-1][x] / B->data.F64[y][x]);
     757        }
    718758        if (!(meanMask->data.PS_TYPE_VECTOR_MASK_DATA[j] & PM_PATTERN_IGNORE)&&
    719             (isfinite(B->data.F64[y][x]))&&(isfinite(A->data.F64[y-1][x]))) {
     759            (isfinite(B->data.F64[y][x]))&&(isfinite(A->data.F64[y-1][x]))&&
     760            (fabs(B->data.F64[y][x] - A->data.F64[y-1][x]) < critical_value)
     761            ) {
    720762          solution->data.F64[i] += B->data.F64[y][x] - A->data.F64[y-1][x];
    721763          XX->data.F64[i][i] += 1;
Note: See TracChangeset for help on using the changeset viewer.