Go to the documentation of this file.00001
00002 #ifndef vimt_load_h_
00003 #define vimt_load_h_
00004
00005
00006
00007
00008 #include <vil/vil_image_resource.h>
00009 #include <vil/vil_convert.h>
00010 #include <vil/vil_load.h>
00011 #include <vimt/vimt_image_2d_of.h>
00012
00013
00014
00015 vimt_transform_2d vimt_load_transform(const vil_image_resource_sptr &im,
00016 float unit_scaling=1.0f);
00017
00018
00019
00020
00021
00022
00023 vimt_transform_2d vimt_load_transform_right_hand(const vil_image_resource_sptr &im,
00024 float unit_scaling=1.0f);
00025
00026
00027
00028
00029 template<class T> inline
00030 void vimt_load(const vcl_string& path,
00031 vimt_image_2d_of<T>& image,
00032 float unit_scaling=1.0f)
00033 {
00034 vil_image_resource_sptr ir = vil_load_image_resource(path.c_str());
00035 if (ir.ptr()==0)
00036 {
00037 image.image().set_size(0,0);
00038 return;
00039 }
00040 image.image() = vil_convert_cast(T(),ir->get_view(0,ir->ni(),0,ir->nj()));
00041 image.set_world2im(vimt_load_transform(ir, unit_scaling));
00042 }
00043
00044
00045
00046
00047
00048
00049
00050 template<class T> inline
00051 void vimt_load_right_hand(const vcl_string& path,
00052 vimt_image_2d_of<T>& image,
00053 float unit_scaling=1.0f)
00054 {
00055 vil_image_resource_sptr ir = vil_load_image_resource(path.c_str());
00056 if (ir.ptr()==0)
00057 {
00058 image.image().set_size(0,0);
00059 return;
00060 }
00061
00062 image.image() = vil_convert_cast(T(),
00063 ir->get_view(0,ir->ni(),0,ir->nj()));
00064
00065 image.set_world2im(vimt_load_transform_right_hand(ir, unit_scaling));
00066 }
00067
00068
00069 #endif // vimt_load_h_