00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef CORE_CIO_H
00010 #define CORE_CIO_H
00011
00012 #include <core/imaging2.hpp>
00013 #include <boost/numeric/ublas/io.hpp>
00014
00015 #include <set>
00016 #include <map>
00017
00018
00019 namespace imaging
00020 {
00024 template <class element_t>
00025 std::ostream & operator<<(std::ostream & out, const std::vector<element_t> & vector)
00026 {
00027 out << "[" << vector.size() << "](";
00028 for(size_t i = 0; i < vector.size() - 1; ++i)
00029 out << vector[i] << ",";
00030
00031 out << vector[vector.size() - 1] << ")";
00032
00033 return out;
00034 }
00035
00036
00040 template <class key_t, class data_t>
00041 std::ostream & operator<<(std::ostream & out, const std::map<key_t, data_t> & map)
00042 {
00043 typename std::map<key_t, data_t>::const_iterator iter;
00044
00045 for(iter = map.begin(); iter != map.end(); ++iter)
00046 out << "(" << iter->first << "," << iter->second << ") ";
00047
00048 return out;
00049 }
00050
00051
00055 template <class data_t>
00056 std::ostream & operator<<(std::ostream & out, const std::set<data_t> & set)
00057 {
00058 typename std::set<data_t>::const_iterator iter;
00059
00060 for(iter = set.begin(); iter != set.end(); ++iter)
00061 out << *iter << ", ";
00062
00063 return out;
00064 }
00065
00066
00070 template <class key_t, class data_t>
00071 std::ostream & operator<<(std::ostream & out, const std::pair<key_t, data_t> & pair)
00072 {
00073 out << "(" << pair.first << ", " << pair.second << ")";
00074
00075 return out;
00076 }
00077
00081 void output_matrix_matlab_style(std::ostream & out, const ublas::matrix<float_t> & matrix);
00082
00086 void output_vector_matlab_style(std::ostream & out, const ublas::vector<float_t> & vector);
00087
00091 void output_matrix_gnuplot_style(std::ostream & out, const ublas::matrix<float_t> & matrix);
00092
00096 void output_vector_gnuplut_style(std::ostream & out, const ublas::vector<float_t> & vector);
00097 }
00098
00099
00100 #endif