Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vimt3d_load.h

Go to the documentation of this file.
00001 // This is mul/vimt3d/vimt3d_load.h
00002 #ifndef vimt3d_load_h_
00003 #define vimt3d_load_h_
00004 //:
00005 // \file
00006 // \author Ian Scott
00007 
00008 #include <vil3d/vil3d_image_resource.h>
00009 #include <vimt3d/vimt3d_transform_3d.h>
00010 #include <vimt3d/vimt3d_image_3d_of.h>
00011 #include <vil3d/vil3d_load.h>
00012 #include <vil3d/vil3d_convert.h>
00013 
00014 //: Create a transform from the properties of image resource.
00015 // The following parameters allow the use of this method in legacy code:
00016 // \param use_millimetres    if true load transform in millimetres (uses metres by default)
00017 vimt3d_transform_3d vimt3d_load_transform(const vil3d_image_resource_sptr &im,
00018                                           bool use_millimetres=false);
00019 
00020 //: Load image from path into given image (forcing to given pixel type)
00021 template<class T>
00022 void vimt3d_load(const vcl_string& path,
00023                  vimt3d_image_3d_of<T>& image)
00024 {
00025   vil3d_image_resource_sptr ir = vil3d_load_image_resource(path.c_str());
00026   if (ir.ptr()==0)
00027   {
00028     image.image().set_size(0,0,0);
00029     return;
00030   }
00031 
00032   image.image() = vil3d_convert_cast(T(), 
00033                                      ir->get_view(0,ir->ni(),0,ir->nj(),0,ir->nk()));
00034   if (image.image().size()==0) return;
00035   bool use_millimeters=true;
00036   image.set_world2im(vimt3d_load_transform(ir,use_millimeters));
00037 }
00038 
00039 #endif // vimt3d_load_h_

Generated on Thu Jan 10 14:44:23 2008 for contrib/mul/vimt3d by  doxygen 1.4.4