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_ELEMENTARY_LAPLACIAN_HH
00027 # define MLN_MORPHO_ELEMENTARY_LAPLACIAN_HH
00028 
00034 
00035 # include <mln/morpho/elementary/gradient_internal.hh>
00036 # include <mln/morpho/elementary/gradient_external.hh>
00037 
00038 
00039 namespace mln
00040 {
00041 
00042   namespace morpho
00043   {
00044 
00045     namespace elementary
00046     {
00047 
00051       template <typename I, typename N>
00052       mln_trait_op_minus_twice(mln_concrete(I))
00053       laplacian(const Image<I>& input, const Neighborhood<N>& nbh);
00054 
00055 
00056 # ifndef MLN_INCLUDE_ONLY
00057 
00058       template <typename I, typename N>
00059       inline
00060       mln_trait_op_minus_twice(mln_concrete(I))
00061       laplacian(const Image<I>& input, const Neighborhood<N>& nbh)
00062       {
00063         trace::entering("morpho::elementary::laplacian");
00064 
00065         mln_precondition(exact(input).is_valid());
00066         mln_precondition(exact(nbh).is_valid());
00067 
00068         mln_trait_op_minus_twice(mln_concrete(I)) output;
00069         output = gradient_external(input, nbh) - gradient_internal(input, nbh);
00070 
00071         trace::exiting("morpho::elementary::laplacian");
00072         return output;
00073       }
00074 
00075 # endif // ! MLN_INCLUDE_ONLY
00076 
00077     } 
00078 
00079   } 
00080 
00081 } 
00082 
00083 
00084 #endif // ! MLN_MORPHO_ELEMENTARY_LAPLACIAN_HH