00001
00002 #ifndef vimt3d_load_h_
00003 #define vimt3d_load_h_
00004
00005
00006
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
00015
00016
00017 vimt3d_transform_3d vimt3d_load_transform(const vil3d_image_resource_sptr &im,
00018 bool use_millimetres=false);
00019
00020
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_