Changeset 11759
- Timestamp:
- Feb 12, 2007, 5:01:24 PM (19 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 6 edited
-
imageops/psImageStats.c (modified) (10 diffs)
-
imageops/psImageStats.h (modified) (4 diffs)
-
math/psHistogram.c (modified) (8 diffs)
-
math/psHistogram.h (modified) (2 diffs)
-
types/psBitSet.c (modified) (8 diffs)
-
types/psBitSet.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImageStats.c
r10999 r11759 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.10 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2007-0 1-09 22:38:52$11 * @version $Revision: 1.104 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2007-02-13 03:01:23 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 44 44 order to do so, we create dummy psVectors and set their "data" pointer to that 45 45 of the input psImages. 46 46 47 47 XXX: use static psVectors 48 48 49 49 XXX: optimize this. 2k vs 4k, sample mean, takes8 seconds on Gene's machine. 50 50 Should take .2. 51 51 *****************************************************************************/ 52 psStats*psImageStats(psStats* stats,52 bool psImageStats(psStats* stats, 53 53 const psImage* in, 54 54 const psImage* mask, … … 58 58 psVector *junkMask = NULL; 59 59 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) 63 63 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); 66 66 } 67 67 … … 116 116 psFree(junkMask); 117 117 psFree(junkData); 118 return (stats);118 return true; 119 119 } 120 120 … … 123 123 and initialized. 124 124 *****************************************************************************/ 125 psHistogram*psImageHistogram(psHistogram* out,125 bool psImageHistogram(psHistogram* out, 126 126 const psImage* in, 127 127 const psImage* mask, 128 128 psMaskType maskVal) 129 129 { 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); 132 132 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); 135 135 } 136 136 psVector* junkData = NULL; … … 188 188 psFree(junkData); 189 189 190 return (out);190 return true; 191 191 } 192 192 … … 197 197 0:512 to -1:1. This routine takes as input an integer N and produces as 198 198 output a vector of evenly spaced floating point values between -1.0:1.0. 199 199 200 200 XXX: Use the p_psNormalizeVector here? 201 201 *****************************************************************************/ 202 double* calcScaleFactors(psS32 n)202 static double* calcScaleFactors(psS32 n) 203 203 { 204 204 PS_ASSERT_INT_NONNEGATIVE(n, NULL); … … 235 235 over all pixels (x,y) in the image. 236 236 *****************************************************************************/ 237 psPolynomial2D*psImageFitPolynomial(psPolynomial2D* coeffs,237 bool psImageFitPolynomial(psPolynomial2D* coeffs, 238 238 const psImage* input) 239 239 { 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); 242 242 if ((input->type.type != PS_TYPE_S8) && 243 243 (input->type.type != PS_TYPE_U16) && … … 245 245 (input->type.type != PS_TYPE_F64)) { 246 246 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); 250 251 psS32 x = 0; 251 252 psS32 y = 0; … … 338 339 psFree(rScalingFactors); 339 340 340 return (coeffs);341 return true; 341 342 } 342 343 -
trunk/psLib/src/imageops/psImageStats.h
r11248 r11759 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.3 0$ $Name: not supported by cvs2svn $12 * @date $Date: 2007-0 1-23 22:47:23 $11 * @version $Revision: 1.31 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2007-02-13 03:01:23 $ 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 14 14 */ … … 36 36 * psF64. 37 37 * 38 * @return psStats* the resulting statistics result(s)38 * @return bool Successful operation? 39 39 */ 40 psStats*psImageStats(40 bool psImageStats( 41 41 psStats* stats, ///< defines statistics to be calculated 42 42 const psImage* in, ///< image (or subimage) to calculate stats … … 51 51 * psS8, psU16, psF32, psF64. 52 52 * 53 * @return psHistogram* the resulting histogram53 * @return bool Successful operation? 54 54 */ 55 psHistogram*psImageHistogram(55 bool psImageHistogram( 56 56 psHistogram* out, ///< input histogram description & target 57 57 const psImage* in, ///< Image data to be histogramed. … … 66 66 * psU16, psF32, psF64. 67 67 * 68 * @return psPolynomial2D* fitted polynomial result68 * @return bool Successful operation? 69 69 * 70 70 */ 71 psPolynomial2D*psImageFitPolynomial(71 bool psImageFitPolynomial( 72 72 psPolynomial2D* coeffs, ///< coefficient structure carries in desired terms & target 73 73 const psImage* input ///< input image -
trunk/psLib/src/math/psHistogram.c
r11674 r11759 5 5 * @author GLG (MHPCC), EAM (IfA) 6 6 * 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 $ 9 9 * 10 10 * Copyright 2006 IfA, University of Hawaii … … 46 46 with the specifed upper and lower limits, and the specifed number of bins. 47 47 This routine will also set the bounds for each of the bins. 48 48 49 49 Input: 50 50 lower … … 92 92 psHistogramAllocGeneric(bounds): allocate a non-uniform histogram structure 93 93 with the specifed bounds. 94 94 95 95 Input: 96 96 bounds … … 144 144 histogram bin which contains the point. The width of that boxcar is defined 145 145 as 2.35 * error. 146 146 147 147 XXX: Must test this. 148 148 *****************************************************************************/ … … 218 218 in that histogram structure in accordance with the input data "in" and the, 219 219 possibly NULL, mask vector. 220 220 221 221 Inputs: 222 222 out … … 227 227 The histogram structure "out". 228 228 *****************************************************************************/ 229 psHistogram*psVectorHistogram(psHistogram* out,229 bool psVectorHistogram(psHistogram* out, 230 230 const psVector* values, 231 231 const psVector* errors, … … 234 234 { 235 235 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); 243 243 PS_ASSERT_VECTOR_NON_NULL(values, out); 244 244 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); 247 247 } 248 248 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); 251 251 } 252 252 … … 329 329 330 330 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 7 7 * @author GLG, MHPCC 8 8 * 9 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $10 * @date $Date: 2007-0 1-23 22:47:23$9 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2007-02-13 03:01:24 $ 11 11 * 12 12 * Copyright 2004-2005 IfA, University of Hawaii … … 81 81 * vector may be of types psU8, psU16, psF32, psF64. 82 82 * 83 * @return psHistogram* histogram result83 * @return bool Successful operation? 84 84 */ 85 psHistogram*psVectorHistogram(85 bool psVectorHistogram( 86 86 psHistogram* out, ///< Histogram data 87 87 const psVector* values, ///< Vector to analyse -
trunk/psLib/src/types/psBitSet.c
r11708 r11759 11 11 * @author Robert DeSonia, MHPCC 12 12 * 13 * @version $Revision: 1.4 0$ $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 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 105 105 106 106 107 psBitSet*psBitSetSet(psBitSet* bitSet,107 bool psBitSetSet(psBitSet* bitSet, 108 108 long bit) 109 109 { … … 113 113 psError(PS_ERR_BAD_PARAMETER_NULL, true, 114 114 _("Can not operate on a NULL psBitSet.")); 115 return bitSet;115 return false; 116 116 } else if ( (bit < 0) || 117 117 (bit > bitSet->n * 8 - 1) ) { … … 119 119 _("The specified bit position (%ld) is invalid. Position must be between 0 and %ld."), 120 120 bit, bitSet->n * 8 - 1); 121 return bitSet;121 return false; 122 122 } 123 123 // Variable byte is the byte in the array that contains the bit to be set … … 125 125 *byte |= mask(bit); 126 126 127 return bitSet;128 } 129 130 psBitSet*psBitSetClear(psBitSet* bitSet,127 return true; 128 } 129 130 bool psBitSetClear(psBitSet* bitSet, 131 131 long bit) 132 132 { … … 136 136 psError(PS_ERR_BAD_PARAMETER_NULL, true, 137 137 _("Can not operate on a NULL psBitSet.")); 138 return bitSet;138 return false; 139 139 } else if ( (bit < 0) || 140 140 (bit > bitSet->n * 8 - 1) ) { … … 142 142 _("The specified bit position (%ld) is invalid. Position must be between 0 and %ld."), 143 143 bit, bitSet->n * 8 - 1); 144 return bitSet;144 return false; 145 145 } 146 146 // Variable byte is the byte in the array that contains the bit to be set … … 148 148 *byte &= ! mask(bit); 149 149 150 return bitSet;150 return true; 151 151 } 152 152 -
trunk/psLib/src/types/psBitSet.h
r11708 r11759 11 11 * @author Ross Harman, MHPCC 12 12 * 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 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 91 91 * result in an psBitSet that looks like 00000000 00001000. 92 92 * 93 * @return psBitSet* : Pointer to struct containing psBitSet.93 * @return bool : Successful operation? 94 94 */ 95 psBitSet*psBitSetSet(95 bool psBitSetSet( 96 96 psBitSet* bitSet, ///< Pointer to psBitSet to be set. 97 97 long bit ///< Bit to be set. … … 105 105 * the byte array. 106 106 * 107 * @return psBitSet* : Pointer to struct containing psBitSet.107 * @return bool : Successful operation? 108 108 */ 109 psBitSet*psBitSetClear(109 bool psBitSetClear( 110 110 psBitSet* bitSet, ///< Pointer to psBitSet to be cleared. 111 111 long bit ///< Bit to be cleared.
Note:
See TracChangeset
for help on using the changeset viewer.
