27 #ifndef MLN_IO_PLOT_SAVE_HH
28 # define MLN_IO_PLOT_SAVE_HH
36 # include <mln/core/image/image1d.hh>
37 # include <mln/util/array.hh>
53 void save(
const image1d<I>& ima,
const std::string& filename);
61 void save(
const util::array<T>& arr,
const std::string& filename,
66 void save(
const histo::array<T>& arr,
const std::string& filename);
68 # ifndef MLN_INCLUDE_ONLY
75 void save(
const image1d<T>& ima,
const std::string& filename)
77 trace::entering(
"mln::io::plot::save");
79 std::ofstream file_out(filename.c_str());
80 unsigned end = ima.bbox().pmax().ind();
81 for (
unsigned i = ima.bbox().pmin().ind(); i <= end; ++i)
82 file_out << i <<
" " << ima.at_(i) << std::endl;
84 trace::exiting(
"mln::io::plot::save");
92 trace::entering(
"mln::io::plot::save");
94 std::ofstream file_out(filename.c_str());
95 for (
unsigned i = 0; i < arr.
nelements(); ++i)
96 file_out << start_value + i <<
" " << arr[i] << std::endl;
98 trace::exiting(
"mln::io::plot::save");
101 template <
typename T>
105 trace::entering(
"mln::io::plot::save");
107 std::ofstream file_out(filename.c_str());
108 for (
unsigned i = 0; i < arr.nvalues(); ++i)
109 file_out << i <<
" " << arr[i] << std::endl;
111 trace::exiting(
"mln::io::plot::save");
115 # endif // ! MLN_INCLUDE_ONLY
124 #endif // ! MLN_IO_PLOT_SAVE_HH