IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 13, 2006, 4:22:55 PM (20 years ago)
Author:
drobbin
Message:

Changed psImageSet to coincide with new stipulations concerning sub-images.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/mathtypes/psImage.c

    r6331 r6574  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.95 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2006-02-06 22:19:28 $
     11 *  @version $Revision: 1.96 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2006-03-14 02:22:55 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    291291                double complex value)
    292292{
    293     if (image == NULL) {
    294         psError(PS_ERR_BAD_PARAMETER_NULL, true, PS_ERRORTEXT_psImage_IMAGE_NULL);
     293    /*    if (image == NULL) {
     294            psError(PS_ERR_BAD_PARAMETER_NULL, true, PS_ERRORTEXT_psImage_IMAGE_NULL);
     295            return false;
     296        }
     297        if (x >= image->numRows || y >= image->numCols) {
     298            psError(PS_ERR_BAD_PARAMETER_SIZE, true,
     299                "Invalid position %d.  Position out of range (%d-%d)\n", x, );
     300            return false;
     301        }
     302     
     303        if(x < 0)
     304            x += image->numRows;
     305        if(x < 0) {
     306            psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid x.  Negative number too large\n");
     307            return false;
     308        }
     309     
     310        if(y < 0)
     311            y += image->numCols;
     312        if(y < 0) {
     313            psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid y.  Negative number too large\n");
     314            return false;
     315        }
     316     
     317    */
     318    PS_ASSERT_IMAGE_NON_NULL(image, false);
     319    PS_ASSERT_INT_NONNEGATIVE(image->col0, false);
     320    PS_ASSERT_INT_NONNEGATIVE(image->row0, false);
     321    PS_ASSERT_INT_NONNEGATIVE(image->numCols, false);
     322    PS_ASSERT_INT_NONNEGATIVE(image->numRows, false);
     323    if ( x >= (image->col0 + image->numCols) ) {
     324        psError(PS_ERR_BAD_PARAMETER_SIZE, true,
     325                "Invalid x-position %d.  Position out of range (%d-%d)\n",
     326                x, image->col0, image->numCols+image->col0-1 );
    295327        return false;
    296     }
    297     if (x >= image->numRows || y >= image->numCols) {
    298         psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid position.  Position too large\n");
     328    } else if ( y >= (image->row0 + image->numRows) ) {
     329        psError(PS_ERR_BAD_PARAMETER_SIZE, true,
     330                "Invalid y-position %d.  Position out of range (%d-%d)\n",
     331                y, image->row0, image->numRows+image->row0-1 );
    299332        return false;
    300     }
    301 
    302     if(x < 0)
    303         x += image->numRows;
    304     if(x < 0) {
    305         psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid x.  Negative number too large\n");
     333    } else if (x < image->col0 && x >= 0) {
     334        psError(PS_ERR_BAD_PARAMETER_SIZE, true,
     335                "Invalid x-position %d.  Position out of range (%d-%d)\n",
     336                x, image->col0, image->numCols+image->col0-1 );
    306337        return false;
    307     }
    308 
    309     if(y < 0)
    310         y += image->numCols;
    311     if(y < 0) {
    312         psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid y.  Negative number too large\n");
     338    } else if (y < image->row0 && y >= 0) {
     339        psError(PS_ERR_BAD_PARAMETER_SIZE, true,
     340                "Invalid y-position %d.  Position out of range (%d-%d)\n",
     341                y, image->row0, image->numRows+image->row0-1 );
    313342        return false;
     343    } else if (x < 0 || y < 0) {
     344        if (x < 0) {
     345            x += image->numCols;
     346        }
     347        if (x < 0) {
     348            psError(PS_ERR_BAD_PARAMETER_SIZE, true,
     349                    "Invalid x-position %d.  Position out of range (%d-%d)\n",
     350                    (x+image->col0), image->col0, image->numCols+image->col0-1 );
     351            return false;
     352        }
     353        if (y < 0) {
     354            y += image->numRows;
     355        }
     356        if (y < 0) {
     357            psError(PS_ERR_BAD_PARAMETER_SIZE, true,
     358                    "Invalid y-position %d.  Position out of range (%d-%d)\n",
     359                    (y+image->row0), image->row0, image->numRows+image->row0-1 );
     360            return false;
     361        }
     362    } else {
     363        x -= image->col0;
     364        y -= image->row0;
    314365    }
    315366
Note: See TracChangeset for help on using the changeset viewer.