IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 22, 2005, 5:50:29 PM (21 years ago)
Author:
drobbin
Message:

changed files according to requested revisions outlined in apidelta-report-cycle6

File:
1 edited

Legend:

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

    r4206 r4367  
    88 *  @author Robert DeSonia, MHPCC
    99 *
    10  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2005-06-10 02:30:47 $
     10 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2005-06-23 03:50:29 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2424
    2525psVector* psImageSlice(psVector* out,
    26                        psVector* slicePositions,
    27                        const psImage* restrict in,
     26                       psVector* coords,
     27                       const psImage* restrict input,
    2828                       const psImage* restrict mask,
    2929                       psU32 maskVal,
     
    4444    psS32 col1 = region.x1;
    4545
    46     if (in == NULL || in->data.V == NULL) {
     46    if (input == NULL || input->data.V == NULL) {
    4747        psError(PS_ERR_BAD_PARAMETER_NULL, true,
    4848                PS_ERRORTEXT_psImage_IMAGE_NULL);
     
    5252
    5353    if (col1 < 1) {
    54         col1 += in->numCols;
     54        col1 += input->numCols;
    5555    }
    5656
    5757    if (row1 < 1) {
    58         row1 += in->numRows;
     58        row1 += input->numRows;
    5959    }
    6060
    6161    if (    col0 < 0 ||
    6262            row0 < 0 ||
    63             col1 > in->numCols ||
    64             row1 > in->numRows ||
     63            col1 > input->numCols ||
     64            row1 > input->numRows ||
    6565            col0 >= col1 ||
    6666            row0 >= row1) {
     
    6868                PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID,
    6969                col0, col1, row0, row1,
    70                 in->numCols, in->numRows);
    71         psFree(out);
    72         return NULL;
    73     }
    74 
    75     type = in->type.type;
    76     inRows = in->numRows;
    77     inCols = in->numCols;
     70                input->numCols, input->numRows);
     71        psFree(out);
     72        return NULL;
     73    }
     74
     75    type = input->type.type;
     76    inRows = input->numRows;
     77    inCols = input->numCols;
    7878
    7979    if (direction == PS_CUT_X_NEG || direction == PS_CUT_Y_NEG) {
     
    134134        // psStats.
    135135        out = psVectorRecycle(out, numCols, PS_TYPE_F64);
    136         if (slicePositions != NULL) {
    137             slicePositions = psVectorRecycle(slicePositions, numCols, PS_TYPE_U32);
    138             outPosition = slicePositions->data.U32;
     136        if (coords != NULL) {
     137            coords = psVectorRecycle(coords, numCols, PS_TYPE_U32);
     138            outPosition = coords->data.U32;
    139139        }
    140140        outData = out->data.F64;
     
    153153            psMaskType* maskVecData = NULL; \
    154154            for (psS32 c=col0;c<col1;c++) { \
    155                 ps##TYPE *imgData = in->data.TYPE[row0] + c; \
     155                ps##TYPE *imgData = input->data.TYPE[row0] + c; \
    156156                ps##TYPE *imgVecData = imgVec->data.TYPE; \
    157157                if (maskVec != NULL) { \
     
    213213        // fill in psVector to fake out the statistics functions.
    214214        imgVec = psAlloc(sizeof(psVector));
    215         imgVec->type = in->type;
     215        imgVec->type = input->type;
    216216        imgVec->n = *(int*)&imgVec->nalloc = numCols;
    217217        if (mask != NULL) {
     
    224224        // psStats.
    225225        out = psVectorRecycle(out, numRows, PS_TYPE_F64);
    226         if (slicePositions != NULL) {
    227             slicePositions = psVectorRecycle(slicePositions, numRows, PS_TYPE_U32);
    228             outPosition = slicePositions->data.U32;
     226        if (coords != NULL) {
     227            coords = psVectorRecycle(coords, numRows, PS_TYPE_U32);
     228            outPosition = coords->data.U32;
    229229        }
    230230        outData = out->data.F64;
     
    239239            // point the vector struct to the
    240240            // data to calculate the stats
    241             imgVec->data.U8 = (psPtr )(in->data.U8[r] + col0 * elementSize);
     241            imgVec->data.U8 = (psPtr )(input->data.U8[r] + col0 * elementSize);
    242242            if (maskVec != NULL) {
    243243                maskVec->data.U8 = (psPtr )(mask->data.U8[r] + col0 * sizeof(psMaskType));
     
    271271                     psVector* cutCols,
    272272                     psVector* cutRows,
    273                      const psImage* in,
     273                     const psImage* input,
    274274                     const psImage* mask,
    275275                     psU32 maskVal,
    276276                     psRegion region,
    277                      psU32 nSamples,
     277                     unsigned int nSamples,
    278278                     psImageInterpolateMode mode)
    279279{
    280280
    281     if (in == NULL || in->data.V == NULL) {
     281    if (input == NULL || input->data.V == NULL) {
    282282        psError(PS_ERR_BAD_PARAMETER_NULL, true,
    283283                PS_ERRORTEXT_psImage_IMAGE_NULL);
     
    285285        return NULL;
    286286    }
    287     psS32 numCols = in->numCols;
    288     psS32 numRows = in->numRows;
     287    psS32 numCols = input->numCols;
     288    psS32 numRows = input->numRows;
    289289
    290290    if (nSamples < 2) {
     
    352352    }
    353353
    354     out = psVectorRecycle(out, nSamples, in->type.type);
     354    out = psVectorRecycle(out, nSamples, input->type.type);
    355355
    356356    float dX = (endCol - startCol) / (float)(nSamples-1);
     
    370370                cutRowsData[i] = y; \
    371371            } \
    372             outData[i] = psImagePixelInterpolate(in,x,y,mask,maskVal,0,mode); \
     372            outData[i] = psImagePixelInterpolate(input,x,y,mask,maskVal,0,mode); \
    373373        } \
    374374    } \
     
    376376
    377377
    378     switch (in->type.type) {
     378    switch (input->type.type) {
    379379        LINEAR_CUT_CASE(U8);
    380380        LINEAR_CUT_CASE(U16);
     
    392392    default: {
    393393            char* typeStr;
    394             PS_TYPE_NAME(typeStr,in->type.type);
     394            PS_TYPE_NAME(typeStr,input->type.type);
    395395            psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    396396                    PS_ERRORTEXT_psImage_IMAGE_TYPE_UNSUPPORTED,
     
    405405
    406406psVector* psImageRadialCut(psVector* out,
    407                            const psImage* in,
     407                           const psImage* input,
    408408                           const psImage* restrict mask,
    409409                           psU32 maskVal,
    410                            float centerCol,
    411                            float centerRow,
     410                           float x,
     411                           float y,
    412412                           const psVector* radii,
    413413                           const psStats* stats)
     
    417417    /* check the parameters */
    418418
    419     if (in == NULL || in->data.V == NULL) {
     419    if (input == NULL || input->data.V == NULL) {
    420420        psError(PS_ERR_BAD_PARAMETER_NULL, true,
    421421                PS_ERRORTEXT_psImage_IMAGE_NULL);
     
    423423        return NULL;
    424424    }
    425     psS32 numCols = in->numCols;
    426     psS32 numRows = in->numRows;
     425    psS32 numCols = input->numCols;
     426    psS32 numRows = input->numRows;
    427427
    428428    if (mask != NULL) {
     
    446446    }
    447447
    448     if (centerCol < 0 || centerCol >= numCols ||
    449             centerRow < 0 || centerRow >= numRows) {
     448    if (x < 0 || x >= numCols ||
     449            y < 0 || y >= numRows) {
    450450        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
    451451                PS_ERRORTEXT_psImage_CENTER_NOT_IN_IMAGE,
    452                 centerCol, centerRow,
     452                x, y,
    453453                numCols-1, numRows-1);
    454454        psFree(out);
     
    498498    psF32* rSq = rSqVec->data.F32;
    499499
    500     psS32 startRow = centerRow - rSq[numOut];
    501     psS32 endRow = centerRow + rSq[numOut];
    502     psS32 startCol = centerCol - rSq[numOut];
    503     psS32 endCol = centerCol + rSq[numOut];
     500    psS32 startRow = y - rSq[numOut];
     501    psS32 endRow = y + rSq[numOut];
     502    psS32 startCol = x - rSq[numOut];
     503    psS32 endCol = x + rSq[numOut];
    504504
    505505    if (startRow < 0) {
     
    531531        // than the area of the region of interest.
    532532        buffer[lcv] = psVectorAlloc(1+4*(rSq[lcv+1]-rSq[lcv]),
    533                                     in->type.type);
     533                                    input->type.type);
    534534        buffer[lcv]->n = 0;
    535535
     
    546546    float dist;
    547547    for (psS32 row=startRow; row <= endRow; row++) {
    548         psF32* inRow = in->data.F32[row];
     548        psF32* inRow = input->data.F32[row];
    549549        psMaskType* maskRow = NULL;
    550550        if (mask != NULL) {
     
    552552        }
    553553        for (psS32 col=startCol; col <= endCol; col++) {
    554             dX = centerCol - (float)col - 0.5f;
    555             dY = centerRow - (float)row - 0.5f;
     554            dX = x - (float)col - 0.5f;
     555            dY = y - (float)row - 0.5f;
    556556            dist = dX*dX+dY*dY;
    557557            for (psS32 r = 0; r < numOut; r++) {
Note: See TracChangeset for help on using the changeset viewer.