
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena ChangeLog: 2007-09-05 Matthieu Garrigues <garrigues.matthieu@lrde.epita.fr> Add 1d handling * mln/convert/to_image.hh: . * mln/core/box1d.hh: New. * mln/core/dpoint1d.hh: New. * mln/core/image1d_b.hh: New. * mln/core/internal/box_impl.hh: . * mln/core/neighb1d.hh: New. * mln/core/pixter1d_b.hh: New. * mln/core/point1d.hh: New. * mln/core/w_window1d_float.hh: New. * mln/core/w_window1d_int.hh: New. * mln/core/win/segment1d.hh: New. * mln/core/window1d.hh: New. * mln/geom/max_ind.hh: New. * mln/geom/min_ind.hh: New. * mln/geom/ninds.hh: New. * mln/geom/size1d.hh: New. * mln/make/box1d.hh: New. * mln/make/dpoint1d.hh: New. * mln/make/point1d.hh: New. * mln/make/w_window1d.hh: New. * mln/make/w_window1d_int.hh: New. * mln/make/window1d.hh: New. * sandbox/garrigues/TODO: New. * tests/box1d.cc: New. * tests/dpoint1d.cc: New. * tests/image1d_b.cc: New. * tests/pixter1d_b.cc: New. * tests/point1d.cc: New. * tests/w_window1d_int.cc: New. * tests/window1d.cc: New. mln/convert/to_image.hh | 6 mln/core/box1d.hh | 58 ++++ mln/core/dpoint1d.hh | 66 +++++ mln/core/image1d_b.hh | 516 ++++++++++++++++++++++++++++++++++++++++++ mln/core/internal/box_impl.hh | 33 ++ mln/core/neighb1d.hh | 79 ++++++ mln/core/pixter1d_b.hh | 90 +++++++ mln/core/point1d.hh | 56 ++++ mln/core/w_window1d_float.hh | 56 ++++ mln/core/w_window1d_int.hh | 56 ++++ mln/core/win/segment1d.hh | 181 ++++++++++++++ mln/core/window1d.hh | 56 ++++ mln/geom/max_ind.hh | 66 +++++ mln/geom/min_ind.hh | 66 +++++ mln/geom/ninds.hh | 67 +++++ mln/geom/size1d.hh | 39 +++ mln/make/box1d.hh | 96 +++++++ mln/make/dpoint1d.hh | 70 +++++ mln/make/point1d.hh | 71 +++++ mln/make/w_window1d.hh | 86 +++++++ mln/make/w_window1d_int.hh | 75 ++++++ mln/make/window1d.hh | 81 ++++++ sandbox/garrigues/TODO | 22 + tests/box1d.cc | 43 +++ tests/dpoint1d.cc | 53 ++++ tests/image1d_b.cc | 48 +++ tests/pixter1d_b.cc | 94 +++++++ tests/point1d.cc | 56 ++++ tests/w_window1d_int.cc | 73 +++++ tests/window1d.cc | 56 ++++ 30 files changed, 2415 insertions(+) Index: trunk/milena/tests/window1d.cc =================================================================== --- trunk/milena/tests/window1d.cc (revision 0) +++ trunk/milena/tests/window1d.cc (revision 1071) @@ -0,0 +1,56 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +/*! \file tests/window1d.cc + * + * \brief Tests on mln::window1d. + */ + +#include <mln/core/window1d.hh> +#include <mln/core/image1d_b.hh> +#include <mln/convert/to_image.hh> +#include <mln/debug/println.hh> + + + +int main() +{ + using namespace mln; + + window1d w; + + mln_assertion(w.is_centered() == false); + mln_assertion(w.is_symmetric() == true); + + w.insert(make::dpoint1d(-1)); + w.insert(make::dpoint1d( 1)); + + image1d_b<bool> ima = convert::to_image(w); + debug::println(ima); + + mln_assertion(w.delta() == 1); +} Index: trunk/milena/tests/w_window1d_int.cc =================================================================== --- trunk/milena/tests/w_window1d_int.cc (revision 0) +++ trunk/milena/tests/w_window1d_int.cc (revision 1071) @@ -0,0 +1,73 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +/*! \file tests/w_window1d_int.cc + * + * \brief Tests on mln::w_window1d_int. + */ + +#include <mln/core/w_window1d_int.hh> + +#include <mln/convert/to_image.hh> +#include <mln/convert/to_w_window.hh> + +#include <mln/convert/to_fun.hh> +#include <mln/estim/sum.hh> + + +int f(mln::point1d p) +{ + return p.ind (); +} + + +int main() +{ + using namespace mln; + + { + int ws[] = { -1, 0, 1, + -2, 0, 2, + -1, 0, 1 }; + w_window1d_int w_win = make::w_window1d(ws); + + image1d_b<int> ima = convert::to_image(w_win); + w_window1d_int w_win_2 = convert::to_w_window(ima); + mln_assertion(w_win_2 == w_win); + } + + { + w_window1d_int w_win = make::w_window(win::rectangle1d(3, 5), + convert::to_fun(f)); + // -3 -2 -1 0 +1 + // -2 -1 0 +1 +2 + // -1 0 +1 +2 +3 + image1d_b<int> ima = convert::to_image(w_win); + mln_assertion(estim::sum(ima) == 0); + } + +} Index: trunk/milena/tests/box1d.cc =================================================================== --- trunk/milena/tests/box1d.cc (revision 0) +++ trunk/milena/tests/box1d.cc (revision 1071) @@ -0,0 +1,43 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +/*! \file tests/box1d.cc + * + * \brief Tests on mln::box1d. + */ + +#include <mln/core/box1d.hh> + + + +int main() +{ + using namespace mln; + + box1d b = make::box1d(2); + mln_assertion(b.ninds() == 2); +} Index: trunk/milena/tests/image1d_b.cc =================================================================== --- trunk/milena/tests/image1d_b.cc (revision 0) +++ trunk/milena/tests/image1d_b.cc (revision 1071) @@ -0,0 +1,48 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +/*! \file tests/image1d_b.cc + * + * \brief Tests on mln::image1d_b. + */ + +#include <mln/core/image1d_b.hh> +#include <mln/geom/size1d.hh> + + +int main() +{ + using namespace mln; + + const unsigned ninds = 1; + const unsigned border = 4; + + image1d_b<int> f(ninds, border); + + mln_assertion(f.npoints() == ninds); + mln_assertion(f.ncells() == (ninds + 2 * border)); +} Index: trunk/milena/tests/dpoint1d.cc =================================================================== --- trunk/milena/tests/dpoint1d.cc (revision 0) +++ trunk/milena/tests/dpoint1d.cc (revision 1071) @@ -0,0 +1,53 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +/*! \file tests/dpoint1d.cc + * + * \brief Tests on mln::dpoint1d. + */ + +#include <mln/core/dpoint1d.hh> + + + +int main() +{ + using namespace mln; + + point1d p, q; + dpoint1d dp; + + p = make::point1d(1); + q = make::point1d(4); + dp = make::dpoint1d(3); + + mln_assertion(dp == q - p); + mln_assertion(q == p + dp); + + const int (&vec)[1] = dp.to_vec(); + mln_assertion(vec[0] == 3); +} Index: trunk/milena/tests/pixter1d_b.cc =================================================================== --- trunk/milena/tests/pixter1d_b.cc (revision 0) +++ trunk/milena/tests/pixter1d_b.cc (revision 1071) @@ -0,0 +1,94 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +/*! \file tests/pixter1d_b.cc + * + * \brief Tests on mln::fwd_pixter1d_b. + */ + +#include <mln/core/image1d_b.hh> + + +const unsigned size = 20; +const int v = 51; + + +template <typename I> +void test_fill(I& ima) +{ + mln_pixter(I) pxl(ima); + unsigned i = 0; + for_all(pxl) + { + ++i; + pxl.val() = v; + } + mln_assertion(i == size); + mln_assertion(! pxl.is_valid()); + + mln_piter(I) p(ima.domain()); + for_all(p) + mln_assertion(ima(p) == v); +} + + +template <typename I> +void test_const(const I& imac, I& ima) +{ + { + mln_pixter(const I) pxl(imac); // const is mandatory + pxl.start(); + mln_assertion(pxl.val() == v); + // pxl.val() = v; // error is OK since pixter on 'const I' + } + { + // mln_pixter(I) pxl_(imac); // error is OK since mutable I but const imac + mln_pixter(I) pxl(ima); + pxl.start(); + pxl.val() = 2 * pxl.val(); + mln_assertion(pxl.val() == 2 * v); + } + { + mln_pixter(const I) pxl(ima); // const promotion is OK + pxl.start(); + mln_assertion(pxl.val() == 2 * v); + // pxl.val() = v; // error is OK since pixter on 'const I' + } +} + + + +int main() +{ + using namespace mln; + + typedef image1d_b<int> I; + I ima(size); + + test_fill(ima); + test_const(ima, ima); +} Index: trunk/milena/tests/point1d.cc =================================================================== --- trunk/milena/tests/point1d.cc (revision 0) +++ trunk/milena/tests/point1d.cc (revision 1071) @@ -0,0 +1,56 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +/*! \file tests/point1d.cc + * + * \brief Tests on mln::point1d. + */ + +#include <mln/core/point1d.hh> + + + +int main() +{ + using namespace mln; + + point1d p, q; + + // assignment + + p[0] = 4; + p.ind() += 1; + mln_assertion(p.ind() == 5 && p[0] == 5); + + // construction + q = make::point1d(5); + mln_assertion(p == q); + + q.set_all(0); + for (unsigned i = 0; i < p.dim; ++i) + mln_assertion(q[i] == 0); +} Index: trunk/milena/mln/convert/to_image.hh =================================================================== --- trunk/milena/mln/convert/to_image.hh (revision 1070) +++ trunk/milena/mln/convert/to_image.hh (revision 1071) @@ -71,6 +71,12 @@ typedef image2d_b<V> ret; }; + template <typename V> + struct helper_image_from_< 1, V > + { + typedef image1d_b<V> ret; + }; + } // end of namespace mln::internal Index: trunk/milena/mln/geom/ninds.hh =================================================================== --- trunk/milena/mln/geom/ninds.hh (revision 0) +++ trunk/milena/mln/geom/ninds.hh (revision 1071) @@ -0,0 +1,67 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_GEOM_NINDS_HH +# define MLN_GEOM_NINDS_HH + +/*! \file mln/geom/ninds.hh + * + * \brief Give the number of inds of an image. + */ + +# include <mln/geom/min_ind.hh> +# include <mln/geom/max_ind.hh> + + +namespace mln +{ + + namespace geom + { + + /// Give the number of inds of an image. + template <typename I> + unsigned ninds(const Image<I>& ima); + + +# ifndef MLN_INCLUDE_ONLY + + template <typename I> + unsigned ninds(const Image<I>& ima) + { + mln_precondition(exact(ima).has_data()); + return geom::max_ind(ima) - geom::min_ind(ima) + 1; + } + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace mln::geom + +} // end of namespace mln + + +#endif // ! MLN_GEOM_NINDS_HH Index: trunk/milena/mln/geom/min_ind.hh =================================================================== --- trunk/milena/mln/geom/min_ind.hh (revision 0) +++ trunk/milena/mln/geom/min_ind.hh (revision 1071) @@ -0,0 +1,66 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_GEOM_MIN_IND_HH +# define MLN_GEOM_MIN_IND_HH + +/*! \file mln/geom/min_ind.hh + * + * \brief Give the minimum ind of an image. + */ + +# include <mln/core/concept/image.hh> + + +namespace mln +{ + + namespace geom + { + + /// Give the minimum ind of an image. + template <typename I> + mln_coord(I) min_ind(const Image<I>& ima); + + +# ifndef MLN_INCLUDE_ONLY + + template <typename I> + mln_coord(I) min_ind(const Image<I>& ima) + { + mln_precondition(exact(ima).has_data()); + return exact(ima).bbox().pmin().ind(); + } + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace mln::geom + +} // end of namespace mln + + +#endif // ! MLN_GEOM_MIN_IND_HH Index: trunk/milena/mln/geom/size1d.hh =================================================================== --- trunk/milena/mln/geom/size1d.hh (revision 0) +++ trunk/milena/mln/geom/size1d.hh (revision 1071) @@ -0,0 +1,39 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_GEOM_SIZE1D_HH +# define MLN_GEOM_SIZE1D_HH + +/*! \file mln/geom/size1d.hh + * + * \brief Facade to include 1D size access routines. + */ + +# include <mln/geom/ninds.hh> + + +#endif // ! MLN_GEOM_SIZE1D_HH Index: trunk/milena/mln/geom/max_ind.hh =================================================================== --- trunk/milena/mln/geom/max_ind.hh (revision 0) +++ trunk/milena/mln/geom/max_ind.hh (revision 1071) @@ -0,0 +1,66 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_GEOM_MAX_IND_HH +# define MLN_GEOM_MAX_IND_HH + +/*! \file mln/geom/max_ind.hh + * + * \brief Give the maximum ind of an image. + */ + +# include <mln/core/concept/image.hh> + + +namespace mln +{ + + namespace geom + { + + /// Give the maximum ind of an image. + template <typename I> + mln_coord(I) max_ind(const Image<I>& ima); + + +# ifndef MLN_INCLUDE_ONLY + + template <typename I> + mln_coord(I) max_ind(const Image<I>& ima) + { + mln_precondition(exact(ima).has_data()); + return exact(ima).bbox().pmax().ind(); + } + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace mln::geom + +} // end of namespace mln + + +#endif // ! MLN_GEOM_MAX_IND_HH Index: trunk/milena/mln/core/neighb1d.hh =================================================================== --- trunk/milena/mln/core/neighb1d.hh (revision 0) +++ trunk/milena/mln/core/neighb1d.hh (revision 1071) @@ -0,0 +1,79 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_CORE_NEIGHB1D_HH +# define MLN_CORE_NEIGHB1D_HH + +/*! \file mln/core/neighb1d.hh + * + * \brief Definition of the mln::neighb1d alias and of some classical + * 1D neighborhoods. + */ + +# include <cmath> +# include <mln/core/neighb.hh> +# include <mln/core/dpoint1d.hh> + + +namespace mln +{ + + /*! \brief Type alias for a neighborhood defined on the 1D square + * grid with integer coordinates. + */ + typedef neighb_<dpoint1d> neighb1d; + + + /*! \brief 2-connectivity neighborhood on the 1D grid. + * + * o x o + * + * \return A neighb1d. + */ + const neighb1d& c2(); + + +# ifndef MLN_INCLUDE_ONLY + + const neighb1d& c2() + { + static bool flower = true; + static neighb1d it; + if (flower) + { + it.insert(make::dpoint1d(+1)); + flower = false; + } + return it; + } + +# endif // ! MLN_INCLUDE_ONLY + +} // end of namespace mln + + +#endif // ! MLN_CORE_NEIGHB1D_HH Index: trunk/milena/mln/core/dpoint1d.hh =================================================================== --- trunk/milena/mln/core/dpoint1d.hh (revision 0) +++ trunk/milena/mln/core/dpoint1d.hh (revision 1071) @@ -0,0 +1,66 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_CORE_DPOINT1D_HH +# define MLN_CORE_DPOINT1D_HH + +/*! \file mln/core/dpoint1d.hh + * + * \brief Definition of the mln::dpoint1d alias and of its + * construction routine. + */ + +# include <mln/core/dpoint.hh> + + +namespace mln +{ + + /*! \brief Type alias for a delta-point defined on the 1D square + * grid with integer coordinates. + */ + typedef dpoint_<1,int> dpoint1d; + + +} // end of namespace mln + + +# include <mln/make/dpoint1d.hh> +# include <mln/core/point1d.hh> + + +namespace mln +{ + + // FIXME: Doc! + const dpoint1d prev = make::dpoint1d( -1 ); + const dpoint1d next = make::dpoint1d( +1 ); + +} // end of namespace mln + + +#endif // ! MLN_CORE_DPOINT1D_HH Index: trunk/milena/mln/core/pixter1d_b.hh =================================================================== --- trunk/milena/mln/core/pixter1d_b.hh (revision 0) +++ trunk/milena/mln/core/pixter1d_b.hh (revision 1071) @@ -0,0 +1,90 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_CORE_PIXTER1D_B_HH +# define MLN_CORE_PIXTER1D_B_HH + +/*! \file mln/core/pixter1d_b.hh + * + * \brief Pixel iterator class on a image 1d with border. + */ + +# include <mln/core/internal/pixel_iterator_base.hh> +# include <mln/core/point1d.hh> +# include <mln/geom/size1d.hh> + + + +namespace mln +{ + + template <typename I> + class fwd_pixter1d_b : public internal::pixel_iterator_base_< I, fwd_pixter1d_b<I> > + { + typedef internal::pixel_iterator_base_< I, fwd_pixter1d_b<I> > super_; + + public: + + /// Image type. + typedef I image; + + /*! \brief Constructor. + * + * \param[in] image Image to iterate over its pixels. + */ + fwd_pixter1d_b(I& image); + + /// Go to the next pixel. + void next_(); + + }; + + + // FIXME: bkd_pixter1d_b + + +#ifndef MLN_INCLUDE_ONLY + + template <typename I> + fwd_pixter1d_b<I>::fwd_pixter1d_b(I& image) : + super_(image) + { + mln_precondition(image.has_data()); + } + + template <typename I> + void + fwd_pixter1d_b<I>::next_() + { + ++this->value_ptr_; + } + +#endif // ! MLN_INCLUDE_ONLY + +} // end of namespace mln + +#endif // ! MLN_CORE_PIXTER1D_B_HH Index: trunk/milena/mln/core/box1d.hh =================================================================== --- trunk/milena/mln/core/box1d.hh (revision 0) +++ trunk/milena/mln/core/box1d.hh (revision 1071) @@ -0,0 +1,58 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_CORE_BOX1D_HH +# define MLN_CORE_BOX1D_HH + +/*! \file mln/core/box1d.hh + * + * \brief Definition of the mln::box1d alias and of construction + * routines. + */ + +# include <mln/core/box.hh> +# include <mln/core/point1d.hh> + + +namespace mln +{ + + /*! \brief Type alias for a box defined on the 1D square grid with + * integer coordinates. + * + * \see mln::win::rectangle1d. + */ + typedef box_<point1d> box1d; + + +} // end of namespace mln + + +# include <mln/make/box1d.hh> + + +#endif // ! MLN_CORE_BOX1D_HH Index: trunk/milena/mln/core/point1d.hh =================================================================== --- trunk/milena/mln/core/point1d.hh (revision 0) +++ trunk/milena/mln/core/point1d.hh (revision 1071) @@ -0,0 +1,56 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_CORE_POINT1D_HH +# define MLN_CORE_POINT1D_HH + +/*! \file mln/core/point1d.hh + * + * \brief Definition of the mln::point1d alias and of its construction + * routine. + */ + +# include <mln/core/point.hh> + + +namespace mln +{ + + /*! \brief Type alias for a point defined on the 1D square grid with + * integer coordinates. + */ + typedef point_<1,int> point1d; + + +} // end of namespace mln + + +# include <mln/make/point1d.hh> +# include <mln/core/dpoint1d.hh> + + +#endif // ! MLN_CORE_POINT1D_HH Index: trunk/milena/mln/core/internal/box_impl.hh =================================================================== --- trunk/milena/mln/core/internal/box_impl.hh (revision 1070) +++ trunk/milena/mln/core/internal/box_impl.hh (revision 1071) @@ -77,6 +77,19 @@ C max_col() const; }; + template <typename C, typename E> // FIXME: Add an extra param to replace 'unsigned'. + struct box_impl_<1, C, E> + { + /// Give the number of inds. + unsigned ninds() const; + + /// Give the minimum ind. + C min_ind() const; + + /// Give the minimum ind. + C max_ind() const; + }; + # ifndef MLN_INCLUDE_ONLY @@ -120,6 +133,26 @@ return internal::force_exact<E>(*this).bbox().pmax()[1]; } + // 1 + + template <typename C, typename E> + unsigned box_impl_<1, C, E>::ninds() const + { + return internal::force_exact<E>(*this).bbox().len(0); + } + + template <typename C, typename E> + C box_impl_<1, C, E>::min_ind() const + { + return internal::force_exact<E>(*this).bbox().pmin()[0]; + } + + template <typename C, typename E> + C box_impl_<1, C, E>::max_ind() const + { + return internal::force_exact<E>(*this).bbox().pmax()[0]; + } + # endif // ! MLN_INCLUDE_ONLY } // end of namespace mln::internal Index: trunk/milena/mln/core/window1d.hh =================================================================== --- trunk/milena/mln/core/window1d.hh (revision 0) +++ trunk/milena/mln/core/window1d.hh (revision 1071) @@ -0,0 +1,56 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_CORE_WINDOW1D_HH +# define MLN_CORE_WINDOW1D_HH + +/*! \file mln/core/window1d.hh + * + * \brief Definition of the mln::window1d alias and of a construction + * routine. + */ + +# include <mln/core/window.hh> +# include <mln/core/dpoint1d.hh> + + +namespace mln +{ + + /*! \brief Type alias for a window with arbitrary shape, defined on + * the 1D square grid with integer coordinates. + */ + typedef window<dpoint1d> window1d; + + +} // end of namespace mln + + +# include <mln/make/window1d.hh> + + +#endif // ! MLN_CORE_WINDOW1D_HH Index: trunk/milena/mln/core/w_window1d_int.hh =================================================================== --- trunk/milena/mln/core/w_window1d_int.hh (revision 0) +++ trunk/milena/mln/core/w_window1d_int.hh (revision 1071) @@ -0,0 +1,56 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_CORE_W_WINDOW1D_INT_HH +# define MLN_CORE_W_WINDOW1D_INT_HH + +/*! \file mln/core/w_window1d_int.hh + * + * \brief Definition of the mln::w_window1d_int alias. + */ + +# include <mln/core/w_window.hh> +# include <mln/core/dpoint1d.hh> + + +namespace mln +{ + + /*! \brief Type alias for a w_window with arbitrary shape, defined + * on the 1D grid (with integer coordinates) and whose + * weights are integers. + */ + typedef w_window<dpoint1d, int> w_window1d_int; + + +} // end of namespace mln + + +# include <mln/make/w_window1d.hh> + + +#endif // ! MLN_CORE_W_WINDOW1D_INT_HH Index: trunk/milena/mln/core/win/segment1d.hh =================================================================== --- trunk/milena/mln/core/win/segment1d.hh (revision 0) +++ trunk/milena/mln/core/win/segment1d.hh (revision 1071) @@ -0,0 +1,181 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_CORE_WIN_SEGMENT1D_HH +# define MLN_CORE_WIN_SEGMENT1D_HH + +/*! \file mln/core/win/segment1d.hh + * + * \brief Definition of the mln::win::segment1d window. + */ + +# include <mln/core/concept/window.hh> +# include <mln/core/internal/dpoints_base.hh> +# include <mln/core/dpoint1d.hh> +# include <mln/core/dpoints_piter.hh> + + +namespace mln +{ + + namespace win + { + + /*! \brief Segment window defined on the 1D grid. + * + * An segment1d is centered and symmetrical; so + * its height (length) is odd. + * + * For instance: \n + * o x o \n + * is defined with length = 3. + */ + struct segment1d : public Window< segment1d >, + public internal::dpoints_base_< dpoint1d, segment1d > + { + /// Point associated type. + typedef point1d point; + + /// Dpoint associated type. + typedef dpoint1d dpoint; + + /*! \brief Point_Iterator type to browse a segment such as: "for each row + * (increasing), for each column (increasing)." + */ + typedef dpoints_fwd_piter<dpoint1d> fwd_qiter; + + /*! \brief Point_Iterator type to browse a segment such as: "for each row + * (decreasing), for each column (decreasing)." + */ + typedef dpoints_bkd_piter<dpoint1d> bkd_qiter; + + /*! \brief Same as fwd_qiter. + */ + typedef fwd_qiter qiter; + + /*! \brief Constructor. + * + * \param[in] length Length, thus height, of the segment1d. + * + * \pre \p length is odd. + */ + segment1d(unsigned length); + + /*! \brief Test if the window is centered. + * + * \return True. + */ + bool is_centered() const; + + /*! \brief Test if the window is symmetric. + * + * \return true. + */ + bool is_symmetric() const; + + /*! \brief Give the segment length, that is, its height. + */ + unsigned length() const; + + /*! \brief Give the maximum coordinate gap between the window + * center and a window point. + */ + unsigned delta() const; + + /// Apply a central symmetry to the target window. + segment1d& sym(); + + protected: + unsigned length_; + }; + + + /*! \brief Print a segment1D window \p win into the output + * stream \p ostr. + * + * \param[in,out] ostr An output stream. + * \param[in] win A segment1D window. + * + * \return The modified output stream \p ostr. + * + * \relates mln::win::segment1d + */ + std::ostream& operator<<(std::ostream& ostr, const segment1d& win); + + + +# ifndef MLN_INCLUDE_ONLY + + segment1d::segment1d(unsigned length) + : length_(length) + { + mln_precondition(length % 2 == 1); + const int dind = length / 2; + for (int ind = - dind; ind <= dind; ++ind) + insert(make::dpoint1d(ind)); + } + + bool segment1d::is_centered() const + { + return true; + } + + bool segment1d::is_symmetric() const + { + return true; + } + + unsigned segment1d::length() const + { + return length_; + } + + unsigned segment1d::delta() const + { + return length_ / 2; + } + + segment1d& segment1d::sym() + { + return *this; + } + + std::ostream& operator<<(std::ostream& ostr, const segment1d& win) + { + ostr << "[segment1d: length=" << win.length() << ']'; + return ostr; + } + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace mln::win + +} // end of namespace mln + + + +#endif // ! MLN_CORE_WIN_SEGMENT1D_HH Index: trunk/milena/mln/core/w_window1d_float.hh =================================================================== --- trunk/milena/mln/core/w_window1d_float.hh (revision 0) +++ trunk/milena/mln/core/w_window1d_float.hh (revision 1071) @@ -0,0 +1,56 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_CORE_W_WINDOW1D_FLOAT_HH +# define MLN_CORE_W_WINDOW1D_FLOAT_HH + +/*! \file mln/core/w_window1d_float.hh + * + * \brief Definition of the mln::w_window1d_float alias. + */ + +# include <mln/core/w_window.hh> +# include <mln/core/dpoint1d.hh> + + +namespace mln +{ + + /*! \brief Type alias for a w_window with arbitrary shape, defined + * on the 1D grid (with integer coordinates) and whose + * weights are floating values. + */ + typedef w_window<dpoint1d, float> w_window1d_float; + + +} // end of namespace mln + + +# include <mln/make/w_window1d.hh> + + +#endif // ! MLN_CORE_W_WINDOW1D_FLOAT_HH Index: trunk/milena/mln/core/image1d_b.hh =================================================================== --- trunk/milena/mln/core/image1d_b.hh (revision 0) +++ trunk/milena/mln/core/image1d_b.hh (revision 1071) @@ -0,0 +1,516 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_CORE_IMAGE1D_B_HH +# define MLN_CORE_IMAGE1D_B_HH + +/*! \file mln/core/image1d_b.hh + * + * \brief Definition of the basic mln::image1d_b class. + */ + +# include <mln/core/internal/image_base.hh> +# include <mln/core/box1d.hh> + +# include <mln/border/thickness.hh> +# include <mln/value/set.hh> +# include <mln/fun/i2v/all.hh> + + +// FIXME: + +// # include <mln/core/pixter1d_b.hh> +// # include <mln/core/dpoints_pixter.hh> + + +namespace mln +{ + + // Fwd decl. + template <typename T> struct image1d_b; + + + namespace trait + { + + template <typename T> + struct is_fast< image1d_b<T> > + { + typedef metal::true_ ret; + }; + + } // end of mln::trait + + + + /*! \brief Basic 1D image class. + * + * The parameter \c T is the type of pixel values. This image class + * stores data in memory and has a virtual border with constant + * thickness around data. + */ + template <typename T> + struct image1d_b : public internal::image_base_< box1d, image1d_b<T> > + { + // Warning: just to make effective types appear in Doxygen: + typedef box1d pset; + typedef point1d psite; + typedef point1d point; + typedef dpoint1d dpoint; + typedef mln_fwd_piter(box1d) fwd_piter; + typedef mln_bkd_piter(box1d) bkd_piter; + // End of warning. + + + /// Value associated type. + typedef T value; + + /// Return type of read-only access. + typedef const T& rvalue; + + /// Return type of read-write access. + typedef T& lvalue; + + /// Change value type. + template <typename U> + struct change_value + { + typedef image1d_b<U> ret; + }; + + /// Value_Set associated type. + typedef mln::value::set<T> vset; + + + /// Constructor without argument. + image1d_b(); + + /// Constructor with the numbers of indexes and the + /// border thickness. + image1d_b(int ninds, unsigned bdr = border::thickness); + + /// Constructor with a box and the border thickness (default is + /// 3). + image1d_b(const box1d& b, unsigned bdr = border::thickness); + + /// Copy constructor. + image1d_b(const image1d_b<T>& rhs); + + /// Assignment operator. + image1d_b& operator=(const image1d_b<T>& rhs); + + /// Destructor. + ~image1d_b(); + + + /// Initialize an empty image. + void init_with(int ninds, unsigned bdr = border::thickness); + + /// Initialize an empty image. + void init_with(const box1d& b, unsigned bdr = border::thickness); + + + /// Test if \p p is valid. + bool owns_(const point1d& p) const; + + /// Test if this image has been initialized. + bool has_data() const; + + /// Give the set of values of the image. + const vset& values() const; + + /// Give the definition domain. + const box1d& domain() const; + + /// Give the border thickness. + unsigned border() const; + + /// Give the number of cells (points including border ones). + std::size_t ncells() const; + + /// Read-only access to the image value located at point \p p. + const T& operator()(const point1d& p) const; + + /// Read-write access to the image value located at point \p p. + T& operator()(const point1d& p); + + /// Read-only access to the image value located at offset \p o. + const T& operator[](unsigned o) const; + + /// Read-write access to the image value located at offset \p o. + T& operator[](unsigned o); + + /// Read-only access to the image value located at (\p ind). + const T& at(int ind) const; + + /// Read-write access to the image value located at (\p ind). + T& at(int ind); + + + /// Fast Image method + + /// Give the offset corresponding to the delta-point \p dp. + int offset(const dpoint1d& dp) const; + + /// Give the point corresponding to the offset \p o. + point1d point_at_offset(unsigned o) const; + + /// Give a hook to the value buffer. + const T* buffer() const; + + /// Give a hook to the value buffer. + T* buffer(); + + + private: + + T* buffer_; + + box1d b_; // theoretical box + unsigned bdr_; + box1d vb_; // virtual box, i.e., box including the virtual border + + void update_vb_(); + void allocate_(); + void deallocate_(); + + typedef internal::image_base_< box1d, image1d_b<T> > super; + }; + + + +# ifndef MLN_INCLUDE_ONLY + + // ctors + + template <typename T> + image1d_b<T>::image1d_b() + : buffer_(0) + { + bdr_ = border::thickness; // default value in ctors. + } + + template <typename T> + image1d_b<T>::image1d_b(int ninds, unsigned bdr) + : buffer_(0) + { + init_with(ninds, bdr); + } + + template <typename T> + void + image1d_b<T>::init_with(int ninds, unsigned bdr) + { + mln_precondition(! this->has_data()); + b_ = make::box1d(ninds); + bdr_ = bdr; + allocate_(); + } + + template <typename T> + image1d_b<T>::image1d_b(const box1d& b, unsigned bdr) + : buffer_(0) + { + init_with(b, bdr); + } + + template <typename T> + void + image1d_b<T>::init_with(const box1d& b, unsigned bdr) + { + mln_precondition(! this->has_data()); + b_ = b; + bdr_ = bdr; + allocate_(); + } + + template <typename T> + image1d_b<T>::image1d_b(const image1d_b<T>& rhs) + : super(rhs), + b_(rhs.domain()), + bdr_(rhs.border()) + { + allocate_(); + std::memcpy(this->buffer_, + rhs.buffer_, + ncells() * sizeof(T)); + } + + // assignment + + template <typename T> + image1d_b<T>& + image1d_b<T>::operator=(const image1d_b<T>& rhs) + { + mln_precondition(rhs.has_data()); + if (& rhs == this) + return *this; + if (this->has_data()) + this->deallocate_(); + this->b_ = rhs.domain(); + this->bdr_ = rhs.border(); + allocate_(); + std::memcpy(this->buffer_, + rhs.buffer_, + ncells() * sizeof(T)); + return *this; + } + + // methods + + template <typename T> + bool + image1d_b<T>::has_data() const + { + return buffer_ != 0; + } + + template <typename T> + const typename image1d_b<T>::vset& + image1d_b<T>::values() const + { + return vset::the(); + } + + template <typename T> + const box1d& + image1d_b<T>::domain() const + { + mln_precondition(this->has_data()); + return b_; + } + + template <typename T> + unsigned + image1d_b<T>::border() const + { + mln_precondition(this->has_data()); + return bdr_; + } + + template <typename T> + std::size_t + image1d_b<T>::ncells() const + { + mln_precondition(this->has_data()); + return vb_.npoints(); + } + + template <typename T> + bool + image1d_b<T>::owns_(const point1d& p) const + { + mln_precondition(this->has_data()); + return vb_.has(p); + } + + template <typename T> + const T& + image1d_b<T>::operator()(const point1d& p) const + { + mln_precondition(this->owns_(p)); + return buffer_[p.ind()]; + } + + template <typename T> + T& + image1d_b<T>::operator()(const point1d& p) + { + mln_precondition(this->owns_(p)); + return buffer_[p.ind()]; + } + + template <typename T> + const T& + image1d_b<T>::operator[](unsigned o) const + { + mln_precondition(o < ncells()); + return *(buffer_ + o); + } + + template <typename T> + T& + image1d_b<T>::operator[](unsigned o) + { + mln_precondition(o < ncells()); + return *(buffer_ + o); + } + + template <typename T> + const T& + image1d_b<T>::at(int ind) const + { + mln_precondition(this->owns_(make::point1d(ind))); + return buffer_[ind]; + } + + template <typename T> + T& + image1d_b<T>::at(int ind) + { + mln_precondition(this->owns_(make::point1d(ind))); + return buffer_[ind]; + } + + template <typename T> + image1d_b<T>::~image1d_b() + { + deallocate_(); + } + + template <typename T> + const T* + image1d_b<T>::buffer() const + { + mln_precondition(this->has_data()); + return buffer_; + } + + template <typename T> + T* + image1d_b<T>::buffer() + { + mln_precondition(this->has_data()); + return buffer_; + } + + template <typename T> + int + image1d_b<T>::offset(const dpoint1d& dp) const + { + mln_precondition(this->has_data()); + int o = dp[0]; + return o; + } + + template <typename T> + point1d + image1d_b<T>::point_at_offset(unsigned o) const + { + mln_precondition(o < ncells()); + point1d p = make::point1d(o); + mln_postcondition(& this->operator()(p) == this->buffer_ + o); + return p; + } + + + // private + + template <typename T> + void + image1d_b<T>::update_vb_() + { + vb_.pmin() = b_.pmin() - dpoint1d(all(bdr_)); + vb_.pmax() = b_.pmax() + dpoint1d(all(bdr_)); + } + + template <typename T> + void + image1d_b<T>::allocate_() + { + update_vb_(); + unsigned + ni = vb_.len(0); + buffer_ = new T[ni]; + mln_postcondition(vb_.len(0) == b_.len(0) + 2 * bdr_); + } + + template <typename T> + void + image1d_b<T>::deallocate_() + { + if (buffer_) + { + delete[] buffer_; + buffer_ = 0; + } + } + +# endif // ! MLN_INCLUDE_ONLY + +} // end of namespace mln + + + +# include <mln/core/trait/pixter.hh> +# include <mln/core/dpoints_pixter.hh> +# include <mln/core/pixter1d_b.hh> +# include <mln/core/w_window.hh> + + +namespace mln +{ + + namespace trait + { + + // pixter + + template <typename T> + struct fwd_pixter< image1d_b<T> > + { + typedef fwd_pixter1d_b< image1d_b<T> > ret; + }; + + template <typename T> + struct fwd_pixter< const image1d_b<T> > + { + typedef fwd_pixter1d_b< const image1d_b<T> > ret; + }; + + template <typename T> + struct bkd_pixter< image1d_b<T> > + { + typedef internal::fixme ret; + }; + + // qixter + + template <typename T, typename W> + struct fwd_qixter< image1d_b<T>, W > + { + typedef dpoints_fwd_pixter< image1d_b<T> > ret; + }; + + template <typename T, typename W> + struct fwd_qixter< const image1d_b<T>, W > + { + typedef dpoints_fwd_pixter< const image1d_b<T> > ret; + }; + + template <typename T, typename W> + struct bkd_qixter< image1d_b<T>, W > + { + typedef internal::fixme ret; + }; + + } // end of namespace mln::trait + +} // end of namespace mln + + +#endif // ! MLN_CORE_IMAGE1D_B_HH Index: trunk/milena/mln/make/dpoint1d.hh =================================================================== --- trunk/milena/mln/make/dpoint1d.hh (revision 0) +++ trunk/milena/mln/make/dpoint1d.hh (revision 1071) @@ -0,0 +1,70 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_MAKE_DPOINT1D_HH +# define MLN_MAKE_DPOINT1D_HH + +/*! \file mln/make/dpoint1d.hh + * + * \brief Routine to construct an mln::dpoint1d. + */ + +# include <mln/core/dpoint1d.hh> + + +namespace mln +{ + + namespace make + { + + /*! \brief Create an mln::dpoint1d. + * + * \param[in] ind Ind coordinate. + * + * \return A 1D dpoint. + */ + mln::dpoint1d dpoint1d(int ind); + + +# ifndef MLN_INCLUDE_ONLY + + mln::dpoint1d dpoint1d(int ind) + { + mln::dpoint1d tmp; + tmp[0] = ind; + return tmp; + } + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace mln::make + +} // end of namespace mln + + +#endif // ! MLN_MAKE_DPOINT1D_HH Index: trunk/milena/mln/make/w_window1d.hh =================================================================== --- trunk/milena/mln/make/w_window1d.hh (revision 0) +++ trunk/milena/mln/make/w_window1d.hh (revision 1071) @@ -0,0 +1,86 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_MAKE_W_WINDOW1D_HH +# define MLN_MAKE_W_WINDOW1D_HH + +/*! \file mln/make/w_window1d.hh + * + * \brief Routine to create an mln::w_window in the 1D case. + */ + +# include <cmath> + +# include <mln/core/w_window.hh> +# include <mln/core/dpoint1d.hh> + + +namespace mln +{ + + namespace make + { + + /*! \brief Create a 1D mln::w_window from an array of weights. + * + * \param[in] weights Array. + * + * \pre The array size, \c M, has to be a square of an odd integer. + * + * \return A 1D weighted window. + */ + template <typename W, unsigned M> + mln::w_window<mln::dpoint1d, W> w_window1d(W (&weights)[M]); + + +# ifndef MLN_INCLUDE_ONLY + + template <typename W, unsigned M> + mln::w_window<mln::dpoint1d, W> + w_window1d(W (&weights)[M]) + { + int h = M / 2; + mln_precondition(1 == (M % 1)); + mln::w_window<mln::dpoint1d, W> tmp; + unsigned i = 0; + for (int ind = - h; ind <= h; ++ind) + { + if (weights[i] != 0) + tmp.insert(weights[i], make::dpoint1d(ind)); + i++; + } + return tmp; + } + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace mln::make + +} // end of namespace mln + + +#endif // ! MLN_MAKE_W_WINDOW1D_HH Index: trunk/milena/mln/make/w_window1d_int.hh =================================================================== --- trunk/milena/mln/make/w_window1d_int.hh (revision 0) +++ trunk/milena/mln/make/w_window1d_int.hh (revision 1071) @@ -0,0 +1,75 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_MAKE_W_WINDOW1D_INT_HH +# define MLN_MAKE_W_WINDOW1D_INT_HH + +/*! \file mln/make/w_window1d_int.hh + * + * \brief Routine to create a mln::w_window1d_int. + */ + +# include <mln/core/w_window1d_int.hh> +# include <mln/make/w_window1d.hh> + + +namespace mln +{ + + namespace make + { + + /*! \brief Create a mln::w_window1d_int. + * + * \param[in] weights Array of integers. + * + * \pre The array size, \c M, has to be a square of an odd integer. + * + * \return A 1D int-weighted window. + */ + template <unsigned M> + mln::w_window1d_int w_window1d_int(int (&weights)[M]); + + +# ifndef MLN_INCLUDE_ONLY + + template <unsigned M> + mln::w_window1d_int + w_window1d_int(int (&weights)[M]) + { + mln_precondition(1 == (M % 2)); + return make::w_window1d(weights); + } + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace mln::make + +} // end of namespace mln + + +#endif // ! MLN_MAKE_W_WINDOW1D_INT_HH Index: trunk/milena/mln/make/window1d.hh =================================================================== --- trunk/milena/mln/make/window1d.hh (revision 0) +++ trunk/milena/mln/make/window1d.hh (revision 1071) @@ -0,0 +1,81 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_MAKE_WINDOW1D_HH +# define MLN_MAKE_WINDOW1D_HH + +/*! \file mln/make/window1d.hh + * + * \brief Routine to create an mln::window1d. + */ + +# include <cmath> +# include <mln/core/window1d.hh> +# include <mln/make/dpoint1d.hh> + + +namespace mln +{ + + namespace make + { + + /*! \brief Create an mln::window1d. + * + * \param[in] values Array of Booleans. + * + * \pre The array size, \c M, has to be a line of an odd integer. + * + * \return A 1D window. + */ + template <unsigned M> + mln::window1d window1d(bool (&values)[M]); + + +# ifndef MLN_INCLUDE_ONLY + + template <unsigned M> + mln::window1d window1d(bool (&values)[M]) + { + int h = M / 2; + assert((M % 2) == 1); + mln::window1d tmp; + unsigned i = 0; + for (int ind = - h; ind <= h; ++ind) + if (values[i++]) + tmp.insert(make::dpoint1d(ind)); + return tmp; + } + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace mln::make + +} // end of namespace mln + + +#endif // ! MLN_MAKE_WINDOW1D_HH Index: trunk/milena/mln/make/box1d.hh =================================================================== --- trunk/milena/mln/make/box1d.hh (revision 0) +++ trunk/milena/mln/make/box1d.hh (revision 1071) @@ -0,0 +1,96 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_MAKE_BOX1D_HH +# define MLN_MAKE_BOX1D_HH + +/*! \file mln/make/box1d.hh + * + * \brief Routines to construct an mln::box1d. + */ + +# include <mln/core/box1d.hh> +# include <mln/make/point1d.hh> + + +namespace mln +{ + + namespace make + { + + /*! \brief Create an mln::box1d. + * + * \param[in] ninds Number of inds. + * + * \pre \p ninds != 0 and \p ncols != 0. + * + * \return A 1D box. + */ + mln::box1d box1d(unsigned ninds); + + + /*! \brief Create an mln::box1d. + * + * \overload + * + * \param[in] min_ind Index of the top most ind. + * \param[in] max_ind Index of the botton most ind. + * + * \pre \p max_ind >= \p min_ind. + * + * \return A 1D box. + */ + mln::box1d box1d(int min_ind, int max_ind); + + +# ifndef MLN_INCLUDE_ONLY + + mln::box1d box1d(unsigned ninds) + { + mln_precondition(ninds != 0); + mln::box1d tmp(make::point1d(0), + make::point1d(ninds - 1)); + return tmp; + } + + mln::box1d box1d(int min_ind, int max_ind) + { + mln_precondition(max_ind >= min_ind); + mln::box1d tmp(make::point1d(min_ind), + make::point1d(max_ind)); + return tmp; + } + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace mln::make + +} // end of namespace mln + + +#endif // ! MLN_MAKE_BOX1D_HH Index: trunk/milena/mln/make/point1d.hh =================================================================== --- trunk/milena/mln/make/point1d.hh (revision 0) +++ trunk/milena/mln/make/point1d.hh (revision 1071) @@ -0,0 +1,71 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef MLN_MAKE_POINT1D_HH +# define MLN_MAKE_POINT1D_HH + +/*! \file mln/make/point1d.hh + * + * \brief Routine to construct an mln::point1d. + */ + +# include <mln/core/point1d.hh> + + +namespace mln +{ + + namespace make + { + + /*! \brief Create an mln::point1d. + * + * \param[in] ind Ind coordinate. + * \param[in] col Column coordinate. + * + * \return A 1D point. + */ + mln::point1d point1d(int ind); + + +# ifndef MLN_INCLUDE_ONLY + + mln::point1d point1d(int ind) + { + mln::point1d tmp; + tmp[0] = ind; + return tmp; + } + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace mln::make + +} // end of namespace mln + + +#endif // ! MLN_MAKE_POINT1D_HH Index: trunk/milena/sandbox/garrigues/TODO =================================================================== --- trunk/milena/sandbox/garrigues/TODO (revision 0) +++ trunk/milena/sandbox/garrigues/TODO (revision 1071) @@ -0,0 +1,22 @@ +C R core/box1d.hh +C R core/dpoint1d.hh +C R core/image1d_b.hh +INUTILE R core/line1d.hh +C R core/neighb1d.hh +C R core/pixter1d_b.hh +C R core/point1d.hh +C R core/window1d.hh + +R core/win/hline1d.hh | +R core/win/rectangle1d.hh |-> C segment1d.hh +R core/win/vline1d.hh | + +C R core/w_window1d_float.hh +C R core/w_window1d_int.hh +C R geom/size1d.hh +C R make/box1d.hh +C R make/dpoint1d.hh +C R make/point1d.hh +C R make/window1d.hh +C R make/w_window1d.hh +C R make/w_window1d_int.hh