Changeset 2762
- Timestamp:
- Dec 20, 2004, 11:39:42 AM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 8 edited
-
dataManip/psConstants.h (modified) (2 diffs)
-
dataManip/psStats.c (modified) (2 diffs)
-
image/psImage.c (modified) (2 diffs)
-
image/psImageStats.c (modified) (3 diffs)
-
imageops/psImageStats.c (modified) (3 diffs)
-
math/psConstants.h (modified) (2 diffs)
-
math/psStats.c (modified) (2 diffs)
-
mathtypes/psImage.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataManip/psConstants.h
r2741 r2762 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.4 6$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-12- 17 00:18:31$8 * @version $Revision: 1.47 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-12-20 21:39:42 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 429 429 } 430 430 431 431 #define PS_IMAGE_PRINT_F32(NAME) \ 432 printf("======== printing %s ========\n", #NAME); \ 433 for (int i = 0 ; i < NAME->numRows ; i++) { \ 434 for (int j = 0 ; j < NAME->numCols ; j++) { \ 435 printf("%.2f ", NAME->data.F32[i][j]); \ 436 } \ 437 printf("\n"); \ 438 }\ 439 440 #define PS_IMAGE_SET_F32(NAME, VALUE) \ 441 for (int i = 0 ; i < NAME->numRows ; i++) { \ 442 for (int j = 0 ; j < NAME->numCols ; j++) { \ 443 NAME->data.F32[i][j] = VALUE; \ 444 } \ 445 }\ 446 447 #define PS_IMAGE_SET_U8(NAME, VALUE) \ 448 for (int i = 0 ; i < NAME->numRows ; i++) { \ 449 for (int j = 0 ; j < NAME->numCols ; j++) { \ 450 NAME->data.U8[i][j] = VALUE; \ 451 } \ 452 }\ 432 453 433 454 /***************************************************************************** 434 455 PS_READOUT macros: 435 *****************************************************************************/456 *****************************************************************************/ 436 457 #define PS_READOUT_CHECK_NULL(NAME, RVAL) \ 437 458 if (NAME == NULL || NAME->image == NULL) { \ -
trunk/psLib/src/dataManip/psStats.c
r2739 r2762 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.10 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-12- 16 23:04:18$11 * @version $Revision: 1.104 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-12-20 21:39:42 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 793 793 } 794 794 } 795 if (countInt <= 1) {795 if (countInt == 0) { 796 796 stats->sampleStdev = NAN; 797 psLogMsg(__func__, PS_LOG_WARN, "WARNING: p_psVectorSampleStdev(): no valid psVector elements. Setting stats->sampleStdev = NAN.\n"); 797 psLogMsg(__func__, PS_LOG_WARN, "WARNING: p_psVectorSampleStdev(): no valid psVector elements (%d). Setting stats->sampleStdev = NAN.\n", countInt); 798 } else if (countInt == 1) { 799 stats->sampleStdev = 0.0; 800 psLogMsg(__func__, PS_LOG_WARN, "WARNING: p_psVectorSampleStdev(): only one valid psVector elements (%d). Setting stats->sampleStdev = 0.0.\n", countInt); 798 801 } else { 799 802 countFloat = (float)countInt; -
trunk/psLib/src/image/psImage.c
r2375 r2762 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.5 4$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-1 1-16 20:00:21$11 * @version $Revision: 1.55 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-12-20 21:39:42 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 396 396 397 397 /***************************************************************************** 398 XXX: update function description. 399 398 400 p_psImagePixelInterpolation(image, x, y): this routine takes as input an 399 401 image and coordinates (x, y) and produces as output the corresponding pixel -
trunk/psLib/src/image/psImageStats.c
r2736 r2762 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.6 0$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-12- 16 21:58:55$11 * @version $Revision: 1.61 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-12-20 21:39:42 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 450 450 XXX: Use static variables for Chebyshev polynomials and scaling factors. 451 451 *****************************************************************************/ 452 psImage* psImageEvalPolynomial(psImage* input, const psPolynomial2D* coeffs) 453 { 454 PS_IMAGE_CHECK_NULL(input, NULL); 455 PS_IMAGE_CHECK_EMPTY(input, NULL); 456 if ((input->type.type != PS_TYPE_S8) && 457 (input->type.type != PS_TYPE_U16) && 458 (input->type.type != PS_TYPE_F32) && 459 (input->type.type != PS_TYPE_F64)) { 460 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 461 "Unallowable image type.\n"); 462 } 463 PS_POLY_CHECK_NULL(coeffs, NULL); 452 psImage* p_psImageEvalPolynomialCheb(psImage* input, 453 const psPolynomial2D* coeffs) 454 { 464 455 PS_POLY_CHECK_TYPE(coeffs, PS_POLYNOMIAL_CHEB, NULL); 465 456 … … 525 516 return input; 526 517 } 518 519 psImage* p_psImageEvalPolynomialOrd(psImage* input, 520 const psPolynomial2D* coeffs) 521 { 522 PS_POLY_CHECK_TYPE(coeffs, PS_POLYNOMIAL_ORD, NULL); 523 524 for (int row = 0; row < input->numRows ; row++) { 525 for (int col = 0; col < input->numCols ; col++) { 526 if (input->type.type == PS_TYPE_S8) { 527 input->data.S8[row][col] = (psS8) psPolynomial2DEval(coeffs, (psF32) row, (psF32) col); 528 } else if (input->type.type == PS_TYPE_U16) { 529 input->data.U16[row][col] = (psS16) psPolynomial2DEval(coeffs, (psF32) row, (psF32) col); 530 } else if (input->type.type == PS_TYPE_F32) { 531 input->data.F32[row][col] = psPolynomial2DEval(coeffs, (psF32) row, (psF32) col); 532 } else if (input->type.type == PS_TYPE_F64) { 533 input->data.F64[row][col] = (psF64) psPolynomial2DEval(coeffs, (psF32) row, (psF32) col); 534 } 535 } 536 } 537 538 return(input); 539 } 540 541 542 /***************************************************************************** 543 XXX: I added normal polynomials to this routine. Let IfA know, put it in the 544 psLib SDR. 545 *****************************************************************************/ 546 psImage* psImageEvalPolynomial(psImage* input, 547 const psPolynomial2D* coeffs) 548 { 549 PS_IMAGE_CHECK_NULL(input, NULL); 550 PS_IMAGE_CHECK_EMPTY(input, NULL); 551 if ((input->type.type != PS_TYPE_S8) && 552 (input->type.type != PS_TYPE_U16) && 553 (input->type.type != PS_TYPE_F32) && 554 (input->type.type != PS_TYPE_F64)) { 555 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 556 "Unallowable image type.\n"); 557 } 558 PS_POLY_CHECK_NULL(coeffs, NULL); 559 560 if (coeffs->type == PS_POLYNOMIAL_ORD) { 561 return(p_psImageEvalPolynomialOrd(input, coeffs)); 562 } else if (coeffs->type == PS_POLYNOMIAL_CHEB) { 563 return(p_psImageEvalPolynomialCheb(input, coeffs)); 564 } 565 printf("XXX: Error: wrong polynomial type\n"); 566 // XXX: psError() 567 return(NULL); 568 } 569 -
trunk/psLib/src/imageops/psImageStats.c
r2736 r2762 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.6 0$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-12- 16 21:58:55$11 * @version $Revision: 1.61 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-12-20 21:39:42 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 450 450 XXX: Use static variables for Chebyshev polynomials and scaling factors. 451 451 *****************************************************************************/ 452 psImage* psImageEvalPolynomial(psImage* input, const psPolynomial2D* coeffs) 453 { 454 PS_IMAGE_CHECK_NULL(input, NULL); 455 PS_IMAGE_CHECK_EMPTY(input, NULL); 456 if ((input->type.type != PS_TYPE_S8) && 457 (input->type.type != PS_TYPE_U16) && 458 (input->type.type != PS_TYPE_F32) && 459 (input->type.type != PS_TYPE_F64)) { 460 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 461 "Unallowable image type.\n"); 462 } 463 PS_POLY_CHECK_NULL(coeffs, NULL); 452 psImage* p_psImageEvalPolynomialCheb(psImage* input, 453 const psPolynomial2D* coeffs) 454 { 464 455 PS_POLY_CHECK_TYPE(coeffs, PS_POLYNOMIAL_CHEB, NULL); 465 456 … … 525 516 return input; 526 517 } 518 519 psImage* p_psImageEvalPolynomialOrd(psImage* input, 520 const psPolynomial2D* coeffs) 521 { 522 PS_POLY_CHECK_TYPE(coeffs, PS_POLYNOMIAL_ORD, NULL); 523 524 for (int row = 0; row < input->numRows ; row++) { 525 for (int col = 0; col < input->numCols ; col++) { 526 if (input->type.type == PS_TYPE_S8) { 527 input->data.S8[row][col] = (psS8) psPolynomial2DEval(coeffs, (psF32) row, (psF32) col); 528 } else if (input->type.type == PS_TYPE_U16) { 529 input->data.U16[row][col] = (psS16) psPolynomial2DEval(coeffs, (psF32) row, (psF32) col); 530 } else if (input->type.type == PS_TYPE_F32) { 531 input->data.F32[row][col] = psPolynomial2DEval(coeffs, (psF32) row, (psF32) col); 532 } else if (input->type.type == PS_TYPE_F64) { 533 input->data.F64[row][col] = (psF64) psPolynomial2DEval(coeffs, (psF32) row, (psF32) col); 534 } 535 } 536 } 537 538 return(input); 539 } 540 541 542 /***************************************************************************** 543 XXX: I added normal polynomials to this routine. Let IfA know, put it in the 544 psLib SDR. 545 *****************************************************************************/ 546 psImage* psImageEvalPolynomial(psImage* input, 547 const psPolynomial2D* coeffs) 548 { 549 PS_IMAGE_CHECK_NULL(input, NULL); 550 PS_IMAGE_CHECK_EMPTY(input, NULL); 551 if ((input->type.type != PS_TYPE_S8) && 552 (input->type.type != PS_TYPE_U16) && 553 (input->type.type != PS_TYPE_F32) && 554 (input->type.type != PS_TYPE_F64)) { 555 psError(PS_ERR_BAD_PARAMETER_TYPE, true, 556 "Unallowable image type.\n"); 557 } 558 PS_POLY_CHECK_NULL(coeffs, NULL); 559 560 if (coeffs->type == PS_POLYNOMIAL_ORD) { 561 return(p_psImageEvalPolynomialOrd(input, coeffs)); 562 } else if (coeffs->type == PS_POLYNOMIAL_CHEB) { 563 return(p_psImageEvalPolynomialCheb(input, coeffs)); 564 } 565 printf("XXX: Error: wrong polynomial type\n"); 566 // XXX: psError() 567 return(NULL); 568 } 569 -
trunk/psLib/src/math/psConstants.h
r2741 r2762 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.4 6$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-12- 17 00:18:31$8 * @version $Revision: 1.47 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-12-20 21:39:42 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 429 429 } 430 430 431 431 #define PS_IMAGE_PRINT_F32(NAME) \ 432 printf("======== printing %s ========\n", #NAME); \ 433 for (int i = 0 ; i < NAME->numRows ; i++) { \ 434 for (int j = 0 ; j < NAME->numCols ; j++) { \ 435 printf("%.2f ", NAME->data.F32[i][j]); \ 436 } \ 437 printf("\n"); \ 438 }\ 439 440 #define PS_IMAGE_SET_F32(NAME, VALUE) \ 441 for (int i = 0 ; i < NAME->numRows ; i++) { \ 442 for (int j = 0 ; j < NAME->numCols ; j++) { \ 443 NAME->data.F32[i][j] = VALUE; \ 444 } \ 445 }\ 446 447 #define PS_IMAGE_SET_U8(NAME, VALUE) \ 448 for (int i = 0 ; i < NAME->numRows ; i++) { \ 449 for (int j = 0 ; j < NAME->numCols ; j++) { \ 450 NAME->data.U8[i][j] = VALUE; \ 451 } \ 452 }\ 432 453 433 454 /***************************************************************************** 434 455 PS_READOUT macros: 435 *****************************************************************************/456 *****************************************************************************/ 436 457 #define PS_READOUT_CHECK_NULL(NAME, RVAL) \ 437 458 if (NAME == NULL || NAME->image == NULL) { \ -
trunk/psLib/src/math/psStats.c
r2739 r2762 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.10 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-12- 16 23:04:18$11 * @version $Revision: 1.104 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-12-20 21:39:42 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 793 793 } 794 794 } 795 if (countInt <= 1) {795 if (countInt == 0) { 796 796 stats->sampleStdev = NAN; 797 psLogMsg(__func__, PS_LOG_WARN, "WARNING: p_psVectorSampleStdev(): no valid psVector elements. Setting stats->sampleStdev = NAN.\n"); 797 psLogMsg(__func__, PS_LOG_WARN, "WARNING: p_psVectorSampleStdev(): no valid psVector elements (%d). Setting stats->sampleStdev = NAN.\n", countInt); 798 } else if (countInt == 1) { 799 stats->sampleStdev = 0.0; 800 psLogMsg(__func__, PS_LOG_WARN, "WARNING: p_psVectorSampleStdev(): only one valid psVector elements (%d). Setting stats->sampleStdev = 0.0.\n", countInt); 798 801 } else { 799 802 countFloat = (float)countInt; -
trunk/psLib/src/mathtypes/psImage.c
r2375 r2762 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.5 4$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-1 1-16 20:00:21$11 * @version $Revision: 1.55 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-12-20 21:39:42 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 396 396 397 397 /***************************************************************************** 398 XXX: update function description. 399 398 400 p_psImagePixelInterpolation(image, x, y): this routine takes as input an 399 401 image and coordinates (x, y) and produces as output the corresponding pixel
Note:
See TracChangeset
for help on using the changeset viewer.
