IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 24, 2006, 12:55:05 PM (20 years ago)
Author:
Paul Price
Message:

Following today's meeting, we agreed that psVectorAlloc (and therefore
psArrayAlloc also) shall set the number of elements in use to equal the
number of elements allocated. We introduce new functions,
psVectorAllocEmpty and psArrayAllocEmpty, that allocate a vector and set
the length to zero.

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

Legend:

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

    r8978 r9730  
    3636    int Npixels = nx*ny;                // Total number of pixels
    3737
    38     psVector *values = psVectorAlloc(Nsubset, PS_TYPE_F32); // Vector containing subsample
     38    psVector *values = psVectorAllocEmpty(Nsubset, PS_TYPE_F32); // Vector containing subsample
    3939
    4040    // Minimum and maximum values
  • trunk/psLib/src/imageops/psImageConvolve.c

    r9538 r9730  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2006-10-13 21:13:48 $
     7 *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2006-10-24 22:52:55 $
    99 *
    1010 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    505505        /* generate normalized gaussian */ \
    506506        psVector *gaussnorm = psVectorAlloc(Npixel, PS_TYPE_##TYPE); \
    507         gaussnorm->n = gaussnorm->nalloc; \
    508507        { \
    509508            double sum = 0.0; \
     
    522521        { \
    523522            psVector *calculation = psVectorAlloc(Nx, PS_TYPE_##TYPE); \
    524             calculation->n = calculation->nalloc; \
    525523            for (int j = 0; j < Ny; j++) { \
    526524                ps##TYPE *vi = image->data.TYPE[j]; \
     
    573571        /* Smooth in Y direction */ \
    574572        psArray *rows = psArrayAlloc(Nrange); \
    575         rows->n = Nrange; \
    576573        /* Smooth the first Nrange pixels, with renorm */ \
    577574        int yMax = PS_MIN(Nrange, Ny); \
     
    579576        for (int j = 0; j < yMax; j++) { \
    580577            psVector *calculation = psVectorAlloc(Nx, PS_TYPE_##TYPE); \
    581             calculation->n = calculation->nalloc; \
    582578            /* Zero the output row */ \
    583579            memset(calculation->data.TYPE, 0, Nx*sizeof(ps##TYPE)); \
  • trunk/psLib/src/imageops/psImageGeomManip.c

    r8232 r9730  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2006-08-08 23:32:23 $
     12 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2006-10-24 22:52:55 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8080    }
    8181
    82     vec = psVectorAlloc(scale * scale, in->type.type);
     82    vec = psVectorAllocEmpty(scale * scale, in->type.type);
    8383
    8484    if (mask != NULL) {
     
    9393            return NULL;
    9494        }
    95         maskVec = psVectorAlloc(scale * scale, PS_TYPE_MASK);
    96         maskVec->n = maskVec->nalloc;
     95        maskVec = psVectorAllocEmpty(scale * scale, PS_TYPE_MASK);
    9796        maskData = maskVec->data.PS_TYPE_MASK_DATA;
    9897    }
     
    134133                } \
    135134                vec->n = n; \
     135                maskVec->n = n; \
    136136                myStats = psVectorStats(myStats, vec, NULL, maskVec, maskVal); \
    137137                outRowData[col] = (ps##TYPE)psStatsGetValue(myStats, statistic); \
  • trunk/psLib/src/imageops/psImagePixelExtract.c

    r8627 r9730  
    88 *  @author Robert DeSonia, MHPCC
    99 *
    10  *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2006-08-26 04:34:28 $
     10 *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2006-10-24 22:52:55 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    1818
    1919#include "psMemory.h"
     20#include "psVector.h"
    2021#include "psImagePixelExtract.h"
    2122#include "psError.h"
     
    392393    if (direction == PS_CUT_X_POS || direction == PS_CUT_X_NEG) {
    393394        psVector* imgVec = psVectorAlloc(numRows, type);
    394         imgVec->n = imgVec->nalloc;
    395395        psVector* maskVec = NULL;
    396396        psMaskType* maskData = NULL;
     
    417417        if (mask != NULL) {
    418418            maskVec = psVectorAlloc(numRows, mask->type.type);
    419             maskVec->n = maskVec->nalloc;
    420419        }
    421420        #define PSIMAGE_CUT_VERTICAL(TYPE) \
     
    855854        // n.b. alloc enough for the data by making the vectors slightly larger
    856855        // than the area of the region of interest.
    857         buffer[lcv] = psVectorAlloc(1+4*(rSq[lcv+1]-rSq[lcv]),
    858                                     input->type.type);
    859         buffer[lcv]->n = 0;
     856        buffer[lcv] = psVectorAllocEmpty(1+4*(rSq[lcv+1]-rSq[lcv]),
     857                                         input->type.type);
    860858
    861859        bufferMask[lcv] = NULL;
    862860        if (mask != NULL) {
    863             bufferMask[lcv] = psVectorAlloc(1+4*(rSq[lcv+1]-rSq[lcv]),
    864                                             PS_TYPE_MASK);
    865             bufferMask[lcv]->n = 0;
     861            bufferMask[lcv] = psVectorAllocEmpty(1+4*(rSq[lcv+1]-rSq[lcv]),
     862                                                 PS_TYPE_MASK);
    866863        }
    867864    }
  • trunk/psLib/src/imageops/psImageStats.c

    r8627 r9730  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.100 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2006-08-26 04:34:28 $
     11 *  @version $Revision: 1.101 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2006-10-24 22:52:55 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    7676
    7777        junkData = psVectorAlloc(numRows*numCols, in->type.type);
    78         junkData->n = junkData->nalloc;
    7978
    8079        psU8* data = junkData->data.U8;
     
    10099
    101100            junkMask = psVectorAlloc(numRows*numCols, mask->type.type);
    102             junkMask->n = junkMask->nalloc;
    103101
    104102            psU8* data = junkMask->data.U8;
     
    149147
    150148        junkData = psVectorAlloc(numRows*numCols, in->type.type);
    151         junkData->n = junkData->nalloc;
    152149
    153150        psU8* data = junkData->data.U8;
     
    173170
    174171            junkMask = psVectorAlloc(numRows*numCols, mask->type.type);
    175             junkMask->n = junkMask->nalloc;
    176172
    177173            psU8* data = junkMask->data.U8;
     
    592588        return -1;
    593589    }/* else if (col0 == col1 && row0 == row1) {
    594                                                 psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    595                                                         "Invalid psRegion specified.  Region contains only 1 pixel.\n");
    596                                                 return -1;
    597                                             }
    598                                         */
     590                                                    psError(PS_ERR_BAD_PARAMETER_VALUE, true,
     591                                                            "Invalid psRegion specified.  Region contains only 1 pixel.\n");
     592                                                    return -1;
     593                                                }
     594                                            */
    599595    x0 = col0;
    600596    x1 = col1;
Note: See TracChangeset for help on using the changeset viewer.