00001 00002 #include<ImLib3D/ImLib3D.hpp> 00003 #include<ImLib3D/TestPatterns.hpp> 00004 00005 // Demonstrates use of masks and mask iterators 00006 00007 int 00008 main(int argc,char **argv) 00009 { 00010 // Create a floating point image 00011 Image3Df ima(100,100,100); 00012 // Create a mask for this image 00013 ima.AddMask(); 00014 00015 // We want to draw a sphere into ima's mask 00016 // The Sphere image processor generates an Image3Df, so we must 00017 // use a temporary Image3Df and then convert it. 00018 Image3Df sphere; 00019 // Draw a sphere in image "sphere" (same size as ima) 00020 IP3D::Sphere(ima.Size(),Vect3Df(50,50,50),10,sphere); 00021 // Copy sphere into mask. Note that this does the type conversion 00022 ima.Mask()=sphere; 00023 00024 // for all unmasked pixels do something 00025 Image3Df::iteratorFastMasked p; 00026 for(p=ima.begin();p!=ima.end();p++) 00027 { 00028 (*p)=rand()%100; 00029 } 00030 }