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>
Word Val2Val< Complex, Word >(const Complex &c)
std::complex< Real > Complex
DataType Val2Type< Word >()
DLLEXPORT_OST_IMG_BASE R Val2Val(const V &v)
Real Val2Val< Complex, Real >(const Complex &c)
String Val2String< Complex >()
DLLEXPORT_OST_IMG_BASE DataType Val2Type()
String Val2String< Word >()
DataType Val2Type< Complex >()
DLLEXPORT_OST_IMG_BASE String Val2String()
String Val2String< Real >()
Complex Random< Complex >()
UniformIntGenerator GetUniformIntGenerator(int min, int max)
DLLEXPORT_OST_IMG_BASE T Random()
DataType Val2Type< Real >()
#define DLLEXPORT_OST_IMG_BASE
boost::variate_generator< boost::mt19937 &, boost::uniform_int<> > UniformIntGenerator