IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5595


Ignore:
Timestamp:
Nov 25, 2005, 1:24:49 PM (21 years ago)
Author:
magnier
Message:

fixed up psImageCountPixelMask, uses psRegionForImage more agressively, fixed bug in indexes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_rel8_b2/psLib/src/imageops/psImageStats.c

    r5558 r5595  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.83.4.1 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-11-16 22:50:22 $
     11 *  @version $Revision: 1.83.4.1.4.1 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-11-25 23:24:49 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    652652        return -1;
    653653    }
    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    // rationalize the region
     656    region = psRegionForImage(mask, region);
     657
     658    // XXX EAM : should this really be an error, or simply return 0?
    667659    if (region.x0 == region.x1 || region.y0 == region.y1) {
    668660        psError(PS_ERR_BAD_PARAMETER_SIZE, true,
     
    686678    case PS_TYPE_U8:
    687679    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) {
     680        for (long j = y0; j < y1; j++) {
     681            for (long i = x0; i < x1; i++) {
     682                if (mask->data.PS_TYPE_MASK_DATA[j][i] & value) {
    691683                    Npixels ++;
    692684                }
Note: See TracChangeset for help on using the changeset viewer.