00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef IMG_ALG_STAT_H
00026 #define IMG_ALG_STAT_H
00027
00028 #include <iosfwd>
00029
00030 #include <ost/img/algorithm.hh>
00031 #include <ost/img/image_state.hh>
00032 #include <ost/img/alg/module_config.hh>
00033
00034 namespace ost { namespace img { namespace alg {
00035
00044 class DLLEXPORT_IMG_ALG StatBase
00045 {
00046 public:
00047 StatBase():
00048 mean_(0.0),
00049 var_(0.0),
00050 std_dev_(0.0),
00051 sum_(0.0),
00052 min_(0.0),
00053 max_(0.0),
00054 maxpos_(),
00055 minpos_(),
00056 rms_(0.0),
00057 skewness_(0.0),
00058 kurtosis_(0.0),
00059 center_of_mass_(0.0,0.0,0.0)
00060 {}
00061
00062
00063 template <typename T, class D>
00064 void VisitState(const ImageStateImpl<T,D>& isi);
00065
00066 void VisitFunction(const Function& f);
00067
00068 static String GetAlgorithmName() {return "Stat";}
00069
00070
00071
00072 Real GetMean() const {return mean_;}
00073 void SetMean(Real m) {mean_=m;}
00074 Real GetMinimum() const {return min_;}
00075 Point GetMinimumPosition() const {return minpos_;}
00076 void SetMinimum(Real m) {min_=m;}
00077 Real GetMaximum() const {return max_;}
00078 Point GetMaximumPosition() const {return maxpos_;}
00079 void SetMaximum(Real m) {max_=m;}
00080 Real GetSum() const {return sum_;}
00081 void SetSum(Real s) {sum_=s;}
00082 Real GetVariance() const {return var_;}
00083 void SetVariance(Real v) {var_=v;}
00084 Real GetStandardDeviation() const {return std_dev_;}
00085 void SetStandardDeviation(Real s) {std_dev_=s;}
00086 Real GetRootMeanSquare() const {return rms_;}
00087 Real GetSkewness() const {return skewness_;}
00088 Real GetKurtosis() const {return kurtosis_;}
00089 Vec3 GetCenterOfMass() const {return center_of_mass_;}
00090 protected:
00091 Real mean_, var_, std_dev_;
00092 Real sum_, min_, max_;
00093 Point maxpos_,minpos_;
00094 Real rms_,skewness_,kurtosis_;
00095 Vec3 center_of_mass_;
00096 };
00097
00098 typedef ImageStateNonModAlgorithm<StatBase> Stat;
00099
00100 DLLEXPORT_IMG_ALG std::ostream& operator<<(std::ostream& o, const Stat& s);
00101 }
00102
00103 OST_IMG_ALG_EXPLICIT_INST_DECL(class,ImageStateNonModAlgorithm<alg::StatBase>)
00104
00105 }}
00106
00107 #endif
00108