Changeset 2273 for trunk/psLib/src/image/psImageStats.c
- Timestamp:
- Nov 3, 2004, 3:05:00 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/image/psImageStats.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/image/psImageStats.c
r2265 r2273 1 1 /** @file psImageStats.c 2 * \brief Routines for calculating statistics on images.3 * @ingroup ImageStats4 *5 * This file will hold the prototypes for procedures which calculate6 * statistic on images, histograms on images, and fit/evaluate Chebyshev7 * polynomials to images.8 *9 * @author GLG, MHPCC10 *11 * @version $Revision: 1.49$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-11-02 03:57:21$13 *14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii15 */2 * \brief Routines for calculating statistics on images. 3 * @ingroup ImageStats 4 * 5 * This file will hold the prototypes for procedures which calculate 6 * statistic on images, histograms on images, and fit/evaluate Chebyshev 7 * polynomials to images. 8 * 9 * @author GLG, MHPCC 10 * 11 * @version $Revision: 1.50 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-11-04 01:05:00 $ 13 * 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 15 */ 16 16 17 17 #include <stdlib.h> … … 46 46 47 47 if (stats == NULL) { 48 psErrorMsg(PS_ERRORNAME_DOMAIN "psImageStats", 49 PS_ERR_BAD_PARAMETER_NULL, true, 50 PS_ERRORTEXT_psImage_STAT_NULL); 48 psError(PS_ERR_BAD_PARAMETER_NULL, true, 49 PS_ERRORTEXT_psImage_STAT_NULL); 51 50 return NULL; 52 51 } 53 52 54 53 if (in == NULL) { 55 psErrorMsg(PS_ERRORNAME_DOMAIN "psImageStats", 56 PS_ERR_BAD_PARAMETER_NULL, true, 57 PS_ERRORTEXT_psImage_IMAGE_NULL); 54 psError(PS_ERR_BAD_PARAMETER_NULL, true, 55 PS_ERRORTEXT_psImage_IMAGE_NULL); 58 56 return NULL; 59 57 } 60 58 61 59 if (stats->options == 0) { 62 psErrorMsg(PS_ERRORNAME_DOMAIN "psImageStats", 63 PS_ERR_BAD_PARAMETER_VALUE, true, 64 PS_ERRORTEXT_psImage_NO_STAT_OPTIONS); 60 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 61 PS_ERRORTEXT_psImage_NO_STAT_OPTIONS); 65 62 return stats; 66 63 } … … 76 73 char* typeStr; 77 74 PS_TYPE_NAME(typeStr,mask->type.type); 78 psErrorMsg(PS_ERRORNAME_DOMAIN "psImageStats", 79 PS_ERR_BAD_PARAMETER_TYPE, true, 80 PS_ERRORTEXT_psImage_IMAGE_MASK_TYPE, 81 typeStr, PS_TYPE_MASK_NAME); 75 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 76 PS_ERRORTEXT_psImage_IMAGE_MASK_TYPE, 77 typeStr, PS_TYPE_MASK_NAME); 82 78 psFree(junkData); 83 79 return NULL; … … 125 121 char* typeStr; 126 122 PS_TYPE_NAME(typeStr,mask->type.type); 127 psErrorMsg(PS_ERRORNAME_DOMAIN "psImageHistogram", 128 PS_ERR_BAD_PARAMETER_TYPE, true, 129 PS_ERRORTEXT_psImage_IMAGE_MASK_TYPE, 130 typeStr, PS_TYPE_MASK_NAME); 123 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 124 PS_ERRORTEXT_psImage_IMAGE_MASK_TYPE, 125 typeStr, PS_TYPE_MASK_NAME); 131 126 psFree(out); 132 127 psFree(junkData); … … 150 145 151 146 /***************************************************************************** 152 CalcScaleFactorsEval(n): The Chebyshev polynomials are defined over the147 calcScaleFactorsEval(n): The Chebyshev polynomials are defined over the 153 148 interval [-1.0 : 1.0]. Images typically have sizes of 512x512 or more. In 154 149 order to use Chebyshev polynomials, we must scale the coordinates from … … 156 151 output a vector of evenly spaced floating point values between -1.0:1.0. 157 152 *****************************************************************************/ 158 double *CalcScaleFactors(psS32 n)159 { 160 PS_INT_CHEC _NON_NEGATIVE(n, NULL);153 double* calcScaleFactors(psS32 n) 154 { 155 PS_INT_CHECK_NON_NEGATIVE(n, NULL); 161 156 psS32 i = 0; 162 157 double tmp = 0.0; … … 172 167 } 173 168 174 psVector *Vec CalcScaleFactors(psVector *scalingFactors, psS32 n)169 psVector *VeccalcScaleFactors(psVector *scalingFactors, psS32 n) 175 170 { 176 171 PS_VECTOR_CHECK_NULL(scalingFactors, NULL); 177 172 PS_VECTOR_CHECK_TYPE(scalingFactors, PS_TYPE_F64, NULL); 178 PS_INT_CHEC _NON_NEGATIVE(n, NULL);173 PS_INT_CHECK_NON_NEGATIVE(n, NULL); 179 174 psS32 i = 0; 180 175 double tmp = 0.0; … … 243 238 (input->type.type != PS_TYPE_F32) && 244 239 (input->type.type != PS_TYPE_F64)) { 245 psError(__func__, "Unalowwable image type.\n"); 240 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 241 "Unallowable image type.\n"); 246 242 } 247 243 PS_POLY_CHECK_NULL(coeffs, NULL); … … 259 255 // Check for null inputs 260 256 if (input == NULL) { 261 psErrorMsg(PS_ERRORNAME_DOMAIN "psImageFitPolynomial", 262 PS_ERR_BAD_PARAMETER_NULL, true, 263 PS_ERRORTEXT_psImage_IMAGE_NULL); 257 psError(PS_ERR_BAD_PARAMETER_NULL, true, 258 PS_ERRORTEXT_psImage_IMAGE_NULL); 264 259 return NULL; 265 260 } 266 261 267 262 if (coeffs == NULL) { 268 psErrorMsg(PS_ERRORNAME_DOMAIN "psImageFitPolynomial", 269 PS_ERR_BAD_PARAMETER_NULL, true, 270 PS_ERRORTEXT_psImage_COEFF_NULL); 263 psError(PS_ERR_BAD_PARAMETER_NULL, true, 264 PS_ERRORTEXT_psImage_COEFF_NULL); 271 265 return NULL; 272 266 } … … 283 277 // We scale the pixel positions to values 284 278 // between -1.0 and 1.0 285 rScalingFactors = CalcScaleFactors(input->numRows);286 cScalingFactors = CalcScaleFactors(input->numCols);279 rScalingFactors = calcScaleFactors(input->numRows); 280 cScalingFactors = calcScaleFactors(input->numCols); 287 281 288 282 // Determine how many Chebyshev polynomials … … 363 357 (input->type.type != PS_TYPE_F32) && 364 358 (input->type.type != PS_TYPE_F64)) { 365 psError(__func__, "Unalowwable image type.\n"); 359 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 360 "Unallowable image type.\n"); 366 361 } 367 362 PS_POLY_CHECK_NULL(coeffs, NULL); … … 376 371 double *cScalingFactors = NULL; 377 372 double *rScalingFactors = NULL; 378 double polySum = 0.0; 379 373 float polySum = 0.0; 374 375 // Check for null inputs 376 if (input == NULL) { 377 psError(PS_ERR_BAD_PARAMETER_NULL, true, 378 PS_ERRORTEXT_psImage_IMAGE_NULL); 379 return NULL; 380 } 381 382 if (coeffs == NULL) { 383 psError(PS_ERR_BAD_PARAMETER_NULL, true, 384 PS_ERRORTEXT_psImage_COEFF_NULL); 385 return NULL; 386 } 380 387 381 388 // We scale the pixel positions to values between -1.0 and 1.0 382 389 // Use static data structures here. 383 rScalingFactors = CalcScaleFactors(input->numRows);384 cScalingFactors = CalcScaleFactors(input->numCols);390 rScalingFactors = calcScaleFactors(input->numRows); 391 cScalingFactors = calcScaleFactors(input->numCols); 385 392 386 393 // Determine how many Chebyshev polynomials
Note:
See TracChangeset
for help on using the changeset viewer.
