26 #ifndef MLN_CONVERT_TO_IMAGE_HH
27 # define MLN_CONVERT_TO_IMAGE_HH
33 # include <mln/trait/image_from_grid.hh>
35 # include <mln/core/concept/site_set.hh>
36 # include <mln/core/concept/window.hh>
37 # include <mln/core/concept/weighted_window.hh>
38 # include <mln/core/concept/neighborhood.hh>
40 # include <mln/geom/bbox.hh>
41 # include <mln/data/fill.hh>
42 # include <mln/histo/array.hh>
44 # include <mln/core/image/image1d.hh>
45 # include <mln/core/image/image2d.hh>
46 # include <mln/core/image/image3d.hh>
47 # include <mln/convert/from_to.hh>
61 to_image(const Site_Set<S>& pset,
unsigned border = 1);
71 to_image(const Weighted_Window<W>& w_win);
76 to_image(const Neighborhood<N>& nbh);
85 # ifndef MLN_INCLUDE_ONLY
90 to_image(const Site_Set<S>& pset_,
unsigned border)
92 const S& pset = exact(pset_);
94 ima.init_(geom::bbox(pset).to_larger(border));
95 data::fill(ima, false);
102 template <typename W>
107 mln_is_simple_window(W)::check();
108 mln_precondition(exact(win).is_valid());
110 convert::from_to(win, tmp);
114 template <
typename W>
119 mln_is_simple_window(W)::check();
120 mln_precondition(exact(w_win).is_valid());
122 convert::from_to(exact(w_win), tmp);
126 template <
typename N>
131 mln_precondition(exact(nbh).is_valid());
135 template <
typename T>
141 n =
static_cast<def::coord>(h.vset().nvalues()),
142 v_min = static_cast<def::coord>(h.vset()[0]),
143 v_max = static_cast<def::coord>(h.vset()[n - 1]);
150 # endif // ! MLN_INCLUDE_ONLY
157 #endif // ! MLN_CONVERT_TO_IMAGE_HH