00001 // this is brl/bseg/bbas/algo/bsta_sigma_normalizer.h 00002 #ifndef bsta_sigma_normalizer_h_ 00003 #define bsta_sigma_normalizer_h_ 00004 //: 00005 // \file 00006 // \brief A class for adjusting sample standard deviation values such that the probability of underestimation of the true std. dev. is fixed. 00007 // 00008 // \author Daniel Crispell 00009 // \date Feb. 18, 2010 00010 // \verbatim 00011 // Modifications 00012 // Ozge C. Ozcanli - moved from boxm/util to bsta/algo 00013 // \endverbatim 00014 00015 #include <vcl_vector.h> 00016 #include <vbl/vbl_ref_count.h> 00017 #include <vbl/vbl_smart_ptr.h> 00018 #include <vsl/vsl_binary_io.h> 00019 00020 class bsta_sigma_normalizer : public vbl_ref_count 00021 { 00022 public: 00023 //: create a sigma_normalizer object. 00024 bsta_sigma_normalizer(float under_estimation_probability, unsigned int N_PRECOMPUTED = 40); 00025 00026 //: compute the normalization factor for a sample distribution computing with N observations 00027 // \a sigma_norm = sample_sigma * normalization_factor(N); 00028 float normalization_factor(float number_of_observations) const; 00029 00030 //: compute the normalization factor for a sample distribution computed with N observations 00031 // \a sigma_norm = sample_sigma * normalization_factor(N); 00032 float normalization_factor_int(unsigned int number_of_observations) const; 00033 00034 private: 00035 // do not allow default constructor - under-estimation param is necessary 00036 bsta_sigma_normalizer(){} 00037 00038 unsigned int N_PRECOMPUTED_; 00039 vcl_vector<float> unbias_const_; 00040 }; 00041 00042 typedef vbl_smart_ptr<bsta_sigma_normalizer> bsta_sigma_normalizer_sptr; 00043 00044 //--- IO read/write for sptrs-------------------------------------------------- 00045 //: Binary write bsta_sigma_normalizer to stream 00046 void vsl_b_write(vsl_b_ostream& os, bsta_sigma_normalizer const& scene); 00047 void vsl_b_write(vsl_b_ostream& os, const bsta_sigma_normalizer* &p); 00048 void vsl_b_write(vsl_b_ostream& os, bsta_sigma_normalizer_sptr& sptr); 00049 void vsl_b_write(vsl_b_ostream& os, bsta_sigma_normalizer_sptr const& sptr); 00050 00051 //: Binary load boxm2_scene scene from stream. 00052 void vsl_b_read(vsl_b_istream& is, bsta_sigma_normalizer &scene); 00053 void vsl_b_read(vsl_b_istream& is, bsta_sigma_normalizer* p); 00054 void vsl_b_read(vsl_b_istream& is, bsta_sigma_normalizer_sptr& sptr); 00055 void vsl_b_read(vsl_b_istream& is, bsta_sigma_normalizer_sptr const& sptr); 00056 00057 #endif