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);
91 file.write((const
char*)(&(ima(
p))),
92 sizeof(
float) * ncols);
101 void save(const Image<I>& ima, const std::
string& filename)
103 mln_trace(
"mln::io::pfm::save");
104 mln::metal::equal<mln_value(I), float >::check();
105 impl::save_(
exact(ima), filename);
108 # endif // ! MLN_INCLUDE_ONLY
117 #endif // ! MLN_IO_PFM_SAVE_HH