IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 6, 2006, 12:55:18 PM (20 years ago)
Author:
drobbin
Message:

Made changes concerning subimage issue and testing of changes.

File:
1 edited

Legend:

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

    r6805 r6806  
    88 *  @author Robert DeSonia, MHPCC
    99 *
    10  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2006-04-06 04:12:27 $
     10 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2006-04-06 22:55:18 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    334334    }
    335335
     336    //If [0,0,0,0] specified, the whole image is to be included
     337    if (row0 == 0 && col0 == 0 && row1 == 0 && col1 == 0) {
     338        row0 = input->row0;
     339        col0 = input->col0;
     340        row1 = input->row0 + input->numRows - 1;
     341        col1 = input->col0 + input->numCols - 1;
     342    }
     343
    336344    //Make sure x0 of region is inside image.  If so, set col0 to corresponding index number.
    337345    if (col0 >= input->col0 && col0 < (input->col0 + input->numCols) ) {
     
    341349                "Specified psRegion parameter, x0=%f, is out of range [%d,%d].\n",
    342350                region.x0, input->col0, input->col0+input->numCols-1);
     351        psFree(out);
    343352        return NULL;
    344353    }
     
    350359                "Specified psRegion parameter, y0=%f, is out of range [%d,%d].\n",
    351360                region.y0, input->row0, input->row0+input->numRows-1);
    352         return NULL;
    353     }
    354 
    355     //If [0,0,0,0] specified, the whole image is to be included
    356     if (row0 == 0 && col0 == 0 && row1 == 0 && col1 == 0) {
    357         row0 = input->row0;
    358         col0 = input->col0;
    359         row1 = input->row0 + input->numRows;
    360         col1 = input->col0 + input->numCols;
     361        psFree(out);
     362        return NULL;
    361363    }
    362364
     
    368370                    "Specified psRegion parameter, x1=%f=%d, is out of range [%d,%d].\n",
    369371                    region.x1, col1+input->col0, input->col0, input->col0+input->numCols-1);
     372            psFree(out);
    370373            return NULL;
    371374        }
     
    376379                "Specified psRegion parameter, x1=%f=%d, is out of range [%d,%d].\n",
    377380                region.x1, col1, input->col0, input->col0+input->numCols-1);
     381        psFree(out);
    378382        return NULL;
    379383    }
     
    385389                    "Specified psRegion parameter, y1=%f=%d, is out of range [%d,%d].\n",
    386390                    region.y1, row1+input->row0, input->row0, input->row0+input->numRows-1);
     391            psFree(out);
    387392            return NULL;
    388393        }
     
    393398                "Specified psRegion parameter, y1=%f=%d, is out of range [%d,%d].\n",
    394399                region.y1, row1, input->row0, input->row0+input->numRows-1);
     400        psFree(out);
    395401        return NULL;
    396402    }
     
    406412                    region.y0, row0, region.y1, row1);
    407413        }
     414        psFree(out);
    408415        return NULL;
    409416    } else if (col0 == col1 && row0 == row1) {
    410417        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    411418                "Invalid psRegion specified.  Region contains only 1 pixel.\n");
     419        psFree(out);
    412420        return NULL;
    413421    }
     
    679687        row0 = input->row0;
    680688        col0 = input->col0;
    681         row1 = input->row0 + input->numRows;
    682         col1 = input->col0 + input->numCols;
     689        row1 = input->row0 + input->numRows - 1;
     690        col1 = input->col0 + input->numCols - 1;
    683691    }
    684692
Note: See TracChangeset for help on using the changeset viewer.