• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List

blobs.hh

00001 // Copyright (C) 2007, 2008, 2009 EPITA Research and Development
00002 // Laboratory (LRDE)
00003 //
00004 // This file is part of Olena.
00005 //
00006 // Olena is free software: you can redistribute it and/or modify it under
00007 // the terms of the GNU General Public License as published by the Free
00008 // Software Foundation, version 2 of the License.
00009 //
00010 // Olena is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with Olena.  If not, see <http://www.gnu.org/licenses/>.
00017 //
00018 // As a special exception, you may use this file as part of a free
00019 // software project without restriction.  Specifically, if other files
00020 // instantiate templates or use macros or inline functions from this
00021 // file, or you compile this file and link it with other files to produce
00022 // an executable, this file does not by itself cause the resulting
00023 // executable to be covered by the GNU General Public License.  This
00024 // exception does not however invalidate any other reasons why the
00025 // executable file might be covered by the GNU General Public License.
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 mln_site(L)&) {}
00087 
00088         void process_n(const mln_site(L)&) {}
00089 
00090         void finalize() {}
00091       };
00092 
00093     } // end of namespace mln::labeling::internal
00094 
00095 
00096 
00097     // Facade.
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   } // end of namespace mln::labeling
00124 
00125 } // end of namespace mln
00126 
00127 
00128 #endif // ! MLN_LABELING_BLOBS_HH

Generated on Tue Oct 4 2011 15:23:28 for Milena (Olena) by  doxygen 1.7.1