00001 #include<ImLib3D/ImLib3D.hpp>
00002 #include<ImLib3D/ImLib3D.hpp>
00003 #include<ImLib3D/TestPatterns.hpp>
00004 #include<algorithm>
00005 #include<functional>
00006 #include<math.h>
00007
00008
00009
00010
00011 struct Adder : public unary_function<double, void>
00012 {
00013 Adder() : sum(0) {}
00014 double sum;
00015 void operator()(double x) { sum += x; }
00016 };
00017
00018 float myfct(float x){return 10*cos(M_PI*x);}
00019
00020 int
00021 main(int argc,char **argv)
00022 {
00023
00024 Image3Df ima(100,100,100);
00025
00026
00027 fill(ima.begin(),ima.end(),3);
00028
00029
00030 Adder result = for_each(ima.begin(), ima.end(), Adder());
00031 cout << "The sum is " << result.sum << endl;
00032
00033
00034 for_each(ima.begin(), ima.end(), ptr_fun(myfct));
00035
00036
00037 ima(10,10,10)=1000;
00038 Image3Df::iterator a=find(ima.begin(), ima.end(),1000);
00039 cout << "found value at:" << a.ComputePosition() << endl;
00040
00041
00042 IP3D::NoiseGaussian(Size3D(10,10,10),ima);
00043 sort(ima.begin(),ima.end());
00044 }