Changeset 2293
- Timestamp:
- Nov 5, 2004, 2:56:29 PM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 4 edited
-
dataManip/psConstants.h (modified) (2 diffs)
-
image/psImageStats.c (modified) (6 diffs)
-
imageops/psImageStats.c (modified) (6 diffs)
-
math/psConstants.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataManip/psConstants.h
r2291 r2293 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.3 6$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-11-06 00: 44:56$8 * @version $Revision: 1.37 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-11-06 00:56:28 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 318 318 } 319 319 320 #define PS_IMAGE_CHECK_SIZE_EQUAL(NAME1, NAME2, RVAL) \ 321 if ((NAME1->numCols != NAME2->numCols) || \ 322 (NAME1->numRows != NAME2->numRows)) { \ 323 psError(PS_ERR_BAD_PARAMETER_SIZE, true, \ 324 "Unallowable operation: psImages %s and %s are not the same size.", \ 325 #NAME1, #NAME2); \ 326 return(RVAL); \ 327 } 328 320 329 321 330 -
trunk/psLib/src/image/psImageStats.c
r2292 r2293 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.5 2$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-11-06 00: 45:13$11 * @version $Revision: 1.53 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-11-06 00:56:29 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 34 34 /// This routine must determine the various statistics for the image. 35 35 /***************************************************************************** 36 XXX: verify that image/mask have the correct types, and sizes. 36 psImageStats(stats, in, mask, maskVal): this routine simply calls the 37 psVectorStats() routine, which does the actual statistical calculation. In 38 order to do so, we create dummy psVectors and set their "data" pointer to that 39 of the input psImages. 40 41 XXX: use static psVectors 37 42 *****************************************************************************/ 38 43 psStats* psImageStats(psStats* stats, … … 41 46 psS32 maskVal) 42 47 { 48 psVector *junkData = NULL; 49 psVector *junkMask = NULL; 50 43 51 PS_PTR_CHECK_NULL(stats, NULL); 44 52 PS_INT_CHECK_ZERO(stats->options, NULL); 45 53 PS_IMAGE_CHECK_NULL(in, NULL) 46 psVector* junkData = NULL; 47 psVector* junkMask = NULL; 54 if (mask != NULL) { 55 PS_IMAGE_CHECK_TYPE(mask, PS_TYPE_U8, NULL); 56 PS_IMAGE_CHECK_SIZE_EQUAL(in, mask, NULL); 57 } 48 58 49 59 // stuff the image data into a psVector struct. 50 junkData = psAlloc(sizeof(psVector));60 junkData = (psVector *) psAlloc(sizeof(psVector)); 51 61 junkData->type = in->type; 52 62 junkData->nalloc = in->numRows * in->numCols; … … 55 65 56 66 if (mask != NULL) { 57 if (mask->type.type != PS_TYPE_MASK) {58 char* typeStr;59 PS_TYPE_NAME(typeStr,mask->type.type);60 psError(PS_ERR_BAD_PARAMETER_TYPE, true,61 PS_ERRORTEXT_psImage_IMAGE_MASK_TYPE,62 typeStr, PS_TYPE_MASK_NAME);63 psFree(junkData);64 return NULL;65 }66 67 // stuff the mask data into a psVector struct. 67 68 junkMask = psAlloc(sizeof(psVector)); … … 92 93 if (mask != NULL) { 93 94 PS_IMAGE_CHECK_TYPE(mask, PS_TYPE_U8, NULL); 95 PS_IMAGE_CHECK_SIZE_EQUAL(in, mask, NULL); 94 96 } 95 97 psVector* junkData = NULL; … … 137 139 tmp = (M_PI * (tmp - 0.5)) / ((double)n); 138 140 scalingFactors[i] = cos(tmp); 139 }140 141 return (scalingFactors);142 }143 144 psVector *VeccalcScaleFactors(psVector *scalingFactors, psS32 n)145 {146 PS_VECTOR_CHECK_NULL(scalingFactors, NULL);147 PS_VECTOR_CHECK_TYPE(scalingFactors, PS_TYPE_F64, NULL);148 PS_INT_CHECK_NON_NEGATIVE(n, NULL);149 psS32 i = 0;150 double tmp = 0.0;151 152 for (i = 0; i < n; i++) {153 tmp = (double)(n - i);154 tmp = (M_PI * (tmp - 0.5)) / ((double)n);155 scalingFactors->data.F64[i] = cos(tmp);156 141 } 157 142 -
trunk/psLib/src/imageops/psImageStats.c
r2292 r2293 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.5 2$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-11-06 00: 45:13$11 * @version $Revision: 1.53 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-11-06 00:56:29 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 34 34 /// This routine must determine the various statistics for the image. 35 35 /***************************************************************************** 36 XXX: verify that image/mask have the correct types, and sizes. 36 psImageStats(stats, in, mask, maskVal): this routine simply calls the 37 psVectorStats() routine, which does the actual statistical calculation. In 38 order to do so, we create dummy psVectors and set their "data" pointer to that 39 of the input psImages. 40 41 XXX: use static psVectors 37 42 *****************************************************************************/ 38 43 psStats* psImageStats(psStats* stats, … … 41 46 psS32 maskVal) 42 47 { 48 psVector *junkData = NULL; 49 psVector *junkMask = NULL; 50 43 51 PS_PTR_CHECK_NULL(stats, NULL); 44 52 PS_INT_CHECK_ZERO(stats->options, NULL); 45 53 PS_IMAGE_CHECK_NULL(in, NULL) 46 psVector* junkData = NULL; 47 psVector* junkMask = NULL; 54 if (mask != NULL) { 55 PS_IMAGE_CHECK_TYPE(mask, PS_TYPE_U8, NULL); 56 PS_IMAGE_CHECK_SIZE_EQUAL(in, mask, NULL); 57 } 48 58 49 59 // stuff the image data into a psVector struct. 50 junkData = psAlloc(sizeof(psVector));60 junkData = (psVector *) psAlloc(sizeof(psVector)); 51 61 junkData->type = in->type; 52 62 junkData->nalloc = in->numRows * in->numCols; … … 55 65 56 66 if (mask != NULL) { 57 if (mask->type.type != PS_TYPE_MASK) {58 char* typeStr;59 PS_TYPE_NAME(typeStr,mask->type.type);60 psError(PS_ERR_BAD_PARAMETER_TYPE, true,61 PS_ERRORTEXT_psImage_IMAGE_MASK_TYPE,62 typeStr, PS_TYPE_MASK_NAME);63 psFree(junkData);64 return NULL;65 }66 67 // stuff the mask data into a psVector struct. 67 68 junkMask = psAlloc(sizeof(psVector)); … … 92 93 if (mask != NULL) { 93 94 PS_IMAGE_CHECK_TYPE(mask, PS_TYPE_U8, NULL); 95 PS_IMAGE_CHECK_SIZE_EQUAL(in, mask, NULL); 94 96 } 95 97 psVector* junkData = NULL; … … 137 139 tmp = (M_PI * (tmp - 0.5)) / ((double)n); 138 140 scalingFactors[i] = cos(tmp); 139 }140 141 return (scalingFactors);142 }143 144 psVector *VeccalcScaleFactors(psVector *scalingFactors, psS32 n)145 {146 PS_VECTOR_CHECK_NULL(scalingFactors, NULL);147 PS_VECTOR_CHECK_TYPE(scalingFactors, PS_TYPE_F64, NULL);148 PS_INT_CHECK_NON_NEGATIVE(n, NULL);149 psS32 i = 0;150 double tmp = 0.0;151 152 for (i = 0; i < n; i++) {153 tmp = (double)(n - i);154 tmp = (M_PI * (tmp - 0.5)) / ((double)n);155 scalingFactors->data.F64[i] = cos(tmp);156 141 } 157 142 -
trunk/psLib/src/math/psConstants.h
r2291 r2293 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.3 6$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-11-06 00: 44:56$8 * @version $Revision: 1.37 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-11-06 00:56:28 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 318 318 } 319 319 320 #define PS_IMAGE_CHECK_SIZE_EQUAL(NAME1, NAME2, RVAL) \ 321 if ((NAME1->numCols != NAME2->numCols) || \ 322 (NAME1->numRows != NAME2->numRows)) { \ 323 psError(PS_ERR_BAD_PARAMETER_SIZE, true, \ 324 "Unallowable operation: psImages %s and %s are not the same size.", \ 325 #NAME1, #NAME2); \ 326 return(RVAL); \ 327 } 328 320 329 321 330
Note:
See TracChangeset
for help on using the changeset viewer.
