contrib/brl/bbas/bsta/io/bsta_io_parzen_sphere.h
Go to the documentation of this file.
00001 // This is brl/bbas/bsta/io/bsta_io_parzen_sphere.h
00002 #ifndef bsta_io_parzen_sphere_h_
00003 #define bsta_io_parzen_sphere_h_
00004 
00005 //:
00006 // \file
00007 // \brief Binary I/O for spherical parzen windows
00008 // \author Joseph L. Mundy
00009 // \date October 12, 2008
00010 //
00011 // \verbatim
00012 //  Modifications
00013 // \endverbatim
00014 // Do not remove the following statement
00015 // Approved for Public Release, Distribution Unlimited (DISTAR Case 12529)
00016 //
00017 #include <bsta/bsta_parzen_sphere.h>
00018 #include <vsl/vsl_binary_io.h>
00019 #include <vnl/io/vnl_io_vector_fixed.h>
00020 #include <vsl/vsl_vector_io.h>
00021 #include <vcl_iostream.h>
00022 
00023 //: Binary save bsta_parzen_sphere to stream.
00024 template <class T, unsigned n>
00025 void
00026 vsl_b_write(vsl_b_ostream &os, const bsta_parzen_sphere<T,n>& g)
00027 {
00028   vsl_b_write(os,g.bandwidth());
00029 
00030   typedef typename bsta_parzen<T,n>::vector_type vector_;
00031 
00032   vcl_vector<vector_> samples = g.samples();
00033 
00034   vsl_b_write(os,samples);
00035 }
00036 
00037 //: Binary load bsta_parzen_sphere from stream.
00038 template <class T, unsigned n>
00039 void
00040 vsl_b_read(vsl_b_istream &is, bsta_parzen_sphere<T,n>& g)
00041 {
00042   typedef typename bsta_parzen<T,n>::vector_type vector_;
00043   vcl_vector<vector_> samples;
00044   T bandwidth;
00045   vsl_b_read(is, bandwidth);
00046   vsl_b_read(is, samples);
00047   g.set_bandwidth(bandwidth);
00048   g.insert_samples(samples);
00049 }
00050 
00051 //: Print summary
00052 template <class T, unsigned n>
00053 void
00054 vsl_print_summary(vcl_ostream &os, const bsta_parzen_sphere<T,n>& g)
00055 {
00056   os << "parzen (sphere) mean:"<<g.mean()<<" n_samples"<<g.size();
00057 }
00058 
00059 
00060 #endif // bsta_io_parzen_sphere_h_