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_DATA_PASTE_HH
00027 # define MLN_DATA_PASTE_HH
00028
00032
00033 # include <mln/core/concept/image.hh>
00034
00035
00036 # include <mln/data/paste.spe.hh>
00037
00038
00039
00040 namespace mln
00041 {
00042
00043 namespace data
00044 {
00045
00062 template <typename I, typename J>
00063 void paste(const Image<I>& input, Image<J>& output);
00064
00065
00066
00067 # ifndef MLN_INCLUDE_ONLY
00068
00069 namespace internal
00070 {
00071
00077
00078 template <typename I, typename J>
00079 inline
00080 void paste_tests(const Image<I>& input, Image<J>& output)
00081 {
00082 mlc_is(mln_trait_image_pw_io(J), trait::image::pw_io::read_write)::
00083 check();
00084 mlc_converts_to(mln_value(I), mln_value(J))::check();
00085
00086 mln_precondition(exact(input).is_valid());
00087 mln_precondition(exact(input).domain() <= exact(output).domain());
00088
00089
00090 (void)input;
00091 (void)output;
00092 }
00093
00094 }
00095
00096
00097 namespace impl
00098 {
00099
00100 namespace generic
00101 {
00102
00108
00109 template <typename I, typename J>
00110 inline
00111 void paste(const Image<I>& input_, Image<J>& output_)
00112 {
00113 trace::entering("data::impl::generic::paste");
00114
00115 data::internal::paste_tests(input_, output_);
00116
00117 const I& input = exact(input_);
00118 J& output = exact(output_);
00119
00120
00121 mln_piter(I) p(input.domain());
00122 for_all(p)
00123 output(p) = static_cast<mln_value(J)>(input(p));
00124
00125 trace::exiting("data::impl::generic::paste");
00126 }
00127
00128 }
00129
00130 }
00131
00132
00133
00134
00135 template <typename I, typename J>
00136 inline
00137 void paste(const Image<I>& input, Image<J>& output)
00138 {
00139 trace::entering("data::paste");
00140
00141 mlc_converts_to(mln_value(I), mln_value(J))::check();
00142
00143 internal::paste_tests(input, output);
00144 internal::paste_dispatch(input, output);
00145
00146 trace::exiting("data::paste");
00147 }
00148
00149 # endif // ! MLN_INCLUDE_ONLY
00150
00151 }
00152
00153 }
00154
00155
00156
00157 #endif // ! MLN_DATA_PASTE_HH