Milena (Olena)
User documentation 2.0a Id
|
00001 // Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) 00002 // 00003 // This file is part of Olena. 00004 // 00005 // Olena is free software: you can redistribute it and/or modify it under 00006 // the terms of the GNU General Public License as published by the Free 00007 // Software Foundation, version 2 of the License. 00008 // 00009 // Olena is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with Olena. If not, see <http://www.gnu.org/licenses/>. 00016 // 00017 // As a special exception, you may use this file as part of a free 00018 // software project without restriction. Specifically, if other files 00019 // instantiate templates or use macros or inline functions from this 00020 // file, or you compile this file and link it with other files to produce 00021 // an executable, this file does not by itself cause the resulting 00022 // executable to be covered by the GNU General Public License. This 00023 // exception does not however invalidate any other reasons why the 00024 // executable file might be covered by the GNU General Public License. 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 } // end of namespace mln::morpho 00141 00142 } // end of namespace mln 00143 00144 00145 #endif // ! MLN_MORPHO_TOP_HAT_HH