contrib/mul/vil3d/vil3d_print.h
Go to the documentation of this file.
00001 // This is mul/vil3d/vil3d_print.h
00002 #ifndef vil3d_print_h_
00003 #define vil3d_print_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \author Ian Scott, Tim Cootes.
00010 
00011 #include <vil/vil_print.h>
00012 #include <vil3d/vil3d_image_view.h>
00013 #include <vcl_iostream.h>
00014 
00015 #ifdef VCL_VC_DOTNET
00016 #  pragma warning( push )
00017 #  pragma warning( disable: 4244 )  // conversion from ptrdiff_t to int, possible loss of data
00018 #endif
00019 
00020 //: Print all image data to os in a grid (rounds output to int)
00021 // \relatesalso vil3d_image_view
00022 template <class T>
00023 inline void vil3d_print_all(vcl_ostream& os,const vil3d_image_view<T>& view)
00024 {
00025   int width=os.width();
00026   os<<view.is_a()<<' '<<view.nplanes()
00027     <<" planes, each "<<view.ni()<<" x "<<view.nj()<<" x "<<view.nk()
00028     <<" istep: "<<view.istep()<<' '
00029     <<" jstep: "<<view.jstep()<<' '
00030     <<" kstep: "<<view.kstep()<<' '
00031     <<" planestep: "<<view.planestep()<<'\n' << vcl_flush;
00032   for (unsigned int p=0;p<view.nplanes();++p)
00033   {
00034     if (view.nplanes()>1) os<<"Plane "<<p<<'\n';
00035     for (unsigned int k=0;k<view.nk();++k)
00036     {
00037       if (view.nk()>1) os<<"Slice "<<k<<":\n";
00038       for (unsigned int j=0;j<view.nj();++j)
00039       {
00040         for (unsigned int i=0;i<view.ni();++i)
00041         {
00042           os.width(width);
00043           vil_print_value(os,view(i,j,k,p));
00044           os<<' ';
00045         }
00046         os<<'\n';
00047       }
00048     }
00049   }
00050 }
00051 
00052 #ifdef VCL_VC_DOTNET
00053 #  pragma warning( pop )
00054 #endif
00055 
00056 
00057 #endif // vil3d_print_h_