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
00027 #ifndef MLN_HISTO_COMPUTE_HH
00028 # define MLN_HISTO_COMPUTE_HH
00029
00033
00034 # include <mln/core/concept/image.hh>
00035 # include <mln/histo/array.hh>
00036
00037
00038
00039 # include <mln/histo/compute.spe.hh>
00040
00041
00042 namespace mln
00043 {
00044
00045 namespace histo
00046 {
00047
00049 template <typename I>
00050 histo::array<mln_value(I)> compute(const Image<I>& input);
00051
00052
00053 # ifndef MLN_INCLUDE_ONLY
00054
00055 namespace impl
00056 {
00057
00058 namespace generic
00059 {
00060
00061 template <typename I>
00062 inline
00063 histo::array<mln_value(I)> compute_(const I& input)
00064 {
00065 histo::array<mln_value(I)> h;
00066 mln_piter(I) p(input.domain());
00067 for_all(p)
00068 ++h(input(p));
00069 return h;
00070 }
00071
00072 }
00073
00074 }
00075
00076
00077 template <typename I>
00078 inline
00079 histo::array<mln_value(I)> compute(const Image<I>& input)
00080 {
00081 trace::entering("histo::compute");
00082 mlc_equal(mln_trait_image_quant(I), mln::trait::image::quant::low)::check();
00083 mln_precondition(exact(input).is_valid());
00084
00085 histo::array<mln_value(I)> h = impl::compute_(mln_trait_image_speed(I)(),
00086 exact(input));
00087
00088 trace::exiting("histo::compute");
00089 return h;
00090 }
00091
00092 # endif // ! MLN_INCLUDE_ONLY
00093
00094 }
00095
00096 }
00097
00098
00099 #endif // ! MLN_HISTO_COMPUTE_HH