27 #ifndef MLN_CORE_CONCEPT_NEIGHBORHOOD_HH
28 # define MLN_CORE_CONCEPT_NEIGHBORHOOD_HH
34 # include <mln/core/concept/window.hh>
35 # include <mln/trait/windows.hh>
39 # define mln_is_simple_neighborhood(N) mln_is_simple_window(mln_window(N))
49 template <
typename E>
struct Neighborhood;
89 template <
typename L,
typename R>
95 operator<<(std::ostream&ostr, const Neighborhood<N>& nbh);
100 template <
typename I,
typename N>
106 template <
typename I,
typename N>
112 template <
typename I,
typename N>
118 # ifndef MLN_INCLUDE_ONLY
120 template <
typename E>
124 typedef mln_niter(E) niter;
125 typedef mln_fwd_niter(E) fwd_niter;
126 typedef mln_bkd_niter(E) bkd_niter;
128 typedef mln_window(E)
window;
129 bool m = (& E::win) == (& E::win);
131 bool (E::*m2)() const = &E::is_valid;
138 const window& (E::*m1)()
const = & E::win;
144 template <
typename L,
typename R>
146 bool operator==(
const Neighborhood<L>& lhs,
const Neighborhood<R>&
rhs)
151 template <
typename N>
154 operator<<(std::ostream&ostr, const Neighborhood<N>&
nbh)
156 return ostr <<
exact(nbh).win();
159 template <
typename I,
typename N>
162 offsets_wrt(
const Image<I>& ima_,
const Neighborhood<N>& nbh_)
164 mln_is_simple_neighborhood(N)::check();
166 const I& ima =
exact(ima_);
168 mln_precondition(ima.is_valid());
169 mln_precondition(nbh.is_valid());
171 return offsets_wrt(ima, nbh.win());
174 template <
typename I,
typename N>
176 positive_offsets_wrt(
const Image<I>& ima_,
const Neighborhood<N>& nbh_)
178 mln_is_simple_neighborhood(N)::check();
180 const I& ima =
exact(ima_);
181 const N& nbh =
exact(nbh_);
182 mln_precondition(ima.is_valid());
183 mln_precondition(nbh.is_valid());
185 return positive_offsets_wrt(ima, nbh.win());
188 template <
typename I,
typename N>
190 negative_offsets_wrt(
const Image<I>& ima_,
const Neighborhood<N>& nbh_)
192 mln_is_simple_neighborhood(N)::check();
194 const I& ima =
exact(ima_);
195 const N& nbh =
exact(nbh_);
196 mln_precondition(ima.is_valid());
197 mln_precondition(nbh.is_valid());
199 return negative_offsets_wrt(ima, nbh.win());
202 # endif // ! MLN_INCLUDE_ONLY
207 #endif // ! MLN_CORE_CONCEPT_NEIGHBORHOOD_HH