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 #include <mln/data/fill_with_value.hh>
00027
00028 #include <mln/core/image/image1d.hh>
00029 #include <mln/core/image/image2d.hh>
00030 #include <mln/core/image/image3d.hh>
00031 #include <mln/core/image/flat_image.hh>
00032 #include <mln/core/image/dmorph/image_if.hh>
00033 #include <mln/core/image/dmorph/sub_image.hh>
00034 #include <mln/core/image/dmorph/extension_val.hh>
00035
00036 #include <mln/value/rgb8.hh>
00037 #include <mln/fun/p2b/chess.hh>
00038
00039 #include <mln/make/box2d.hh>
00040
00041 int main()
00042 {
00043 using namespace mln;
00044 const unsigned size = 50;
00045
00046 {
00047 typedef image1d<unsigned char> I;
00048 I ima(size);
00049 data::fill_with_value(ima, 51);
00050 mln_piter_(I) p(ima.domain());
00051 for_all(p)
00052 mln_assertion(ima(p) == 51);
00053 }
00054
00055
00056 {
00057 typedef image2d<unsigned char> I;
00058 I ima(size, size);
00059 data::fill_with_value(ima, 51);
00060 mln_piter_(I) p(ima.domain());
00061 for_all(p)
00062 mln_assertion(ima(p) == 51);
00063 }
00064
00065 {
00066 typedef image3d<value::rgb8> I;
00067 I ima(size, size, size);
00068 data::fill_with_value(ima, value::rgb8(255, 0, 255));
00069 mln_piter_(I) p(ima.domain());
00070 for_all(p)
00071 mln_assertion(ima(p) == value::rgb8(255, 0, 255));
00072 }
00073
00074
00075 {
00076 flat_image<short, box2d> ima(5, make::box2d(2, 3));
00077 data::fill_with_value(ima, 51);
00078 box2d::piter p(ima.domain());
00079 for_all(p)
00080 mln_assertion(ima(p) == 51);
00081 }
00082
00083
00084 {
00085 typedef image2d<unsigned char> I;
00086 typedef image_if<I, fun::p2b::chess> II;
00087
00088 I ima(size, size);
00089 data::fill_with_value(ima, 51);
00090
00091 II ima_if = ima | fun::p2b::chess();
00092 data::fill_with_value(ima_if, 42);
00093
00094 II::piter p(ima_if.domain());
00095 for_all(p)
00096 mln_assertion(ima_if(p) == 42);
00097 }
00098
00099 {
00100 typedef image2d<int> I;
00101 typedef sub_image< image2d<int>, box2d > II;
00102 I ima(size, size);
00103 II sub_ima(ima, make::box2d(4,4, 10,10));
00104
00105 data::fill_with_value(sub_ima, 5);
00106
00107 II::piter p(sub_ima.domain());
00108 for_all(p)
00109 mln_assertion(sub_ima(p) == 5);
00110 }
00111
00112 {
00113 typedef image2d<int> I;
00114 typedef extension_val< image2d<int> > II;
00115 I ima(size, size);
00116 II extend_ima(ima, 5);
00117
00118 data::fill_with_value(extend_ima, 51);
00119
00120 II::piter p(extend_ima.domain());
00121 for_all(p)
00122 mln_assertion(extend_ima(p) == 51);
00123 }
00124
00125 }