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_WATERSHED_SUPERPOSE_HH
00027 # define MLN_MORPHO_WATERSHED_SUPERPOSE_HH
00028
00032
00033 # include <mln/core/concept/image.hh>
00034 # include <mln/core/image/dmorph/image_if.hh>
00035 # include <mln/data/convert.hh>
00036 # include <mln/data/fill.hh>
00037 # include <mln/value/rgb8.hh>
00038 # include <mln/literal/colors.hh>
00039 # include <mln/pw/all.hh>
00040
00041
00042
00043 namespace mln
00044 {
00045
00046 namespace morpho
00047 {
00048
00049 namespace watershed
00050 {
00051
00053
00054
00055
00056
00057
00058 template <typename I, typename J>
00059 inline
00060 mln_ch_value(I,value::rgb8)
00061 superpose(const Image<I>& input_,
00062 const Image<J>& ws_ima_,
00063 const value::rgb8& wsl_color);
00064
00065
00067
00068
00069
00070
00071
00072
00073 template <typename I, typename J>
00074 inline
00075 mln_ch_value(I,value::rgb8)
00076 superpose(const Image<I>& input,
00077 const Image<J>& ws_ima);
00078
00079
00080 # ifndef MLN_INCLUDE_ONLY
00081
00082 template <typename I, typename J>
00083 inline
00084 mln_ch_value(I,value::rgb8)
00085 superpose(const Image<I>& input_,
00086 const Image<J>& ws_ima_,
00087 const value::rgb8& wsl_color)
00088 {
00089 trace::entering("morpho::watershed::superpose");
00090
00091 const I& input = exact(input_);
00092 const J& ws_ima = exact(ws_ima_);
00093 mln_precondition(input.is_valid());
00094 mln_precondition(ws_ima.is_valid());
00095
00096 mln_ch_value(I,value::rgb8) output = data::convert(value::rgb8(), input);
00097
00098 data::fill((output | (pw::value(ws_ima) == pw::cst(literal::zero))).rw(),
00099 wsl_color);
00100
00101 trace::exiting("morpho::watershed::superpose");
00102 return output;
00103 }
00104
00105
00106 template <typename I, typename J>
00107 inline
00108 mln_ch_value(I,value::rgb8)
00109 superpose(const Image<I>& input,
00110 const Image<J>& ws_ima)
00111 {
00112 return superpose(input, ws_ima, literal::red);
00113 }
00114
00115 # endif // ! MLN_INCLUDE_ONLY
00116
00117
00118 }
00119
00120 }
00121
00122 }
00123
00124 #endif // ! MLN_MORPHO_WATERSHED_SUPERPOSE_HH