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_TOP_HAT_HH
00027 # define MLN_MORPHO_TOP_HAT_HH
00028 
00034 
00035 # include <mln/morpho/opening/structural.hh>
00036 # include <mln/morpho/closing/structural.hh>
00037 
00038 
00039 namespace mln
00040 {
00041 
00042   namespace morpho
00043   {
00044 
00045 
00049     
00050     template <typename I, typename W>
00051     mln_concrete(I)
00052     top_hat_white(const Image<I>& input, const Window<W>& win);
00053 
00054 
00058     
00059     template <typename I, typename W>
00060     mln_concrete(I)
00061     top_hat_black(const Image<I>& input, const Window<W>& win);
00062 
00063 
00070     
00071     template <typename I, typename W>
00072     mln_concrete(I)
00073     top_hat_self_complementary(const Image<I>& input, const Window<W>& win);
00074 
00075 
00076 
00077 # ifndef MLN_INCLUDE_ONLY
00078 
00079 
00080     template <typename I, typename W>
00081     inline
00082     mln_concrete(I)
00083     top_hat_white(const Image<I>& input, const Window<W>& win)
00084     {
00085       trace::entering("morpho::top_hat_white");
00086 
00087       mln_precondition(exact(input).is_valid());
00088       mln_precondition(! exact(win).is_empty());
00089 
00090       mln_concrete(I) output = morpho::minus(input,
00091                                              opening::structural(input, win));
00092 
00093       mln_postcondition(test::positive(output));
00094 
00095       trace::exiting("morpho::top_hat_white");
00096       return output;
00097     }
00098 
00099 
00100     template <typename I, typename W>
00101     inline
00102     mln_concrete(I) top_hat_black(const Image<I>& input, const Window<W>& win)
00103     {
00104       trace::entering("morpho::top_hat_black");
00105 
00106       mln_precondition(exact(input).is_valid());
00107       mln_precondition(! exact(win).is_empty());
00108 
00109       mln_concrete(I) output = morpho::minus(closing::structural(input, win),
00110                                              input);
00111 
00112       mln_postcondition(test::positive(output));
00113 
00114       trace::exiting("morpho::top_hat_black");
00115       return output;
00116     }
00117 
00118 
00119     template <typename I, typename W>
00120     inline
00121     mln_concrete(I) top_hat_self_complementary(const Image<I>& input, const Window<W>& win)
00122     {
00123       trace::entering("morpho::top_hat_self_complementary");
00124 
00125       mln_precondition(exact(input).is_valid());
00126       mln_precondition(! exact(win).is_empty());
00127 
00128       mln_concrete(I) output = morpho::minus(closing::structural(input, win),
00129                                              opening::structural(input, win));
00130 
00131       mln_postcondition(test::positive(output));
00132 
00133       trace::exiting("morpho::top_hat_self_complementary");
00134       return output;
00135     }
00136 
00137 
00138 # endif // ! MLN_INCLUDE_ONLY
00139 
00140   } 
00141 
00142 } 
00143 
00144 
00145 #endif // ! MLN_MORPHO_TOP_HAT_HH