27 #ifndef MLN_TOPO_IS_NOT_1D_ISTHMUS_HH
28 # define MLN_TOPO_IS_NOT_1D_ISTHMUS_HH
33 # include <mln/core/concept/function.hh>
34 # include <mln/core/concept/image.hh>
35 # include <mln/core/concept/neighborhood.hh>
37 # include <mln/topo/connectivity_number_2d.hh>
38 # include <mln/topo/connectivity_number_3d.hh>
47 template <
typename I,
typename N>
88 connectivity_number_fun_t connectivity_number_fg_;
93 # ifndef MLN_INCLUDE_ONLY
101 template <
typename I>
102 struct conn_number_fun
109 template <
typename N>
110 static connectivity_number_fun_t
get(
const N& ,
119 static connectivity_number_fun_t
get(
const neighb2d& nbh_fg,
123 if (nbh_fg ==
c4() && nbh_bg ==
c8())
124 return connectivity_number_2d_c4<I>;
125 else if (nbh_fg ==
c8() && nbh_bg ==
c4())
126 return connectivity_number_2d_c8<I>;
136 static connectivity_number_fun_t
get(
const neighb3d& nbh_fg,
137 const neighb3d& nbh_bg)
140 if (nbh_fg ==
c6() && nbh_bg ==
c26())
141 return connectivity_number_3d_c6<I>;
142 else if (nbh_fg ==
c26() && nbh_bg ==
c6())
143 return connectivity_number_3d_c26<I>;
144 else if (nbh_fg ==
c6() && nbh_bg ==
c18())
145 return connectivity_number_3d_c6p<I>;
146 else if (nbh_fg ==
c18() && nbh_bg ==
c6())
147 return connectivity_number_3d_c18<I>;
162 template <
typename I,
typename N>
165 const Neighborhood<N>& nbh_bg)
166 : nbh_fg_(
exact(nbh_fg)),
167 nbh_bg_(
exact(nbh_bg)),
168 connectivity_number_fg_(internal::conn_number_fun<I>::
get(nbh_fg_,
173 template <
typename I,
typename N>
176 const Neighborhood<N>& nbh_bg,
178 : nbh_fg_(
exact(nbh_fg)),
179 nbh_bg_(
exact(nbh_bg)),
181 connectivity_number_fg_(internal::conn_number_fun<I>::
get(nbh_fg_,
186 template <
typename I,
typename N>
194 template <
typename I,
typename N>
199 mln_precondition(ima_);
200 return connectivity_number_fg_(*ima_, p,
true) < 2u;
203 # endif // MLN_INCLUDE_ONLY
209 #endif // ! MLN_TOPO_IS_NOT_1D_ISTHMUS_HH