27 #ifndef IMG_VALUE_UTIL_H
28 #define IMG_VALUE_UTIL_H
31 #include <boost/random.hpp>
36 namespace ost {
namespace img {
44 boost::mt19937 RandomGenerator(time(NULL));
45 boost::uniform_01<boost::mt19937> UniformRandom(RandomGenerator);
52 Real r=UniformRandom();
53 Real p=UniformRandom()*2.0*M_PI;
54 return Complex(r*cos(p),r*sin(p));
61 Real r=UniformRandom();
62 return static_cast<Word>(r*65536.0);
69 return UniformRandom();
77 boost::uniform_int<> dist(min,max);
85 template <
typename V,
typename R>
98 template <
typename V,
typename R>
100 R
Val2Val(
const V& v) {
return static_cast<R
>(v);}
103 template <
typename T>
119 template <
typename T>
#define DLLEXPORT_OST_IMG_BASE
std::complex< Real > Complex
DLLEXPORT_OST_IMG_BASE String Val2String()
Word Val2Val< Complex, Word >(const Complex &c)
Real Val2Val< Complex, Real >(const Complex &c)
DLLEXPORT_OST_IMG_BASE DataType Val2Type()
Complex Random< Complex >()
DataType Val2Type< Complex >()
DLLEXPORT_OST_IMG_BASE T Random()
String Val2String< Real >()
UniformIntGenerator GetUniformIntGenerator(int min, int max)
DataType Val2Type< Real >()
DLLEXPORT_OST_IMG_BASE R Val2Val(const V &v)
String Val2String< Word >()
DataType Val2Type< Word >()
String Val2String< Complex >()
boost::variate_generator< boost::mt19937 &, boost::uniform_int<> > UniformIntGenerator