Commit 82a63ba5 authored by Fabien Freling's avatar Fabien Freling

Add optional paramater for plot::save().

	* mln/io/plot/save.hh: Add optional parameter for save().

git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@3604 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 37cb1f3a
2009-04-03 Fabien Freling <fabien.freling@lrde.epita.fr>
Add optional paramater for plot::save().
* mln/io/plot/save.hh: Add optional parameter for save().
2009-04-01 Guillaume Lazzara <lazzara@lrde.epita.fr>
Add labeling::wrap routine.
......@@ -51,21 +51,27 @@ namespace mln
/*! Save a Milena 1D image in a plot file.
*
* \param[out] ima A reference to the image to save.
* \param[in] filename The output file.
* \param[in] ima A reference to the image to save.
* \param[out] filename The output file.
* \param[in] start_value The start index value of the plot
* (optional).
*/
template <typename I>
void save(image1d<I>& ima,
const std::string& filename);
const std::string& filename,
int start_value = 0);
/*! Save a Milena array in a plot file.
*
* \param[out] ima A reference to the array to save.
* \param[in] filename The output file.
* \param[in] arr A reference to the array to save.
* \param[out] filename The output file.
* \param[in] start_value The start index value of the plot
* (optional).
*/
template <typename I>
void save(util::array<I>& arr,
const std::string& filename);
const std::string& filename,
int start_value = 0);
# ifndef MLN_INCLUDE_ONLY
......@@ -73,26 +79,28 @@ namespace mln
template <typename I>
inline
void save(image1d<I>& ima, const std::string& filename)
void save(image1d<I>& ima, const std::string& filename,
int start_value = 0)
{
trace::entering("mln::io::plot::save");
std::ofstream file_out(filename.c_str());
for (unsigned i = 0; i < ima.ninds(); ++i)
file_out << i << ", " << ima.at_(i) << std::endl;
for (int i = 0; i < ima.ninds(); ++i)
file_out << start_value + i << ", " << ima.at_(i) << std::endl;
trace::exiting("mln::io::plot::save");
}
template <typename I>
inline
void save(util::array<I>& arr, const std::string& filename)
void save(util::array<I>& arr, const std::string& filename,
int start_value = 0)
{
trace::entering("mln::io::plot::save");
std::ofstream file_out(filename.c_str());
for (unsigned i = 0; i < arr.nelements(); ++i)
file_out << i << ", " << arr[i] << std::endl;
for (int i = 0; i < arr.nelements(); ++i)
file_out << start_value + i << ", " << arr[i] << std::endl;
trace::exiting("mln::io::plot::save");
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment