URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2009-04-03 Fabien Freling <fabien.freling(a)lrde.epita.fr>
Add optional paramater for plot::save().
* mln/io/plot/save.hh: Add optional parameter for save().
---
save.hh | 32 ++++++++++++++++++++------------
1 file changed, 20 insertions(+), 12 deletions(-)
Index: trunk/milena/mln/io/plot/save.hh
===================================================================
--- trunk/milena/mln/io/plot/save.hh (revision 3603)
+++ trunk/milena/mln/io/plot/save.hh (revision 3604)
@@ -51,21 +51,27 @@
/*! 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 @@
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");
}