IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1918


Ignore:
Timestamp:
Sep 27, 2004, 4:27:58 PM (22 years ago)
Author:
desonia
Message:

Changed psImageSubset to match the specification in SDR-07.

Location:
trunk/psLib/src/image
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/image/psImageErrors.dat

    r1897 r1918  
    1313psImage_IMAGE_TYPE_UNSUPPORTED         Specified psImage type, %s, is not supported.
    1414psImage_INTERPOLATE_METHOD_INVALID     Specified interpolation method (%d) is not supported.
    15 psImage_SUBSET_RANGE_INVALID           Specified subset range, [%d:%d,%d:%d], lies outside psImage's boundaries, [0:%d,0:%d].
     15psImage_SUBSET_RANGE_INVALID           Specified subset range, [%d:%d,%d:%d], is invalid or outside input psImage's boundaries, [0:%d,0:%d].
    1616psImage_SUBSECTION_NULL                Specified subsection string can not be NULL.
    1717psImage_SUBSECTION_INVALID             Specified subsection string, '%s', can not be parsed.  Must be in the form '[x1:x2,y1:y2]'.
  • trunk/psLib/src/image/psImageErrors.h

    r1897 r1918  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-09-25 02:06:12 $
     9 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-09-28 02:27:58 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3535#define PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED "Specified psImage type, %s, is not supported."
    3636#define PS_ERRORTEXT_psImage_INTERPOLATE_METHOD_INVALID "Specified interpolation method (%d) is not supported."
    37 #define PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID "Specified subset range, [%d:%d,%d:%d], lies outside psImage's boundaries, [0:%d,0:%d]."
     37#define PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID "Specified subset range, [%d:%d,%d:%d], is invalid or outside input psImage's boundaries, [0:%d,0:%d]."
    3838#define PS_ERRORTEXT_psImage_SUBSECTION_NULL "Specified subsection string can not be NULL."
    3939#define PS_ERRORTEXT_psImage_SUBSECTION_INVALID "Specified subsection string, '%s', can not be parsed.  Must be in the form '[x1:x2,y1:y2]'."
  • trunk/psLib/src/image/psImageExtraction.c

    r1897 r1918  
    1010*  @author Robert DeSonia, MHPCC
    1111*
    12 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-09-25 02:06:12 $
     12*  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-09-28 02:27:58 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2626
    2727psImage* psImageSubset(psImage* image,
    28                        unsigned int numCols,
    29                        unsigned int numRows,
    30                        unsigned int col0,
    31                        unsigned int row0)
     28                       int col0,
     29                       int row0,
     30                       int col1,
     31                       int row1)
    3232{
    3333    psImage* out;
     
    4949    }
    5050
    51     if (numCols < 1 || numRows < 1) {
    52         psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSubset",
    53                    PS_ERR_BAD_PARAMETER_VALUE, true,
    54                    PS_ERRORTEXT_psImage_AREA_NEGATIVE,
    55                    numCols,numRows);
    56         return NULL;
    57     }
    58 
    59     if ( col0 >= image->numCols ||
     51    if (col1 < 1) {
     52        col1 = image->numCols + col1;
     53    }
     54    if (row1 < 1) {
     55        row1 = image->numRows + row1;
     56    }
     57
     58    if (    col1 <= col0 ||
     59            row1 <= row0 ||
     60            col0 >= image->numCols ||
    6061            row0 >= image->numRows ||
    61             col0 + numCols >= image->numCols ||
    62             row0 + numRows >= image->numRows ) {
     62            col1 > image->numCols ||
     63            row1 > image->numRows ) {
    6364        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageSubset",
    6465                   PS_ERR_BAD_PARAMETER_VALUE, true,
    6566                   PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID,
    66                    col0, col0 + numCols, row0, row0 + numRows,
     67                   col0, col1, row0, row1,
    6768                   image->numCols, image->numRows);
    6869        return NULL;
    6970    }
     71    int numRows = row1-row0;
     72    int numCols = col1-row0;
    7073
    7174    elementSize = PSELEMTYPE_SIZEOF(image->type.type);
     
    123126        return NULL;
    124127    }
    125     return psImageSubset(image,x2-x1+1,y2-y1+1,x1,y1);
     128    return psImageSubset(image,x1,y1,x2,y2);
    126129}
    127130
  • trunk/psLib/src/image/psImageExtraction.h

    r1897 r1918  
    1010*  @author Robert DeSonia, MHPCC
    1111*
    12 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-09-25 02:06:12 $
     12*  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-09-28 02:27:58 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3737/** Create a subimage of the specified area.
    3838 *
    39  * Uses psLib memory allocation functions to create an image based on a larger
    40  * one.
     39 *  Extracts a subimage starting at (col0,row0) to (col1-1,row1-1).  Note:
     40 *  the column col1 and row row1 are NOT included in the resulting subimage.
     41 *  In the event that x1 or y1 are non-positive, they shall be interpreted as
     42 *  being relative to the size of the parent image in that dimension.
    4143 *
    42  * @return psImage* : Pointer to psImage.
     44 *  If the entire specified subimage is not contained within the parent
     45 *  image, an error results and the return value will be NULL.
     46 *
     47 *  The resulting psImage does not create a copy of the underlying image
     48 *  data.  Future changes in the parent may be reflecting in the child
     49 *  subimage and vis versa.
     50 *
     51 *  @return psImage* : Pointer to psImage.
    4352 *
    4453 */
    4554psImage* psImageSubset(
    4655    psImage* image,                    ///< Parent image.
    47     unsigned int numCols,              ///< Subimage width (<= image.nCols - col0).
    48     unsigned int numRows,              ///< Subimage height (<= image.nRows - row0).
    49     unsigned int col0,                 ///< Subimage col-offset (0 <= col0 < nCol).
    50     unsigned int row0                  ///< Subimage row-offset (0 <= row0 < nCol).
     56    int col0,                          ///< starting column of subimage
     57    int row0,                          ///< starting row of subimage
     58    int col1,                          ///< exclusive end column of subimage.
     59    int row1                           ///< exclusive end row of subimage
    5160);
    5261
Note: See TracChangeset for help on using the changeset viewer.