27 #ifndef MLN_TRANSFORM_INFLUENCE_ZONE_GEODESIC_HH
28 # define MLN_TRANSFORM_INFLUENCE_ZONE_GEODESIC_HH
34 # include <mln/extension/adjust.hh>
35 # include <mln/canvas/distance_geodesic.hh>
36 # include <mln/transform/internal/influence_zone_functor.hh>
54 template <
typename I,
typename N>
60 # ifndef MLN_INCLUDE_ONLY
66 template <
typename I,
typename N>
68 influence_zone_geodesic_tests(
const Image<I>& input,
69 const Neighborhood<N>& nbh)
71 mln_precondition(
exact(input).is_valid());
72 mln_precondition(
exact(nbh).is_valid());
87 template <
typename I,
typename N>
90 const Neighborhood<N>& nbh)
96 mlc_abort(I)::check();
102 template <
typename I,
typename N>
104 influence_zone_geodesic_fastest(const Image<I>& input_,
105 const Neighborhood<N>& nbh_)
107 mln_trace(
"transform::impl::influence_zone_geodesic_fastest");
109 const I& input =
exact(input_);
110 const N& nbh =
exact(nbh_);
112 internal::influence_zone_geodesic_tests(input, nbh);
114 std::queue<mln_value(I)*> q;
115 mln_concrete(I) output;
117 util::array<
int> dp = offsets_wrt(input, nbh);
118 const
unsigned n_nbhs = dp.nelements();
128 const unsigned nelts = input.nelements();
129 const mln_value(I)* p_i = input.buffer();
130 mln_value(I)* p_o = output.buffer();
131 for (
unsigned i = 0; i < nelts; ++i, ++p_i, ++p_o)
135 for (
unsigned j = 0; j < n_nbhs; ++j)
137 const mln_value(I)* n_i = p_i +
dp[j];
156 mln_invariant(*ptr != 0);
157 for (
unsigned j = 0; j < n_nbhs; ++j)
159 mln_value(I)* ntr = ptr +
dp[j];
179 template <
typename I,
typename N>
181 influence_zone_geodesic_dispatch(trait::image::value_alignment::any,
182 trait::image::value_storage::any,
183 trait::image::value_access::any,
191 template <
typename I,
typename N>
193 influence_zone_geodesic_dispatch(trait::image::value_alignment::with_grid,
194 trait::image::value_storage::one_block,
195 trait::image::value_access::direct,
199 return impl::influence_zone_geodesic_fastest(input, nbh);
203 template <
typename I,
typename N>
205 influence_zone_geodesic_dispatch(const Image<I>& input,
206 const Neighborhood<N>& nbh)
209 influence_zone_geodesic_dispatch(mln_trait_image_value_alignment(I)(),
210 mln_trait_image_value_storage(I)(),
211 mln_trait_image_value_access(I)(),
218 template <
typename I,
typename N>
222 mln_trace(
"transform::influence_zone_geodesic");
224 internal::influence_zone_geodesic_tests(input, nbh);
227 output = internal::influence_zone_geodesic_dispatch(input, nbh);
232 # endif // ! MLN_INCLUDE_ONLY
239 #endif // ! MLN_TRANSFORM_INFLUENCE_ZONE_GEODESIC_HH