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