IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5732


Ignore:
Timestamp:
Dec 7, 2005, 10:45:27 AM (20 years ago)
Author:
magnier
Message:

fixed row,column transpose
removed excessive restrictions on psRegion

File:
1 edited

Legend:

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

    r5530 r5732  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.84 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-11-16 23:06:14 $
     11 *  @version $Revision: 1.84.4.1 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-12-07 20:45:27 $
    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    // 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
    667675    if (region.x0 == region.x1 || region.y0 == region.y1) {
    668676        psError(PS_ERR_BAD_PARAMETER_SIZE, true,
     
    686694    case PS_TYPE_U8:
    687695    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) {
    691699                    Npixels ++;
    692700                }
Note: See TracChangeset for help on using the changeset viewer.