Changeset 33304 for trunk/psModules/src/detrend/pmPattern.c
- Timestamp:
- Feb 17, 2012, 4:44:49 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/detrend/pmPattern.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/detrend/pmPattern.c
r33243 r33304 565 565 psImage *C = psImageAlloc(8,8,PS_TYPE_F64); // Right edge 566 566 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); 567 571 568 572 for (int i = 0; i < numCells; i++) { … … 611 615 continue; // Move on to next edge, as only part of this cell may be a problem 612 616 } 613 617 614 618 // If the returned value is zero, assume something is wrong. Do I still need this? 615 619 if (psStatsGetValue(bgStats,bgStat) < 1e-6) { … … 632 636 else if (j == 3) { D->data.F64[y][x] = psStatsGetValue(bgStats,bgStat); } 633 637 } 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 634 646 psFree(subset); 635 647 psFree(submask); … … 638 650 psTrace("psModules.detrend.cont",5, "OTA: %d (%d %d) A: %f B: %f C: %f D: %f", 639 651 i,x,y, 640 A->data.F 32[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]); 641 653 } 642 654 psFree(bgStats); … … 661 673 int x = (i - y) / 8; 662 674 int j; 675 double critical_value = 0.0; 663 676 if (meanMask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PM_PATTERN_IGNORE) { 664 677 continue; … … 666 679 if (x + 1 < 8) { // We have a neighbor adjacent in the +x direction 667 680 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 } 668 687 psTrace("psModules.detrend.cont",5,"CmD %d %d %d %d %g %g", // diagnostic 669 688 i,x,y,j, … … 672 691 ); 673 692 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 ) { 675 696 solution->data.F64[i] += C->data.F64[y][x] - D->data.F64[y][x+1]; // Take the difference 676 697 XX->data.F64[i][i] += 1; // increment our relation with ourself … … 685 706 C->data.F64[y][x-1] 686 707 ); 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 } 688 714 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 ) { 690 718 solution->data.F64[i] += D->data.F64[y][x] - C->data.F64[y][x-1]; 691 719 XX->data.F64[i][i] += 1; … … 700 728 B->data.F64[y+1][x] 701 729 ); 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 } 703 736 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 ) { 705 740 solution->data.F64[i] += A->data.F64[y][x] - B->data.F64[y+1][x]; 706 741 XX->data.F64[i][i] += 1; … … 715 750 A->data.F64[y-1][x] 716 751 ); 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 } 718 758 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 ) { 720 762 solution->data.F64[i] += B->data.F64[y][x] - A->data.F64[y-1][x]; 721 763 XX->data.F64[i][i] += 1;
Note:
See TracChangeset
for help on using the changeset viewer.
