* green/mln/io/plot/save_histo_sh.hh (save_histo_sh<2d>) : New func.
---
trunk/milena/sandbox/ChangeLog | 6 +++
.../sandbox/green/mln/io/plot/save_histo_sh.hh | 42 +++++++++++++++++++-
2 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/trunk/milena/sandbox/ChangeLog b/trunk/milena/sandbox/ChangeLog
index 06426ad..16bbebb 100644
--- a/trunk/milena/sandbox/ChangeLog
+++ b/trunk/milena/sandbox/ChangeLog
@@ -1,5 +1,11 @@
2009-09-22 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
+ Adapt styles. Need some 2d code.
+ * green/mln/io/plot/save_histo_sh.hh (save_histo_sh<2d>) : New func.
+
+2009-09-22 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
Fix bug in histo3d_hsl count method.
* green/mln/accu/stat/histo3d_hsl.hh (take) : Fix bug.
diff --git a/trunk/milena/sandbox/green/mln/io/plot/save_histo_sh.hh
b/trunk/milena/sandbox/green/mln/io/plot/save_histo_sh.hh
index e2d26e1..cfd3446 100644
--- a/trunk/milena/sandbox/green/mln/io/plot/save_histo_sh.hh
+++ b/trunk/milena/sandbox/green/mln/io/plot/save_histo_sh.hh
@@ -62,6 +62,10 @@ namespace mln
template <typename I>
void save_histo_sh(const image1d<I>& img, const std::string&
filename);
+
+ template <typename I>
+ void save_histo_sh(const image2d<I>& img, const std::string&
filename);
+
/// \brief Save an histogram image3d as a gnuplot script shell.
/// \param[in] img the 3d image which contains the data to save.
/// \param[in] filename the name of the unix script shell.
@@ -122,13 +126,47 @@ namespace mln
template <typename I>
inline
+ void save_histo_sh(const image2d<I>& img, const std::string&
filename)
+ {
+ trace::entering("mln::io::plot::save_histo_sh<2d>");
+ mln_precondition(img.is_valid());
+
+ std::ofstream out(filename.c_str());
+ mln_piter(image2d<I>) p(img.domain());
+
+ out << "#!/bin/sh" << std::endl;
+ out << "####################################" << std::endl;
+ out << "# Columns = (x,y,val) #" << std::endl;
+ out << "####################################" << std::endl;
+ out << std::endl;
+ out << "gnuplot <<EOF" <<
std::endl;
+ out << "set terminal x11 persist 1" << std::endl;
+ out << "splot '-' with points palette pointtype 0" <<
std::endl;
+
+ for_all(p)
+ //if (0 < img(p))
+ {
+ out << p.row() << " ";
+ out << p.col() << " ";
+ out << img(p) << std::endl;
+ }
+ out << "e" << std::endl;
+ out << "EOF" << std::endl;
+
+ out.close();
+ trace::exiting("mln::io::plot::save_histo_sh<2d>");
+ }
+
+
+ template <typename I>
+ inline
void save_histo_sh(const image3d<I>& img, const std::string&
filename)
{
- trace::entering("mln::io::plot::save_histo_sh<3d>")
+ trace::entering("mln::io::plot::save_histo_sh<3d>");
mln_precondition(img.is_valid());
std::ofstream out(filename.c_str());
- mln_piter(I) p(img.domain());
+ mln_piter(image3d<I>) p(img.domain());
out << "#!/bin/sh" << std::endl;
out << "####################################" << std::endl;
--
1.5.6.5
Show replies by date