IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2762


Ignore:
Timestamp:
Dec 20, 2004, 11:39:42 AM (22 years ago)
Author:
gusciora
Message:

New macros for psCOnstants.h

Location:
trunk/psLib/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/dataManip/psConstants.h

    r2741 r2762  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.46 $ $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 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    429429}
    430430
    431 
     431#define PS_IMAGE_PRINT_F32(NAME) \
     432printf("======== printing %s ========\n", #NAME); \
     433for (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) \
     441for (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) \
     448for (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}\
    432453
    433454/*****************************************************************************
    434455    PS_READOUT macros:
    435  *****************************************************************************/
     456*****************************************************************************/
    436457#define PS_READOUT_CHECK_NULL(NAME, RVAL) \
    437458if (NAME == NULL || NAME->image == NULL) { \
  • trunk/psLib/src/dataManip/psStats.c

    r2739 r2762  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.103 $ $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 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    793793        }
    794794    }
    795     if (countInt <= 1) {
     795    if (countInt == 0) {
    796796        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);
    798801    } else {
    799802        countFloat = (float)countInt;
  • trunk/psLib/src/image/psImage.c

    r2375 r2762  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.54 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-11-16 20:00:21 $
     11 *  @version $Revision: 1.55 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-12-20 21:39:42 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    396396
    397397/*****************************************************************************
     398XXX: update function description.
     399 
    398400p_psImagePixelInterpolation(image, x, y): this routine takes as input an
    399401image and coordinates (x, y) and produces as output the corresponding pixel
  • trunk/psLib/src/image/psImageStats.c

    r2736 r2762  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.60 $ $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 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    450450XXX: Use static variables for Chebyshev polynomials and scaling factors.
    451451 *****************************************************************************/
    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);
     452psImage* p_psImageEvalPolynomialCheb(psImage* input,
     453                                     const psPolynomial2D* coeffs)
     454{
    464455    PS_POLY_CHECK_TYPE(coeffs, PS_POLYNOMIAL_CHEB, NULL);
    465456
     
    525516    return input;
    526517}
     518
     519psImage* 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/*****************************************************************************
     543XXX: I added normal polynomials to this routine.  Let IfA know, put it in the
     544psLib SDR.
     545 *****************************************************************************/
     546psImage* 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  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.60 $ $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 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    450450XXX: Use static variables for Chebyshev polynomials and scaling factors.
    451451 *****************************************************************************/
    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);
     452psImage* p_psImageEvalPolynomialCheb(psImage* input,
     453                                     const psPolynomial2D* coeffs)
     454{
    464455    PS_POLY_CHECK_TYPE(coeffs, PS_POLYNOMIAL_CHEB, NULL);
    465456
     
    525516    return input;
    526517}
     518
     519psImage* 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/*****************************************************************************
     543XXX: I added normal polynomials to this routine.  Let IfA know, put it in the
     544psLib SDR.
     545 *****************************************************************************/
     546psImage* 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  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.46 $ $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 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    429429}
    430430
    431 
     431#define PS_IMAGE_PRINT_F32(NAME) \
     432printf("======== printing %s ========\n", #NAME); \
     433for (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) \
     441for (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) \
     448for (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}\
    432453
    433454/*****************************************************************************
    434455    PS_READOUT macros:
    435  *****************************************************************************/
     456*****************************************************************************/
    436457#define PS_READOUT_CHECK_NULL(NAME, RVAL) \
    437458if (NAME == NULL || NAME->image == NULL) { \
  • trunk/psLib/src/math/psStats.c

    r2739 r2762  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.103 $ $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 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    793793        }
    794794    }
    795     if (countInt <= 1) {
     795    if (countInt == 0) {
    796796        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);
    798801    } else {
    799802        countFloat = (float)countInt;
  • trunk/psLib/src/mathtypes/psImage.c

    r2375 r2762  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.54 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-11-16 20:00:21 $
     11 *  @version $Revision: 1.55 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-12-20 21:39:42 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    396396
    397397/*****************************************************************************
     398XXX: update function description.
     399 
    398400p_psImagePixelInterpolation(image, x, y): this routine takes as input an
    399401image and coordinates (x, y) and produces as output the corresponding pixel
Note: See TracChangeset for help on using the changeset viewer.