Changeset 5783 for trunk/psLib/src/imageops/psImageStats.c
- Timestamp:
- Dec 13, 2005, 2:47:27 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/imageops/psImageStats.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImageStats.c
r5530 r5783 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.8 4$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-1 1-16 23:06:14$11 * @version $Revision: 1.85 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-12-14 00:47:27 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 652 652 return -1; 653 653 } 654 if (region.x1 > mask->numCols || region.y1 > mask->numRows) { 655 psError(PS_ERR_BAD_PARAMETER_SIZE, true, 656 "psRegion input is outside of image boundary\n"); 657 return -1; 658 } 659 if (region.x0 <= 0 || region.x1 <= 0 || region.y0 <= 0 || region.y1 <= 0) { 660 region = psRegionForImage(mask, region); 661 } 662 if (region.x0 > region.x1 || region.y0 > region.y1) { 663 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 664 "Invalid region. Lower boundary greater than upper boundary.\n"); 665 return -1; 666 } 654 655 // this is not a valid error: a psRegion with ranges outside the valid pixels 656 // should saturate on the valid pixels, not result in an error (per SDRS) 657 // if (region.x1 > mask->numCols || region.y1 > mask->numRows) { 658 // psError(PS_ERR_BAD_PARAMETER_SIZE, true, 659 // "psRegion input is outside of image boundary\n"); 660 // return -1; 661 // } 662 // if (region.x0 <= 0 || region.x1 <= 0 || region.y0 <= 0 || region.y1 <= 0) { 663 // region = psRegionForImage(mask, region); 664 // } 665 // not a valid error: if region coordinates are out of order, they should be flipped 666 // if (region.x0 > region.x1 || region.y0 > region.y1) { 667 // psError(PS_ERR_BAD_PARAMETER_VALUE, true, 668 // "Invalid region. Lower boundary greater than upper boundary.\n"); 669 // return -1; 670 // } 671 672 // rationalize the region 673 region = psRegionForImage(mask, region); 674 667 675 if (region.x0 == region.x1 || region.y0 == region.y1) { 668 676 psError(PS_ERR_BAD_PARAMETER_SIZE, true, … … 686 694 case PS_TYPE_U8: 687 695 case PS_TYPE_U16: 688 for (long i = x0; i < x1; i++) {689 for (long j = y0; j < y1; j++) {690 if (mask->data.PS_TYPE_MASK_DATA[ i][j] & value) {696 for (long j = y0; j < y1; j++) { 697 for (long i = x0; i < x1; i++) { 698 if (mask->data.PS_TYPE_MASK_DATA[j][i] & value) { 691 699 Npixels ++; 692 700 }
Note:
See TracChangeset
for help on using the changeset viewer.
