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
00049 class DLLEXPORT_IMG_ALG StatBase
00050 {
00051 public:
00052 StatBase():
00053 mean_(0.0),
00054 var_(0.0),
00055 std_dev_(0.0),
00056 sum_(0.0),
00057 min_(0.0),
00058 max_(0.0),
00059 maxpos_(),
00060 minpos_(),
00061 rms_(0.0),
00062 skewness_(0.0),
00063 kurtosis_(0.0),
00064 center_of_mass_(0.0,0.0,0.0)
00065 {}
00066
00067
00068 template <typename T, class D>
00069 void VisitState(const ImageStateImpl<T,D>& isi);
00070
00071 static String GetAlgorithmName() {return "Stat";}
00072
00073
00074
00075 Real GetMean() const {return mean_;}
00076 void SetMean(Real m) {mean_=m;}
00077 Real GetMinimum() const {return min_;}
00078 Point GetMinimumPosition() const {return minpos_;}
00079 void SetMinimum(Real m) {min_=m;}
00080 Real GetMaximum() const {return max_;}
00081 Point GetMaximumPosition() const {return maxpos_;}
00082 void SetMaximum(Real m) {max_=m;}
00083 Real GetSum() const {return sum_;}
00084 void SetSum(Real s) {sum_=s;}
00085 Real GetVariance() const {return var_;}
00086 void SetVariance(Real v) {var_=v;}
00087 Real GetStandardDeviation() const {return std_dev_;}
00088 void SetStandardDeviation(Real s) {std_dev_=s;}
00089 Real GetRootMeanSquare() const {return rms_;}
00090 Real GetSkewness() const {return skewness_;}
00091 Real GetKurtosis() const {return kurtosis_;}
00092 Vec3 GetCenterOfMass() const {return center_of_mass_;}
00093 protected:
00094 Real mean_, var_, std_dev_;
00095 Real sum_, min_, max_;
00096 Point maxpos_,minpos_;
00097 Real rms_,skewness_,kurtosis_;
00098 Vec3 center_of_mass_;
00099 };
00100
00101 typedef ImageStateNonModAlgorithm<StatBase> Stat;
00102
00103 DLLEXPORT_IMG_ALG std::ostream& operator<<(std::ostream& o, const Stat& s);
00104 }
00105
00106 OST_IMG_ALG_EXPLICIT_INST_DECL(class,ImageStateNonModAlgorithm<alg::StatBase>)
00107
00108 }}
00109
00110 #endif
00111