IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11759


Ignore:
Timestamp:
Feb 12, 2007, 5:01:24 PM (20 years ago)
Author:
Paul Price
Message:

Fixing bug 843 by modifying functions that (unnecessarily) returned an input to return a bool.

Location:
trunk/psLib/src
Files:
6 edited

Legend:

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

    r10999 r11759  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.103 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2007-01-09 22:38:52 $
     11 *  @version $Revision: 1.104 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2007-02-13 03:01:23 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
    … …  
    4444order to do so, we create dummy psVectors and set their "data" pointer to that
    4545of the input psImages.
    46  
     46
    4747XXX: use static psVectors
    48  
     48
    4949XXX: optimize this.  2k vs 4k, sample mean, takes8 seconds on Gene's machine.
    5050Should take .2.
    5151 *****************************************************************************/
    52 psStats* psImageStats(psStats* stats,
     52bool psImageStats(psStats* stats,
    5353                      const psImage* in,
    5454                      const psImage* mask,
    … …  
    5858    psVector *junkMask = NULL;
    5959
    60     PS_ASSERT_PTR_NON_NULL(stats, NULL);
    61     PS_ASSERT_INT_NONZERO(stats->options, NULL);
    62     PS_ASSERT_IMAGE_NON_NULL(in, NULL)
     60    PS_ASSERT_PTR_NON_NULL(stats, false);
     61    PS_ASSERT_INT_NONZERO(stats->options, false);
     62    PS_ASSERT_IMAGE_NON_NULL(in, false)
    6363    if (mask != NULL) {
    64         PS_ASSERT_IMAGE_TYPE(mask, PS_TYPE_U8, NULL);
    65         PS_ASSERT_IMAGES_SIZE_EQUAL(in, mask, NULL);
     64        PS_ASSERT_IMAGE_TYPE(mask, PS_TYPE_U8, false);
     65        PS_ASSERT_IMAGES_SIZE_EQUAL(in, mask, false);
    6666    }
    6767
    … …  
    116116    psFree(junkMask);
    117117    psFree(junkData);
    118     return(stats);
     118    return true;
    119119}
    120120
    … …  
    123123and initialized.
    124124 *****************************************************************************/
    125 psHistogram* psImageHistogram(psHistogram* out,
     125bool psImageHistogram(psHistogram* out,
    126126                              const psImage* in,
    127127                              const psImage* mask,
    128128                              psMaskType maskVal)
    129129{
    130     PS_ASSERT_PTR_NON_NULL(out, NULL);
    131     PS_ASSERT_PTR_NON_NULL(in, NULL);
     130    PS_ASSERT_PTR_NON_NULL(out, false);
     131    PS_ASSERT_PTR_NON_NULL(in, false);
    132132    if (mask != NULL) {
    133         PS_ASSERT_IMAGE_TYPE(mask, PS_TYPE_U8, NULL);
    134         PS_ASSERT_IMAGES_SIZE_EQUAL(in, mask, NULL);
     133        PS_ASSERT_IMAGE_TYPE(mask, PS_TYPE_U8, false);
     134        PS_ASSERT_IMAGES_SIZE_EQUAL(in, mask, false);
    135135    }
    136136    psVector* junkData = NULL;
    … …  
    188188    psFree(junkData);
    189189
    190     return (out);
     190    return true;
    191191}
    192192
    … …  
    1971970:512 to -1:1.  This routine takes as input an integer N and produces as
    198198output a vector of evenly spaced floating point values between -1.0:1.0.
    199  
     199
    200200XXX: Use the p_psNormalizeVector here?
    201201 *****************************************************************************/
    202 double* calcScaleFactors(psS32 n)
     202static double* calcScaleFactors(psS32 n)
    203203{
    204204    PS_ASSERT_INT_NONNEGATIVE(n, NULL);
    … …  
    235235        over all pixels (x,y) in the image.
    236236  *****************************************************************************/
    237 psPolynomial2D* psImageFitPolynomial(psPolynomial2D* coeffs,
     237bool psImageFitPolynomial(psPolynomial2D* coeffs,
    238238                                     const psImage* input)
    239239{
    240     PS_ASSERT_IMAGE_NON_NULL(input, NULL);
    241     PS_ASSERT_IMAGE_NON_EMPTY(input, NULL);
     240    PS_ASSERT_IMAGE_NON_NULL(input, false);
     241    PS_ASSERT_IMAGE_NON_EMPTY(input, false);
    242242    if ((input->type.type != PS_TYPE_S8) &&
    243243            (input->type.type != PS_TYPE_U16) &&
    … …  
    245245            (input->type.type != PS_TYPE_F64)) {
    246246        psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Unallowable image type.\n");
    247     }
    248     PS_ASSERT_POLY_NON_NULL(coeffs, NULL);
    249     PS_ASSERT_POLY_TYPE(coeffs, PS_POLYNOMIAL_CHEB, NULL);
     247        return false;
     248    }
     249    PS_ASSERT_POLY_NON_NULL(coeffs, false);
     250    PS_ASSERT_POLY_TYPE(coeffs, PS_POLYNOMIAL_CHEB, false);
    250251    psS32 x = 0;
    251252    psS32 y = 0;
    … …  
    338339    psFree(rScalingFactors);
    339340
    340     return (coeffs);
     341    return true;
    341342}
    342343
  • trunk/psLib/src/imageops/psImageStats.h

    r11248 r11759  
    99 * @author GLG, MHPCC
    1010 *
    11  * @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    12  * @date $Date: 2007-01-23 22:47:23 $
     11 * @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     12 * @date $Date: 2007-02-13 03:01:23 $
    1313 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
    1414 */
    … …  
    3636 *  psF64.
    3737 *
    38  *  @return psStats*    the resulting statistics result(s)
     38 *  @return bool   Successful operation?
    3939 */
    40 psStats* psImageStats(
     40bool psImageStats(
    4141    psStats* stats,                    ///< defines statistics to be calculated
    4242    const psImage* in,                 ///< image (or subimage) to calculate stats
    … …  
    5151 *  psS8, psU16, psF32, psF64.
    5252 *
    53  *  @return psHistogram*     the resulting histogram
     53 *  @return bool   Successful operation?
    5454 */
    55 psHistogram* psImageHistogram(
     55bool psImageHistogram(
    5656    psHistogram* out,                  ///< input histogram description & target
    5757    const psImage* in,                 ///< Image data to be histogramed.
    … …  
    6666 *  psU16, psF32, psF64.
    6767 *
    68  *  @return psPolynomial2D*     fitted polynomial result
     68 *  @return bool   Successful operation?
    6969 *
    7070 */
    71 psPolynomial2D* psImageFitPolynomial(
     71bool psImageFitPolynomial(
    7272    psPolynomial2D* coeffs,            ///< coefficient structure carries in desired terms & target
    7373    const psImage* input               ///< input image
  • trunk/psLib/src/math/psHistogram.c

    r11674 r11759  
    55 *  @author GLG (MHPCC), EAM (IfA)
    66 *
    7  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2007-02-07 01:15:49 $
     7 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2007-02-13 03:01:24 $
    99 *
    1010 *  Copyright 2006 IfA, University of Hawaii
    … …  
    4646with the specifed upper and lower limits, and the specifed number of bins.
    4747This routine will also set the bounds for each of the bins.
    48  
     48
    4949Input:
    5050    lower
    … …  
    9292psHistogramAllocGeneric(bounds): allocate a non-uniform histogram structure
    9393with the specifed bounds.
    94  
     94
    9595Input:
    9696    bounds
    … …  
    144144histogram bin which contains the point.  The width of that boxcar is defined
    145145as 2.35 * error.
    146  
     146
    147147XXX: Must test this.
    148148 *****************************************************************************/
    … …  
    218218in that histogram structure in accordance with the input data "in" and the,
    219219possibly NULL, mask vector.
    220  
     220
    221221Inputs:
    222222    out
    … …  
    227227    The histogram structure "out".
    228228 *****************************************************************************/
    229 psHistogram* psVectorHistogram(psHistogram* out,
     229bool psVectorHistogram(psHistogram* out,
    230230                               const psVector* values,
    231231                               const psVector* errors,
    … …  
    234234{
    235235    psTrace("psLib.math", 3, "---- %s() begin  ----\n", __func__);
    236     PS_ASSERT_PTR_NON_NULL(out, NULL);
    237     PS_ASSERT_VECTOR_NON_NULL(out->bounds, NULL);
    238     PS_ASSERT_VECTOR_TYPE(out->bounds, PS_TYPE_F32, NULL);
    239     PS_ASSERT_INT_NONNEGATIVE(out->bounds->n, NULL);
    240     PS_ASSERT_VECTOR_NON_NULL(out->nums, NULL);
    241     PS_ASSERT_VECTOR_TYPE(out->nums, PS_TYPE_F32, NULL);
    242     PS_ASSERT_INT_NONNEGATIVE(out->nums->n, NULL);
     236    PS_ASSERT_PTR_NON_NULL(out, false);
     237    PS_ASSERT_VECTOR_NON_NULL(out->bounds, false);
     238    PS_ASSERT_VECTOR_TYPE(out->bounds, PS_TYPE_F32, false);
     239    PS_ASSERT_INT_NONNEGATIVE(out->bounds->n, false);
     240    PS_ASSERT_VECTOR_NON_NULL(out->nums, false);
     241    PS_ASSERT_VECTOR_TYPE(out->nums, PS_TYPE_F32, false);
     242    PS_ASSERT_INT_NONNEGATIVE(out->nums->n, false);
    243243    PS_ASSERT_VECTOR_NON_NULL(values, out);
    244244    if (mask) {
    245         PS_ASSERT_VECTORS_SIZE_EQUAL(values, mask, NULL);
    246         PS_ASSERT_VECTOR_TYPE(mask, PS_TYPE_U8, NULL);
     245        PS_ASSERT_VECTORS_SIZE_EQUAL(values, mask, false);
     246        PS_ASSERT_VECTOR_TYPE(mask, PS_TYPE_U8, false);
    247247    }
    248248    if (errors) {
    249         PS_ASSERT_VECTORS_SIZE_EQUAL(values, errors, NULL);
    250         PS_ASSERT_VECTOR_TYPE(errors, values->type.type, NULL);
     249        PS_ASSERT_VECTORS_SIZE_EQUAL(values, errors, false);
     250        PS_ASSERT_VECTOR_TYPE(errors, values->type.type, false);
    251251    }
    252252
    … …  
    329329
    330330    psTrace("psLib.math", 3, "---- %s() end  ----\n", __func__);
    331     return (out);
    332 }
    333 
     331    return true;
     332}
     333
  • trunk/psLib/src/math/psHistogram.h

    r11248 r11759  
    77 * @author GLG, MHPCC
    88 *
    9  * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    10  * @date $Date: 2007-01-23 22:47:23 $
     9 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     10 * @date $Date: 2007-02-13 03:01:24 $
    1111 *
    1212 * Copyright 2004-2005 IfA, University of Hawaii
    … …  
    8181 *  vector may be of types psU8, psU16, psF32, psF64.
    8282 *
    83  *  @return psHistogram*   histogram result
     83 *  @return bool   Successful operation?
    8484 */
    85 psHistogram* psVectorHistogram(
     85bool psVectorHistogram(
    8686    psHistogram* out,                  ///< Histogram data
    8787    const psVector* values,            ///< Vector to analyse
  • trunk/psLib/src/types/psBitSet.c

    r11708 r11759  
    1111 *  @author Robert DeSonia, MHPCC
    1212 *
    13  *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2007-02-08 21:33:57 $
     13 *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2007-02-13 03:01:24 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
    … …  
    105105
    106106
    107 psBitSet* psBitSetSet(psBitSet* bitSet,
     107bool psBitSetSet(psBitSet* bitSet,
    108108                      long bit)
    109109{
    … …  
    113113        psError(PS_ERR_BAD_PARAMETER_NULL, true,
    114114                _("Can not operate on a NULL psBitSet."));
    115         return bitSet;
     115        return false;
    116116    } else if ( (bit < 0) ||
    117117                (bit > bitSet->n * 8 - 1) ) {
    … …  
    119119                _("The specified bit position (%ld) is invalid.  Position must be between 0 and %ld."),
    120120                bit, bitSet->n * 8 - 1);
    121         return bitSet;
     121        return false;
    122122    }
    123123    // Variable byte is the byte in the array that contains the bit to be set
    … …  
    125125    *byte |= mask(bit);
    126126
    127     return bitSet;
    128 }
    129 
    130 psBitSet* psBitSetClear(psBitSet* bitSet,
     127    return true;
     128}
     129
     130bool psBitSetClear(psBitSet* bitSet,
    131131                        long bit)
    132132{
    … …  
    136136        psError(PS_ERR_BAD_PARAMETER_NULL, true,
    137137                _("Can not operate on a NULL psBitSet."));
    138         return bitSet;
     138        return false;
    139139    } else if ( (bit < 0) ||
    140140                (bit > bitSet->n * 8 - 1) ) {
    … …  
    142142                _("The specified bit position (%ld) is invalid.  Position must be between 0 and %ld."),
    143143                bit, bitSet->n * 8 - 1);
    144         return bitSet;
     144        return false;
    145145    }
    146146    // Variable byte is the byte in the array that contains the bit to be set
    … …  
    148148    *byte &= ! mask(bit);
    149149
    150     return bitSet;
     150    return true;
    151151}
    152152
  • trunk/psLib/src/types/psBitSet.h

    r11708 r11759  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2007-02-08 21:33:57 $
     13 *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2007-02-13 03:01:24 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
    … …  
    9191 *  result in an psBitSet that looks like 00000000 00001000.
    9292 *
    93  *  @return  psBitSet* : Pointer to struct containing psBitSet.
     93 *  @return  bool : Successful operation?
    9494 */
    95 psBitSet* psBitSetSet(
     95bool psBitSetSet(
    9696    psBitSet* bitSet,                  ///< Pointer to psBitSet to be set.
    9797    long bit                           ///< Bit to be set.
    … …  
    105105 *  the byte array.
    106106 *
    107  *  @return  psBitSet* : Pointer to struct containing psBitSet.
     107 *  @return  bool : Successful operation?
    108108 */
    109 psBitSet* psBitSetClear(
     109bool psBitSetClear(
    110110    psBitSet* bitSet,                  ///< Pointer to psBitSet to be cleared.
    111111    long bit                           ///< Bit to be cleared.
Note: See TracChangeset for help on using the changeset viewer.