IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 6, 2006, 5:22:07 PM (20 years ago)
Author:
Paul Price
Message:

Merging the pslib "additional" functions from the modules into psLib proper.

Added jpeg directory for psImageJpeg.
Changes to build system (configure.ac, and various Makefile.am)

psVectorSmooth: changed API to allow optional output vector
psSparse: changed sizes to type "long"; added "const"
psRegionIsBad: Renamed psRegionIsNaN
psImageBicubeFit: changed sizes to "long"; added a "const"
psLine: changed sizes to "long"
psImageUnbin: description required in SDRS
psImageClippedStats: renaming to psImageBackground; removing static structures; API changed!
psImageFlipX, psImageFlipY merged to psImageFlip
psStringSubstitute: added "const"

Location:
trunk/psLib/src/imageops
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/imageops/Makefile.am

    r7210 r7380  
    55libpslibimageops_la_CPPFLAGS = $(SRCINC)
    66libpslibimageops_la_SOURCES = \
     7        psImageBackground.c \
    78        psImageConvolve.c \
    89        psImageGeomManip.c \
     
    1112        psImageStats.c \
    1213        psImageStructManip.c \
    13     psImageMaskOps.c
     14        psImageMaskOps.c \
     15        psImageUnbin.c
    1416
    1517EXTRA_DIST = imageops.i
     
    1719pslibincludedir = $(includedir)
    1820pslibinclude_HEADERS = \
     21        psImageBackground.h \
    1922        psImageConvolve.h \
    2023        psImageGeomManip.h \
     
    2326        psImageStats.h \
    2427        psImageStructManip.h \
    25     psImageMaskOps.h
     28        psImageMaskOps.h \
     29        psImageUnbin.h
    2630
    2731CLEANFILES = *~
  • trunk/psLib/src/imageops/psImageGeomManip.c

    r6806 r7380  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2006-04-06 22:55:18 $
     12 *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2006-06-07 03:22:06 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2323#include "psImageGeomManip.h"
    2424
     25#include "psAbort.h"
    2526#include "psError.h"
    2627#include "psImage.h"
     
    878879}
    879880
     881
     882#define FLIP_X_CASE(TYPENAME,TYPE) \
     883case TYPENAME: { \
     884    long numRows = input->numRows; \
     885    long numCols = input->numCols; \
     886    for (long i = 0; i < numRows; i++) { \
     887        for (long j = 0; j < numCols; j++) { \
     888            output->data.TYPE[i][j] = input->data.TYPE[i][numCols - j - 1]; \
     889        } \
     890    } \
     891    break; \
     892}
     893
     894#define FLIP_Y_CASE(TYPENAME,TYPE) \
     895case TYPENAME: { \
     896    long numRows = input->numRows; \
     897    long numCols = input->numCols; \
     898    for (long i = 0; i < numRows; i++) { \
     899        for (long j = 0; j < numCols; j++) { \
     900            output->data.TYPE[i][j] = input->data.TYPE[numRows - i - 1][j]; \
     901        } \
     902    } \
     903    break; \
     904}
     905
     906psImage *psImageFlip(psImage *output, const psImage *input, bool xFlip, bool yFlip)
     907{
     908    PS_ASSERT_IMAGE_NON_NULL(input, NULL);
     909
     910    if (xFlip && yFlip) {
     911        // This is equivalent to a 180 degree rotation;
     912        return psImageRotate(output, input, M_PI, NAN, PS_INTERPOLATE_BILINEAR);
     913    }
     914
     915    if (!xFlip && !yFlip) {
     916        // They want something, so let's give it to them
     917        return psImageCopy(output, input, input->type.type);
     918    }
     919
     920    output = psImageRecycle(output, input->numCols, input->numRows, input->type.type);
     921
     922    if (xFlip) {
     923        switch (input->type.type) {
     924            FLIP_X_CASE(PS_TYPE_U8,  U8);
     925            FLIP_X_CASE(PS_TYPE_U16, U16);
     926            FLIP_X_CASE(PS_TYPE_U32, U32);
     927            FLIP_X_CASE(PS_TYPE_U64, U64);
     928            FLIP_X_CASE(PS_TYPE_S8,  S8);
     929            FLIP_X_CASE(PS_TYPE_S16, S16);
     930            FLIP_X_CASE(PS_TYPE_S32, S32);
     931            FLIP_X_CASE(PS_TYPE_S64, S64);
     932            FLIP_X_CASE(PS_TYPE_F32, F32);
     933            FLIP_X_CASE(PS_TYPE_F64, F64);
     934            FLIP_X_CASE(PS_TYPE_C32, C32);
     935            FLIP_X_CASE(PS_TYPE_C64, C64);
     936        default:
     937            psFree(output);
     938            psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Unknown type for input image: %x\n", input->type.type);
     939            return NULL;
     940        }
     941        return output;
     942    }
     943    if (yFlip) {
     944        switch (input->type.type) {
     945            FLIP_Y_CASE(PS_TYPE_U8,  U8);
     946            FLIP_Y_CASE(PS_TYPE_U16, U16);
     947            FLIP_Y_CASE(PS_TYPE_U32, U32);
     948            FLIP_Y_CASE(PS_TYPE_U64, U64);
     949            FLIP_Y_CASE(PS_TYPE_S8,  S8);
     950            FLIP_Y_CASE(PS_TYPE_S16, S16);
     951            FLIP_Y_CASE(PS_TYPE_S32, S32);
     952            FLIP_Y_CASE(PS_TYPE_S64, S64);
     953            FLIP_Y_CASE(PS_TYPE_F32, F32);
     954            FLIP_Y_CASE(PS_TYPE_F64, F64);
     955            FLIP_Y_CASE(PS_TYPE_C32, C32);
     956            FLIP_Y_CASE(PS_TYPE_C64, C64);
     957        default:
     958            psFree(output);
     959            psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Unknown type for input image: %x\n", input->type.type);
     960            return NULL;
     961        }
     962        return output;
     963    }
     964
     965    psAbort(__func__, "Should never get here.\n");
     966    return NULL;
     967}
  • trunk/psLib/src/imageops/psImageGeomManip.h

    r6750 r7380  
    88 *  @author Robert DeSonia, MHPCC
    99 *
    10  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2006-04-01 02:43:57 $
     10 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2006-06-07 03:22:06 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    151151    psRegion region,                   ///< the size of the transformed image
    152152    const psPixels* pixels,            /**< if not NULL, consists of psPixelCoords and specifies
    153                                             * which pixels in output image shall be transformed;
    154                                             * otherwise, entire image generated*/
     153                                                * which pixels in output image shall be transformed;
     154                                                * otherwise, entire image generated*/
    155155    psImageInterpolateMode mode,       ///< the interpolation scheme to be used
    156156    double exposedValue                ///< Exposed value to which non-corresponding pixels are set
    157157);
    158158
     159// Flip the input image
     160psImage *psImageFlip(psImage *output,   // Output image, or NULL
     161                     const psImage *input, // Input image
     162                     bool xFlip,        // Flip x axis?
     163                     bool yFlip         // Flip y axis?
     164                    );
     165
    159166#endif // #ifndef PS_IMAGE_GEOM_MANIP_H
  • trunk/psLib/src/imageops/psImagePixelManip.c

    r7123 r7380  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2006-05-16 03:27:13 $
     12 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2006-06-07 03:22:06 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    413413    return numClipped;
    414414}
    415 
Note: See TracChangeset for help on using the changeset viewer.