IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 4, 2006, 3:49:41 PM (20 years ago)
Author:
drobbin
Message:

Edited functions wrt subimage v parent image issue.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/imageops/psImagePixelExtract.c

    r6770 r6778  
    88 *  @author Robert DeSonia, MHPCC
    99 *
    10  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2006-04-04 22:04:45 $
     10 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2006-04-05 01:49:40 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    333333        return NULL;
    334334    }
    335     /*
    336         if (col1 < 1) {
    337             col1 += input->numCols;
    338         }
    339 
    340         if (row1 < 1) {
    341             row1 += input->numRows;
    342         }
    343 
    344         if (    col0 < 0 ||
    345                 row0 < 0 ||
    346                 col1 > input->numCols ||
    347                 row1 > input->numRows ||
    348                 col0 >= col1 ||
    349                 row0 >= row1) {
    350             psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    351                     PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID,
    352                     col0, col1, row0, row1,
    353                     input->numCols, input->numRows);
    354             psFree(out);
    355             return NULL;
    356         }
    357     */
     335
    358336    //Make sure x0 of region is inside image.  If so, set col0 to corresponding index number.
    359337    if (col0 >= input->col0 && col0 < (input->col0 + input->numCols) ) {
     
    709687        return NULL;
    710688    }
    711     /*
    712         //Make sure x1 of region is valid.  If negative, index from tail (if valid).
    713         if (col1 < 0) {
    714             col1 += input->numCols;
    715             if (col1 < 0) {
    716                 psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    717                         "Specified psRegion parameter, x1=%f=%f, is out of range [%d,%d].\n",
    718                         region.x1, col1+input->col0, input->col0, input->col0+input->numCols);
    719                 psFree(out);
    720                 return NULL;
    721             }
    722         } else if (col1 >= input->col0 && col1 < (input->col0 + input->numCols) ) {
    723             col1 -= input->col0;
    724         } else {
    725             psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    726                     "Specified psRegion parameter, x1=%f=%f, is out of range [%d,%d].\n",
    727                     region.x1, col1, input->col0, input->col0+input->numCols);
    728             psFree(out);
    729             return NULL;
    730         }
    731         //Make sure y1 of region is valid.  If negative, index from tail (if valid).
    732         if (row1 < 0) {
    733             row1 += input->numRows;
    734             if (row1 < 0) {
    735                 psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    736                         "Specified psRegion parameter, y1=%f=%f, is out of range [%d,%d].\n",
    737                         region.y1, row1+input->row0, input->row0, input->row0+input->numRows);
    738                 psFree(out);
    739                 return NULL;
    740             }
    741         } else if (row1 >= input->row0 && row1 < (input->row0 + input->numRows) ) {
    742             row1 -= input->row0;
    743         } else {
    744             psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    745                     "Specified psRegion parameter, y1=%f=%f, is out of range [%d,%d].\n",
    746                     region.y1, row1, input->row0, input->row0+input->numRows);
    747             psFree(out);
    748             return NULL;
    749         }
    750     */
    751     /*    //Now make sure that the region makes sense.
    752         if (col0 > col1 || row0 > row1) {
    753             if (col0 > col1) {
    754                 psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    755                         "Invalid psRegion specified.  x0=%f=%f is greater than x1=%f=%f.\n",
    756                         region.x0, col0, region.x1, col1);
    757             } else {
    758                 psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    759                         "Invalid psRegion specified.  y0=%f=%f is greater than y1=%f=%f.\n",
    760                         region.y0, row0, region.y1, row1);
    761             }
    762             psFree(out);
    763             return NULL;
    764         } else if (col0 == col1 && row0 == row1) {
    765             psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    766                     "Invalid psRegion specified.  Region contains only 1 pixel.\n");
    767             psFree(out);
    768             return NULL;
    769         }
    770     */
    771689    if (col1 < 0 || row1 < 0 || col0 < 0 || row0 < 0 || col0 >= numCols || col1 >= numCols ||
    772690            row0 >= numRows || row1 >= numRows) {
     
    778696    float endCol = col1;
    779697    float endRow = row1;
    780     /*
    781         float startCol = region.x0;
    782         float startRow = region.y0;
    783         float endCol = region.x1;
    784         float endRow = region.y1;
    785         if (startCol < 0 || startCol >= numCols ||
    786                 startRow < 0 || startRow >= numRows ||
    787                 endCol < 0 || endCol >= numCols ||
    788                 endRow < 0 || endRow >= numRows) {
    789             psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    790                     PS_ERRORTEXT_psImage_LINE_NOT_IN_IMAGE,
    791                     startCol,startRow,endCol,endRow,
    792                     numCols-1,numRows-1);
    793             psFree(out);
    794             return NULL;
    795         }
    796     */
    797698
    798699    if (mode < PS_INTERPOLATE_FLAT ) {
Note: See TracChangeset for help on using the changeset viewer.