00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef MLN_LABELING_BLOBS_HH
00028 # define MLN_LABELING_BLOBS_HH
00029
00038
00039 # include <mln/core/concept/image.hh>
00040 # include <mln/core/concept/neighborhood.hh>
00041
00042 # include <mln/canvas/labeling/blobs.hh>
00043
00044
00045 namespace mln
00046 {
00047
00048 namespace labeling
00049 {
00050
00065 template <typename I, typename N, typename L>
00066 mln_ch_value(I, L)
00067 blobs(const Image<I>& input, const Neighborhood<N>& nbh,
00068 L& nlabels);
00069
00070
00071 # ifndef MLN_INCLUDE_ONLY
00072
00073
00074 namespace internal
00075 {
00076
00079 template <typename L>
00080 struct dummy_functor
00081 {
00082 void init() {}
00083
00084 void new_label(const mln_value(L)&) {}
00085
00086 void process_p(const util::pix<L>&) {}
00087
00088 void process_n(const util::pix<L>&) {}
00089
00090 void finalize() {}
00091 };
00092
00093 }
00094
00095
00096
00097
00098
00099 template <typename I, typename N, typename L>
00100 inline
00101 mln_ch_value(I, L)
00102 blobs(const Image<I>& input_, const Neighborhood<N>& nbh_,
00103 L& nlabels)
00104 {
00105 trace::entering("labeling::blobs");
00106 mlc_equal(mln_trait_image_kind(I),
00107 mln::trait::image::kind::binary)::check();
00108 const I& input = exact(input_);
00109 const N& nbh = exact(nbh_);
00110 mln_precondition(input.is_valid());
00111
00112 typedef mln_ch_value(I,L) out_t;
00113 internal::dummy_functor<out_t> functor;
00114 out_t
00115 output = canvas::labeling::blobs(input, nbh, nlabels, functor);
00116
00117 trace::exiting("labeling::blobs");
00118 return output;
00119 }
00120
00121 # endif // ! MLN_INCLUDE_ONLY
00122
00123 }
00124
00125 }
00126
00127
00128 #endif // ! MLN_LABELING_BLOBS_HH