IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6294


Ignore:
Timestamp:
Feb 1, 2006, 6:41:45 PM (20 years ago)
Author:
desonia
Message:

changed psImagePixelExtract to take a psPixels instead of psVector of coord
parameter.

Location:
trunk/psLib
Files:
3 edited

Legend:

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

    r5530 r6294  
    88 *  @author Robert DeSonia, MHPCC
    99 *
    10  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2005-11-16 23:06:14 $
     10 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2006-02-02 04:41:42 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    216216
    217217psVector* psImageSlice(psVector* out,
    218                        psVector* coords,
     218                       psPixels* coords,
    219219                       const psImage* input,
    220220                       const psImage* mask,
     
    320320        psVector* maskVec = NULL;
    321321        psMaskType* maskData = NULL;
    322         psU32* outPosition = NULL;
     322        psPixelCoord* outPosition = NULL;
    323323
    324324        // recycle output to make a proper sized/type output structure
     
    327327        out = psVectorRecycle(out, numCols, PS_TYPE_F64);
    328328        if (coords != NULL) {
    329             coords = psVectorRecycle(coords, numCols, PS_TYPE_U32);
    330             outPosition = coords->data.U32;
     329            coords = psPixelsRealloc(coords, numCols);
     330            coords->n = numCols;
     331            outPosition = coords->data;
    331332        }
    332333        outData = out->data.F64;
     
    363364                *outData = statVal; \
    364365                if (outPosition != NULL) { \
    365                     *outPosition = c; \
     366                    outPosition->x = c; \
     367                    outPosition->y = row0; \
    366368                    outPosition += delta; \
    367369                } \
     
    401403        psVector* maskVec = NULL;
    402404        psS32 elementSize = PSELEMTYPE_SIZEOF(type);
    403         psU32* outPosition = NULL;
     405        psPixelCoord* outPosition = NULL;
    404406
    405407        // fill in psVector to fake out the statistics functions.
     
    420422        out = psVectorRecycle(out, numRows, PS_TYPE_F64);
    421423        if (coords != NULL) {
    422             coords = psVectorRecycle(coords, numRows, PS_TYPE_U32);
    423             outPosition = coords->data.U32;
     424            coords = psPixelsRealloc(coords, numRows);
     425            coords->n = numRows;
     426            outPosition = coords->data;
    424427        }
    425428        outData = out->data.F64;
     
    442445            *outData = statVal;
    443446            if (outPosition != NULL) {
    444                 *outPosition = r;
     447                outPosition->y = r;
     448                outPosition->x = col0;
    445449                outPosition += delta;
    446450
  • trunk/psLib/src/imageops/psImagePixelExtract.h

    r5213 r6294  
    88*  @author Robert DeSonia, MHPCC
    99*
    10 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2005-09-30 23:09:13 $
     10*  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2006-02-02 04:41:42 $
    1212*
    1313*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2020#include "psVector.h"
    2121#include "psStats.h"
     22#include "psPixels.h"
    2223
    2324/// @addtogroup Image
     
    8081psVector* psImageSlice(
    8182    psVector* out,                     ///< psVector to recycle, or NULL.
    82     psVector* coords,
     83    psPixels* coords,
    8384    ///< If not NULL, it is populated with the coordinate in the slice dimension
    8485    ///< coorsponding to the output vector's value of the same position in the
  • trunk/psLib/test/imageops/tst_psImagePixelExtract.c

    r5625 r6294  
    66*  @author Robert DeSonia, MHPCC
    77*
    8 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2005-11-30 02:00:37 $
     8*  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2006-02-02 04:41:45 $
    1010*
    1111*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6464    psVector* out = NULL;
    6565    psImage* image;
    66     psVector* positions = psVectorAlloc( r, PS_TYPE_U32 );
     66    psPixels* positions = psPixelsAlloc( r );
    6767    psImage* mask = psImageAlloc( c, r, PS_TYPE_MASK );
    6868    psStats* stat = psStatsAlloc( PS_STAT_SAMPLE_MEDIAN );
     
    102102    if (out->n != TRUTH_SIZE) { \
    103103        psError(PS_ERR_UNKNOWN,true,"Number of results is wrong (%d, not %d)", \
    104                 out->n,n); \
     104                out->n,TRUTH_SIZE); \
    105105        return TESTNUM*4+1; \
    106106    } \
     
    108108    if (positions->n != TRUTH_SIZE) { \
    109109        psError(PS_ERR_UNKNOWN,true,"Number of results for positions vector is wrong (%d, not %d)", \
    110                 out->n,n); \
     110                positions->n,TRUTH_SIZE); \
    111111        return TESTNUM*4+2; \
    112112    } \
     
    119119        } \
    120120        if (DIRECTION == PS_CUT_X_POS || DIRECTION == PS_CUT_X_NEG) { \
    121             if (positions->data.U32[i] != c/10+TRUTHPIX_X) { \
     121            if (positions->data[i].x != c/10+TRUTHPIX_X) { \
    122122                psError(PS_ERR_UNKNOWN,true,"Improper positions (%d vs %d) result @ %d.", \
    123                         positions->data.U32[i],c/10+TRUTHPIX_X,i); \
     123                        positions->data[i].x,c/10+TRUTHPIX_X,i); \
    124124                return TESTNUM*4+4; \
    125125            } \
    126126        } else { \
    127             if (positions->data.U32[i] != r/10+TRUTHPIX_Y) { \
     127            if (positions->data[i].y != r/10+TRUTHPIX_Y) { \
    128128                psError(PS_ERR_UNKNOWN,true,"Improper positions (%d vs %d) result @ %d.", \
    129                         positions->data.U32[i],r/10+TRUTHPIX_Y,i); \
     129                        positions->data[i].y,r/10+TRUTHPIX_Y,i); \
    130130                return TESTNUM*4+4; \
    131131            } \
Note: See TracChangeset for help on using the changeset viewer.