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_APPROX_STRUCTURAL_HH
00027 # define MLN_MORPHO_OPENING_APPROX_STRUCTURAL_HH
00028 
00032 
00033 # include <mln/morpho/approx/dilation.hh>
00034 # include <mln/morpho/approx/erosion.hh>
00035 
00036 
00037 namespace mln
00038 {
00039 
00040   namespace morpho
00041   {
00042 
00043     namespace opening
00044     {
00045 
00046       namespace approx
00047       {
00048 
00052         template <typename I, typename W>
00053         mln_concrete(I)
00054         structural(const Image<I>& input, const Window<W>& win);
00055 
00056 
00057 
00058 # ifndef MLN_INCLUDE_ONLY
00059 
00060 
00061         template <typename I, typename W>
00062         inline
00063         mln_concrete(I)
00064         structural(const Image<I>& input, const Window<W>& win)
00065         {
00066           trace::entering("morpho::opening::approx::structural");
00067 
00068           mln_precondition(exact(input).is_valid());
00069           mln_precondition(! exact(win).is_empty());
00070 
00071           using mln::morpho::approx::dilation;
00072           using mln::morpho::approx::erosion;
00073 
00074           mln_concrete(I) output = dilation(erosion(input,
00075                                                     win),
00076                                             win::sym(win));
00077 
00078           mln_postcondition(output <= input);
00079 
00080           trace::exiting("morpho::opening::approx::structural");
00081           return output;
00082         }
00083 
00084 
00085 # endif // ! MLN_INCLUDE_ONLY
00086 
00087       } 
00088 
00089     } 
00090 
00091   } 
00092 
00093 } 
00094 
00095 
00096 #endif // ! MLN_MORPHO_OPENING_APPROX_STRUCTURAL_HH