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 #ifndef MLN_MORPHO_OPENING_LEVELING_HH
00027 # define MLN_MORPHO_OPENING_LEVELING_HH
00028 
00032 
00033 # include <mln/morpho/includes.hh>
00034 # include <mln/morpho/leveling_filter.hh>
00035 
00036 
00037 namespace mln {
00038   namespace morpho {
00039     namespace opening {
00040 
00042     template <typename I, typename N, typename A>
00043     mln_concrete(I)
00044     leveling(const Image<I>& input, const Neighborhood<N>& nbh,
00045               const Accumulator<A>& accu, const mln_result(A)& lambda);
00046 
00047 
00048 
00049 
00050 # ifndef MLN_INCLUDE_ONLY
00051 
00052 
00053     template <typename I, typename N, typename A>
00054     inline
00055     mln_concrete(I)
00056     leveling(const Image<I>& input, const Neighborhood<N>& nbh,
00057               const Accumulator<A>& accu, const mln_result(A)& lambda)
00058     {
00059       trace::entering("morpho::opening::leveling");
00060 
00061       mln_precondition(exact(input).is_valid());
00062       mln_precondition(mlc_not_equal(mln_trait_accumulator_when_pix(A),
00063                                      trait::accumulator::when_pix::not_ok)::value);
00064 
00065       mln_concrete(I) output;
00066       output = leveling_filter(input, nbh, accu, lambda,
00067                                 false);
00068 
00069       mln_postcondition(output <= input);
00070 
00071       trace::exiting("morpho::opening::leveling");
00072       return output;
00073     }
00074 
00075 
00076 # endif // ! MLN_INCLUDE_ONLY
00077 
00078     } 
00079   } 
00080 } 
00081 
00082 
00083 #endif // ! MLN_MORPHO_OPENING_LEVELING_HH