IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 3, 2004, 3:05:00 PM (22 years ago)
Author:
desonia
Message:

changed the psError signature to match SDRS. Also made misc. cleanups as
I was combing the files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/image/psImageStats.c

    r2265 r2273  
    11/** @file psImageStats.c
    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.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 Hawaii
    15 */
     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 */
    1616
    1717#include <stdlib.h>
     
    4646
    4747    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);
    5150        return NULL;
    5251    }
    5352
    5453    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);
    5856        return NULL;
    5957    }
    6058
    6159    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);
    6562        return stats;
    6663    }
     
    7673            char* typeStr;
    7774            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);
    8278            psFree(junkData);
    8379            return NULL;
     
    125121            char* typeStr;
    126122            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);
    131126            psFree(out);
    132127            psFree(junkData);
     
    150145
    151146/*****************************************************************************
    152 CalcScaleFactorsEval(n): The Chebyshev polynomials are defined over the
     147calcScaleFactorsEval(n): The Chebyshev polynomials are defined over the
    153148interval [-1.0 : 1.0].  Images typically have sizes of 512x512 or more.  In
    154149order to use Chebyshev polynomials, we must scale the coordinates from
     
    156151output a vector of evenly spaced floating point values between -1.0:1.0.
    157152 *****************************************************************************/
    158 double *CalcScaleFactors(psS32 n)
    159 {
    160     PS_INT_CHEC_NON_NEGATIVE(n, NULL);
     153double* calcScaleFactors(psS32 n)
     154{
     155    PS_INT_CHECK_NON_NEGATIVE(n, NULL);
    161156    psS32 i = 0;
    162157    double tmp = 0.0;
     
    172167}
    173168
    174 psVector *VecCalcScaleFactors(psVector *scalingFactors, psS32 n)
     169psVector *VeccalcScaleFactors(psVector *scalingFactors, psS32 n)
    175170{
    176171    PS_VECTOR_CHECK_NULL(scalingFactors, NULL);
    177172    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);
    179174    psS32 i = 0;
    180175    double tmp = 0.0;
     
    243238            (input->type.type != PS_TYPE_F32) &&
    244239            (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");
    246242    }
    247243    PS_POLY_CHECK_NULL(coeffs, NULL);
     
    259255    // Check for null inputs
    260256    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);
    264259        return NULL;
    265260    }
    266261
    267262    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);
    271265        return NULL;
    272266    }
     
    283277    // We scale the pixel positions to values
    284278    // 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);
    287281
    288282    // Determine how many Chebyshev polynomials
     
    363357            (input->type.type != PS_TYPE_F32) &&
    364358            (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");
    366361    }
    367362    PS_POLY_CHECK_NULL(coeffs, NULL);
     
    376371    double *cScalingFactors = NULL;
    377372    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    }
    380387
    381388    // We scale the pixel positions to values between -1.0 and 1.0
    382389    // 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);
    385392
    386393    // Determine how many Chebyshev polynomials
Note: See TracChangeset for help on using the changeset viewer.