Commit 95226b1b authored by Thierry Geraud's avatar Thierry Geraud
Browse files

Allow to construct 3D neighborhoods from C arrays.

	* mln/core/alias/neighb3d.hh: Upgrade file doc style.
	(from_to_): New overload.
	* mln/convert/from_to.hxx (from_to_): New fwd decl.
	* mln/make/box3d.hh (todo): New.
	Warning: FIX the unconsistency!!!
	* mln/morpho/tree/compute_attribute_image.hh: Disambiguate.


git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@3197 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent ccf8035d
2009-01-23 Thierry Geraud <thierry.geraud@lrde.epita.fr>
Allow to construct 3D neighborhoods from C arrays.
* mln/core/alias/neighb3d.hh: Upgrade file doc style.
(from_to_): New overload.
* mln/convert/from_to.hxx (from_to_): New fwd decl.
* mln/make/box3d.hh (todo): New.
Warning: FIX the unconsistency!!!
* mln/morpho/tree/compute_attribute_image.hh: Disambiguate.
2009-01-23 Guillaume Lazzara <z@lrde.epita.fr>
 
Add io::raw::save and io::raw::load routines.
......@@ -197,6 +197,14 @@ namespace mln
from_to_(const bool (&values)[R][C],
window< dpoint<grid::square, def::coord> >& win);
// C-array -> window3d
template <unsigned S>
void
from_to_(const bool (&values)[S],
window< dpoint<grid::cube, def::coord> >& win);
// C-array -> neighb2d
template <unsigned S>
void
......@@ -208,6 +216,15 @@ namespace mln
from_to_(bool const (&values)[R][C],
neighb< window< dpoint<grid::square, def::coord> > >& nbh);
// C-array -> neighb3d
template <unsigned S>
void
from_to_(const bool (&values)[S],
neighb< window< dpoint<grid::cube, def::coord> > >& nbh);
// Gdpoint -> point
template <typename D>
void
......
// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
......@@ -28,16 +29,17 @@
#ifndef MLN_CORE_ALIAS_NEIGHB3D_HH
# define MLN_CORE_ALIAS_NEIGHB3D_HH
/*! \file mln/core/alias/neighb3d.hh
*
* \brief Definition of the mln::neighb3d alias and of some classical
* 3D neighborhoods.
*/
/// \file mln/core/alias/neighb3d.hh
///
/// Definition of the mln::neighb3d alias and of some classical
/// 3D neighborhoods.
# include <cmath>
# include <mln/core/neighb.hh>
# include <mln/core/alias/window3d.hh>
# include <mln/win/sym.hh>
# include <mln/convert/from_to.hh>
namespace mln
......@@ -105,6 +107,22 @@ namespace mln
namespace convert
{
namespace over_load
{
template <unsigned S>
void from_to_(const bool (&values)[S], neighb3d& nbh);
} // end of namespace mln::convert::over_load
} // end of namespace mln::convert
# ifndef MLN_INCLUDE_ONLY
inline
......@@ -164,6 +182,29 @@ namespace mln
return it;
}
namespace convert
{
namespace over_load
{
template <unsigned S>
void
from_to_(const bool (&values)[S], neighb3d& nbh)
{
const int h = unsigned(std::pow(float(S), float(1. / 3.))) / 2;
mln_precondition((2 * h + 1) * (2 * h + 1) * (2 * h + 1) == S);
window3d win;
from_to_(values, win);
mln_precondition(win.is_neighbable_());
nbh.change_window(win);
}
} // end of namespace mln::convert::over_load
} // end of namespace mln::convert
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
......
......@@ -32,6 +32,8 @@
/// \file mln/make/box3d.hh
///
/// Routines to construct an mln::box3d.
///
/// \todo Not consistent with box2d!!!
# include <mln/core/alias/box3d.hh>
......
......@@ -102,7 +102,7 @@ namespace mln
acc(p).take_as_init(make::pix(t.f(), p));
}
{
mln_piter(T) p(t.domain());
mln_fwd_piter(T) p(t.domain());
// Propagate attribute from a site to its parent.
for_all(p)
if (! t.is_root(p))
......
Supports Markdown
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