Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

Example4.cpp

00001 
00002 #include<ImLib3D/ImLib3D.hpp>
00003 #include<ImLib3D/TestPatterns.hpp>
00004 #include<ImLib3D/Arithmetic.hpp>
00005 #include<complex>
00006 
00007 // Demonstrates use of templated images
00008 
00009 // An example class 
00010 class MyClass
00011 {
00012 public:
00013     float a;
00014     int   b;
00015 };
00016 
00017 int
00018 main(int argc,char **argv)
00019 {
00020     // Create an image containing elements of type MyClass
00021     Container3D<MyClass> ima(100,100,100);
00022 
00023     // Change somme arbitrary values
00024     ima(20,10,30).a=.5;
00025     ima(20,10,30).b=10;
00026 
00027     // Create an image containing elements of type Vect3Df (3D vector)
00028     // Image3Dlinear supports "+" and "scalar*obj"
00029     // note: Image3Dlinear<Vect3Df>  ha an alias called "Field3Df"
00030     Image3Dlinear<Vect3Df> field(100,100,100);
00031     // Set all values in field to Vect3Df(1,1,1)
00032     field.Fill(Vect3Df(1,1,1));
00033     // Change somme arbitrary values    
00034     field(20,10,30).x=5;
00035     field(20,20,30)=Vect3Df(1,2,3);
00036 
00037     // Use of operators
00038     Image3Dlinear<Vect3Df> field2(100,100,100);
00039     field2.Fill(Vect3Df(2,2,2));
00040     field+=field2;
00041     field*=5;
00042 
00043     // Examples of other images types
00044     // note: Image3Dlinear<complex<double> >  ha an alias called "Image3Dcomplexd"
00045     Image3Dlinear<complex<double> > im2;
00046     // note: Image3Dlinear<int>  ha an alias called "LabelImage3D"
00047     Image3Dlinear<int>  im3;
00048 
00049 }

Generated on Fri Jun 17 13:36:00 2005 for ImLib3D by  doxygen 1.4.2