Changeset 6294
- Timestamp:
- Feb 1, 2006, 6:41:45 PM (20 years ago)
- Location:
- trunk/psLib
- Files:
-
- 3 edited
-
src/imageops/psImagePixelExtract.c (modified) (8 diffs)
-
src/imageops/psImagePixelExtract.h (modified) (3 diffs)
-
test/imageops/tst_psImagePixelExtract.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImagePixelExtract.c
r5530 r6294 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $11 * @date $Date: 200 5-11-16 23:06:14$10 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2006-02-02 04:41:42 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 216 216 217 217 psVector* psImageSlice(psVector* out, 218 ps Vector* coords,218 psPixels* coords, 219 219 const psImage* input, 220 220 const psImage* mask, … … 320 320 psVector* maskVec = NULL; 321 321 psMaskType* maskData = NULL; 322 ps U32* outPosition = NULL;322 psPixelCoord* outPosition = NULL; 323 323 324 324 // recycle output to make a proper sized/type output structure … … 327 327 out = psVectorRecycle(out, numCols, PS_TYPE_F64); 328 328 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; 331 332 } 332 333 outData = out->data.F64; … … 363 364 *outData = statVal; \ 364 365 if (outPosition != NULL) { \ 365 *outPosition = c; \ 366 outPosition->x = c; \ 367 outPosition->y = row0; \ 366 368 outPosition += delta; \ 367 369 } \ … … 401 403 psVector* maskVec = NULL; 402 404 psS32 elementSize = PSELEMTYPE_SIZEOF(type); 403 ps U32* outPosition = NULL;405 psPixelCoord* outPosition = NULL; 404 406 405 407 // fill in psVector to fake out the statistics functions. … … 420 422 out = psVectorRecycle(out, numRows, PS_TYPE_F64); 421 423 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; 424 427 } 425 428 outData = out->data.F64; … … 442 445 *outData = statVal; 443 446 if (outPosition != NULL) { 444 *outPosition = r; 447 outPosition->y = r; 448 outPosition->x = col0; 445 449 outPosition += delta; 446 450 -
trunk/psLib/src/imageops/psImagePixelExtract.h
r5213 r6294 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $11 * @date $Date: 200 5-09-30 23:09:13$10 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2006-02-02 04:41:42 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 20 20 #include "psVector.h" 21 21 #include "psStats.h" 22 #include "psPixels.h" 22 23 23 24 /// @addtogroup Image … … 80 81 psVector* psImageSlice( 81 82 psVector* out, ///< psVector to recycle, or NULL. 82 ps Vector* coords,83 psPixels* coords, 83 84 ///< If not NULL, it is populated with the coordinate in the slice dimension 84 85 ///< coorsponding to the output vector's value of the same position in the -
trunk/psLib/test/imageops/tst_psImagePixelExtract.c
r5625 r6294 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $9 * @date $Date: 200 5-11-30 02:00:37$8 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2006-02-02 04:41:45 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 64 64 psVector* out = NULL; 65 65 psImage* image; 66 ps Vector* positions = psVectorAlloc( r, PS_TYPE_U32);66 psPixels* positions = psPixelsAlloc( r ); 67 67 psImage* mask = psImageAlloc( c, r, PS_TYPE_MASK ); 68 68 psStats* stat = psStatsAlloc( PS_STAT_SAMPLE_MEDIAN ); … … 102 102 if (out->n != TRUTH_SIZE) { \ 103 103 psError(PS_ERR_UNKNOWN,true,"Number of results is wrong (%d, not %d)", \ 104 out->n, n); \104 out->n,TRUTH_SIZE); \ 105 105 return TESTNUM*4+1; \ 106 106 } \ … … 108 108 if (positions->n != TRUTH_SIZE) { \ 109 109 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); \ 111 111 return TESTNUM*4+2; \ 112 112 } \ … … 119 119 } \ 120 120 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) { \ 122 122 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); \ 124 124 return TESTNUM*4+4; \ 125 125 } \ 126 126 } else { \ 127 if (positions->data .U32[i]!= r/10+TRUTHPIX_Y) { \127 if (positions->data[i].y != r/10+TRUTHPIX_Y) { \ 128 128 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); \ 130 130 return TESTNUM*4+4; \ 131 131 } \
Note:
See TracChangeset
for help on using the changeset viewer.
