IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 26, 2004, 2:57:34 PM (22 years ago)
Author:
desonia
Message:

converted native C types to ps Types, where practical.

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

Legend:

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

    r1983 r2204  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-10-06 21:31:30 $
     7 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-10-27 00:57:31 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2828static void freeKernel(psKernel* ptr);
    2929
    30 psKernel* psKernelAlloc(int xMin, int xMax, int yMin, int yMax)
     30psKernel* psKernelAlloc(psS32 xMin, psS32 xMax, psS32 yMin, psS32 yMax)
    3131{
    3232    psKernel* result;
    33     int numRows;
    34     int numCols;
     33    psS32 numRows;
     34    psS32 numCols;
    3535
    3636    // following is explicitly spelled out in the SDRS as a requirement
     
    4040                 yMin, yMax);
    4141
    42         int temp = yMin;
     42        psS32 temp = yMin;
    4343        yMin = yMax;
    4444        yMax = temp;
     
    5151                 xMin, xMax);
    5252
    53         int temp = xMin;
     53        psS32 temp = xMin;
    5454        xMin = xMax;
    5555        xMax = temp;
     
    7070    psKernelType** kernelRows = result->p_kernelRows;
    7171    psKernelType** imageRows = result->image->data.PS_TYPE_KERNEL_DATA;
    72     for (int i = 0; i < numRows; i++) {
     72    for (psS32 i = 0; i < numRows; i++) {
    7373        kernelRows[i] = imageRows[i] - xMin;
    7474    }
     
    9191                           const psVector* xShifts,
    9292                           const psVector* yShifts,
    93                            bool relative)
     93                           psBool relative)
    9494{
    95     int x = 0;
    96     int y = 0;
    97     int t = 0;
    98     int deltaT;
    99     int oldX;
    100     int oldY;
    101     int xMin = 0;
    102     int xMax = 0;
    103     int yMin = 0;
    104     int yMax = 0;
    105     int length = 0;
     95    psS32 x = 0;
     96    psS32 y = 0;
     97    psS32 t = 0;
     98    psS32 deltaT;
     99    psS32 oldX;
     100    psS32 oldY;
     101    psS32 xMin = 0;
     102    psS32 xMax = 0;
     103    psS32 yMin = 0;
     104    psS32 yMax = 0;
     105    psS32 length = 0;
    106106    psKernelType normalizeTime = 1.0;  // fraction of total time for each shift clock
    107107    psKernel* result = NULL;
     
    153153        y = 0; \
    154154        t = 0; \
    155         for (int lcv = 0; lcv < length; lcv++) { \
     155        for (psS32 lcv = 0; lcv < length; lcv++) { \
    156156            if (relative) { \
    157157                x += xShiftData[lcv]; \
     
    181181        y = 0; \
    182182        t = 0; \
    183         for (int i = 0; i < length; i++) { \
     183        for (psS32 i = 0; i < length; i++) { \
    184184            deltaT = t; \
    185185            oldX = x; \
     
    228228}
    229229
    230 psImage* psImageConvolve(psImage* out, const psImage* in, const psKernel* kernel, bool direct)
     230psImage* psImageConvolve(psImage* out, const psImage* in, const psKernel* kernel, psBool direct)
    231231{
    232232    if (in == NULL) {
     
    242242        return NULL;
    243243    }
    244     int xMin = kernel->xMin;
    245     int xMax = kernel->xMax;
    246     int yMin = kernel->yMin;
    247     int yMax = kernel->yMax;
     244    psS32 xMin = kernel->xMin;
     245    psS32 xMax = kernel->xMax;
     246    psS32 yMin = kernel->yMin;
     247    psS32 yMax = kernel->yMax;
    248248    psKernelType** kData = kernel->kernel;
    249249
    250250    // make the output image to the proper size and type
    251     int numRows = in->numRows;
    252     int numCols = in->numCols;
     251    psS32 numRows = in->numRows;
     252    psS32 numCols = in->numCols;
    253253
    254254
     
    261261            ps##TYPE** inData = in->data.TYPE; \
    262262            out = psImageRecycle(out, numCols, numRows, PS_TYPE_##TYPE); \
    263             for (int row=0;row<numRows;row++) { \
     263            for (psS32 row=0;row<numRows;row++) { \
    264264                ps##TYPE* outRow = out->data.TYPE[row]; \
    265                 for (int col=0;col<numCols;col++) { \
     265                for (psS32 col=0;col<numCols;col++) { \
    266266                    ps##TYPE pixel = 0.0; \
    267                     for (int kRow = yMin; kRow < yMax; kRow++) { \
     267                    for (psS32 kRow = yMin; kRow < yMax; kRow++) { \
    268268                        if (row-kRow >= 0 && row-kRow < numRows) { \
    269                             for (int kCol = xMin; kCol < xMax; kCol++) { \
     269                            for (psS32 kCol = xMin; kCol < xMax; kCol++) { \
    270270                                if (col-kCol >= 0 && col-kCol < numCols) { \
    271271                                    pixel += kData[kRow][kCol] * inData[row-kRow][col-kCol]; \
     
    310310    } else {
    311311        // fourier convolution
    312         int paddedCols = numCols+2*FOURIER_PADDING;
    313         int paddedRows = numRows+2*FOURIER_PADDING;
     312        psS32 paddedCols = numCols+2*FOURIER_PADDING;
     313        psS32 paddedRows = numRows+2*FOURIER_PADDING;
    314314
    315315        // check to see if kernel is smaller, otherwise padding it up will fail.
    316         int kRows = kernel->image->numRows;
    317         int kCols = kernel->image->numCols;
     316        psS32 kRows = kernel->image->numRows;
     317        psS32 kCols = kernel->image->numCols;
    318318        if (kRows >= numRows || kCols >= numCols) {
    319319            psErrorMsg(PS_ERRORNAME_DOMAIN "psImageConvolve",
     
    328328        // pad the image
    329329        psImage* paddedImage = psImageAlloc(paddedCols,paddedRows,in->type.type);
    330         int elementSize = PSELEMTYPE_SIZEOF(in->type.type);
     330        psS32 elementSize = PSELEMTYPE_SIZEOF(in->type.type);
    331331
    332332        // zero out padded area on top and bottom
     
    335335
    336336        // fill in the image-containing rows.
    337         int sidePaddingSize = FOURIER_PADDING*elementSize;
    338         int imageRowSize = numCols*elementSize;
     337        psS32 sidePaddingSize = FOURIER_PADDING*elementSize;
     338        psS32 imageRowSize = numCols*elementSize;
    339339        psU8* paddedData = paddedImage->data.U8[FOURIER_PADDING];
    340         for (int row=0;row<numRows;row++) {
     340        for (psS32 row=0;row<numRows;row++) {
    341341            // zero out padded area on left edge.
    342342            memset(paddedData,0,sidePaddingSize);
     
    354354        psImage* paddedKernel = psImageAlloc(paddedCols,paddedRows,PS_TYPE_KERNEL);
    355355        memset(paddedKernel->data.U8[0],0,sizeof(psKernelType)*numCols*numRows); // zero-out image
    356         int yMax = kernel->yMax;
    357         int xMax = kernel->xMax;
    358         for (int row = kernel->yMin; row <= yMax;row++) {
    359             int padRow = row;
     356        psS32 yMax = kernel->yMax;
     357        psS32 xMax = kernel->xMax;
     358        for (psS32 row = kernel->yMin; row <= yMax;row++) {
     359            psS32 padRow = row;
    360360            if (padRow < 0) {
    361361                padRow += paddedRows;
     
    363363            psKernelType* padData = paddedKernel->data.PS_TYPE_KERNEL_DATA[padRow];
    364364            psKernelType* kernelRow = kernel->kernel[row];
    365             for (int col = kernel->xMin; col <= xMax; col++) {
     365            for (psS32 col = kernel->xMin; col <= xMax; col++) {
    366366                if (col < 0) {
    367367                    padData[col+paddedCols] = kernelRow[col];
     
    418418        out = psImageRecycle(out,numCols,numRows,PS_TYPE_F32);
    419419        float factor = 1.0f/numCols/numRows;
    420         for (int row = 0; row < numRows; row++) {
     420        for (psS32 row = 0; row < numRows; row++) {
    421421            psF32* outRow = out->data.F32[row];
    422422            psC32* resultRow = complexOutSansPad->data.C32[row];
    423             for (int col = 0; col < numCols; col++) {
     423            for (psS32 col = 0; col < numCols; col++) {
    424424                outRow[col] = crealf(resultRow[col])*factor;
    425425            }
  • trunk/psLib/src/imageops/psImageConvolve.h

    r1863 r2204  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-09-23 18:30:57 $
     9 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-10-27 00:57:31 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1515#ifndef PS_IMAGE_CONVOLVE_H
    1616#define PS_IMAGE_CONVOLVE_H
    17 
    18 #include<stdbool.h>
    1917
    2018#include "psImage.h"
     
    3230{
    3331    psImage* image;                    ///< Kernel data, in the form of an image
    34     int xMin;                          ///< Most negative x index
    35     int yMin;                          ///< Most negative y index
    36     int xMax;                          ///< Most positive x index
    37     int yMax;                          ///< Most positive y index
     32    psS32 xMin;                          ///< Most negative x index
     33    psS32 yMin;                          ///< Most negative y index
     34    psS32 xMax;                          ///< Most positive x index
     35    psS32 yMax;                          ///< Most positive y index
    3836    psKernelType** kernel;             ///< Pointer to the kernel data
    3937    psKernelType** p_kernelRows;       ///< Pointer to the rows of the kernel data; not intended for user use.
     
    6866 */
    6967psKernel* psKernelAlloc(
    70     int xMin,                          ///< Most negative x index
    71     int xMax,                          ///< Most positive x index
    72     int yMin,                          ///< Most negative y index
    73     int yMax                           ///< Most positive y index
     68    psS32 xMin,                          ///< Most negative x index
     69    psS32 xMax,                          ///< Most positive x index
     70    psS32 yMin,                          ///< Most negative y index
     71    psS32 yMax                           ///< Most positive y index
    7472);
    7573
     
    9492    const psVector* xShifts,           ///< list of x-axis shifts
    9593    const psVector* yShifts,           ///< list of y-axis shifts
    96     bool relative
     94    psBool relative
    9795);
    9896
     
    118116    const psImage* in,                 ///< the psImage to convolve
    119117    const psKernel* kernel,            ///< kernel to colvolve with
    120     bool direct                        ///< specifies method, true=direct convolution, false=fourier
     118    psBool direct                        ///< specifies method, true=direct convolution, false=fourier
    121119);
    122120
  • trunk/psLib/src/imageops/psImageStats.c

    r2102 r2204  
    99*  @author GLG, MHPCC
    1010*
    11 *  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-10-14 01:06:44 $
     11*  @version $Revision: 1.44 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-10-27 00:57:31 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4040                      psImage* in,
    4141                      psImage* mask,
    42                       int maskVal)
     42                      psS32 maskVal)
    4343{
    4444    psVector* junkData = NULL;
     
    106106                              psImage* in,
    107107                              psImage* mask,
    108                               unsigned int maskVal)
     108                              psU32 maskVal)
    109109{
    110110    psVector* junkData = NULL;
     
    150150
    151151// XXX: Why do we have this function?
    152 float *p_psCalcScaleFactorsFit(int n)
    153 {
    154     int i = 0;
     152float *p_psCalcScaleFactorsFit(psS32 n)
     153{
     154    psS32 i = 0;
    155155    float tmp = 0.0;
    156156    float *scalingFactors = (float *)psAlloc(n * sizeof(float));
     
    175175output a vector of evenly spaced floating point values between -1.0:1.0.
    176176 *****************************************************************************/
    177 float *p_psCalcScaleFactorsEval(int n)
    178 {
    179     int i = 0;
     177float *p_psCalcScaleFactorsEval(psS32 n)
     178{
     179    psS32 i = 0;
    180180    float tmp = 0.0;
    181181
     
    196196
    197197// XXX: Use a static array of CHebyshev polynomials.
    198 psPolynomial1D **p_psCreateChebyshevPolys(int maxChebyPoly)
     198psPolynomial1D **p_psCreateChebyshevPolys(psS32 maxChebyPoly)
    199199{
    200200    if (maxChebyPoly < 1) {
     
    202202    }
    203203    psPolynomial1D **chebPolys = NULL;
    204     int i = 0;
    205     int j = 0;
     204    psS32 i = 0;
     205    psS32 j = 0;
    206206
    207207    chebPolys = (psPolynomial1D **) psAlloc(maxChebyPoly * sizeof(psPolynomial1D *));
     
    245245                                     const psImage* input)
    246246{
    247     int x = 0;
    248     int y = 0;
    249     int i = 0;
    250     int j = 0;
     247    psS32 x = 0;
     248    psS32 y = 0;
     249    psS32 i = 0;
     250    psS32 j = 0;
    251251    float **sums = NULL;
    252252    psPolynomial1D* *chebPolys = NULL;
    253     int maxChebyPoly = 0;
     253    psS32 maxChebyPoly = 0;
    254254    float *cScalingFactors = NULL;
    255255    float *rScalingFactors = NULL;
     
    365365psImage* psImageEvalPolynomial(psImage* input, const psPolynomial2D* coeffs)
    366366{
    367     int x = 0;
    368     int y = 0;
    369     int i = 0;
    370     int j = 0;
     367    psS32 x = 0;
     368    psS32 y = 0;
     369    psS32 i = 0;
     370    psS32 j = 0;
    371371    //    float **sums = NULL;
    372372    psPolynomial1D* *chebPolys = NULL;
    373     int maxChebyPoly = 0;
     373    psS32 maxChebyPoly = 0;
    374374    float *cScalingFactors = NULL;
    375375    float *rScalingFactors = NULL;
  • trunk/psLib/src/imageops/psImageStats.h

    r1951 r2204  
    99*  @author George Gusciora, MHPCC
    1010*
    11 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-10-05 01:03:11 $
     11*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-10-27 00:57:31 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4040    psImage* in,                       ///< image (or subimage) to calculate stats
    4141    psImage* mask,                     ///< mask data for image (NULL ok)
    42     int maskVal                        ///< mask Mask for mask
     42    psS32 maskVal                        ///< mask Mask for mask
    4343);
    4444
     
    5555    psImage* in,                       ///< Image data to be histogramed.
    5656    psImage* mask,                     ///< mask data for image (NULL ok)
    57     unsigned int maskVal               ///< mask Mask for mask
     57    psU32 maskVal               ///< mask Mask for mask
    5858);
    5959
Note: See TracChangeset for help on using the changeset viewer.