IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6375


Ignore:
Timestamp:
Feb 7, 2006, 7:43:56 PM (20 years ago)
Author:
magnier
Message:

adjustments to move from subimage to parent coords

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_rel9_b1/psLib/src/mathtypes/psImage.c

    r5752 r6375  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.92.4.1 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-12-07 20:55:18 $
     11 *  @version $Revision: 1.92.4.1.2.1 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2006-02-08 05:43:56 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    168168// - flip x0,x1 if x0>x1
    169169// - flip y0,y1 if y0>y1
    170 // psRegion in refers to coordinates in the
     170// XXX EAM : psRegion refers to coordinates in the *parent* image
    171171psRegion psRegionForImage(psImage *image,
    172172                          psRegion in)
     
    178178
    179179    // convert non-positive upper-limits
    180     in.x1 = (in.x1 <= 0) ? (image->numCols + in.x1) : in.x1;
    181     in.y1 = (in.y1 <= 0) ? (image->numRows + in.y1) : in.y1;
    182 
    183     // force the upper-limits to be on the image
    184     in.x1 = PS_MIN(image->numCols, in.x1);
    185     in.y1 = PS_MIN(image->numRows, in.y1);
    186 
    187     // force the lower-limits to be on the image
    188     in.x0 = PS_MAX(0, in.x0);
    189     in.y0 = PS_MAX(0, in.y0);
    190     in.x0 = PS_MIN(image->numCols, in.x0);
    191     in.y0 = PS_MIN(image->numRows, in.y0);
     180    // XXX note that the upper limit in these cases is defined relative to the subimage
     181    // also note that truncation limits to the valid subimage pixels
     182    in.x1 = (in.x1 <= 0) ? (image->col0 + image->numCols + in.x1) : in.x1;
     183    in.y1 = (in.y1 <= 0) ? (image->row0 + image->numRows + in.y1) : in.y1;
     184
     185    // force the upper-limits to be on the subimage
     186    in.x1 = PS_MIN(image->col0 + image->numCols, in.x1);
     187    in.y1 = PS_MIN(image->row0 + image->numRows, in.y1);
     188
     189    // force the lower-limits to be on the subimage
     190    in.x0 = PS_MAX(image->col0, in.x0);
     191    in.y0 = PS_MAX(image->row0, in.y0);
     192    in.x0 = PS_MIN(image->col0 + image->numCols, in.x0);
     193    in.y0 = PS_MIN(image->row0 + image->numRows, in.y0);
    192194
    193195    // flip start and end if out of order
Note: See TracChangeset for help on using the changeset viewer.