26 #ifndef MLN_IO_PFM_SAVE_HH
27 # define MLN_IO_PFM_SAVE_HH
37 # include <mln/core/alias/point2d.hh>
38 # include <mln/geom/size2d.hh>
39 # include <mln/metal/equal.hh>
40 # include <mln/metal/bexpr.hh>
58 void save(
const Image<I>& ima,
const std::string& filename);
60 # ifndef MLN_INCLUDE_ONLY
67 void save_header_(
const I& ima, std::ofstream& file)
70 <<
"float" << std::endl;
75 void save_(
const Image<I>& ima_,
const std::string& filename)
77 const I& ima = exact(ima_);
79 std::ofstream file(filename.c_str());
80 save_header_(ima, file);
84 const mln_deduce(I, site, coord)
85 min_row = geom::min_row(ima),
86 max_row = geom::max_row(ima);
90 for (p.row() = min_row; p.row() <= max_row; ++p.row())
91 file.write((const
char*)(&(ima(p))),
92 sizeof(
float) * ncols);
101 void save(const
Image<I>& ima, const std::
string& filename)
103 trace::entering(
"mln::io::pfm::save");
105 impl::save_(exact(ima), filename);
106 trace::exiting(
"mln::io::pfm::save");
109 # endif // ! MLN_INCLUDE_ONLY
118 #endif // ! MLN_IO_PFM_SAVE_HH