• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List

superpose.hh

00001 // Copyright (C) 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_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       ** \param[in] input_    An image.
00055       ** \param[in] ws_ima_   The watershed transform of \p input_.
00056       ** \param[in] wsl_color The color used for the watershed line.
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       ** \param[in] input_    An image.
00069       ** \param[in] ws_ima_   The watershed transform of \p input_.
00070       **
00071       ** The watershed line is drawn in red.
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     } // end of namespace mln::morpho::watershed
00119 
00120   } // end of namespace mln::morpho
00121 
00122 } // end of namespace mln
00123 
00124 #endif // ! MLN_MORPHO_WATERSHED_SUPERPOSE_HH

Generated on Tue Oct 4 2011 15:24:41 for Milena (Olena) by  doxygen 1.7.1