00001
00002 #ifndef _DTM_DTM_H_
00003 #define _DTM_DTM_H_
00004
00005 #include <libdtm.h>
00006 #include <libdtm_gdhe.h>
00007
00008 #include <string>
00009 #include "calife/Image3d.hpp"
00010 #include "geom/t3d.hpp"
00011 #include "calife/T3d.hpp"
00012 #include "image/Image.hpp"
00013
00014 namespace jafar {
00015 namespace dtm {
00016
00022 class Dtm {
00023
00024 public:
00028 enum file_method {
00029 DTM_ASCII,
00030 DTM_ARCGIS,
00031 DTM_BIN
00032 };
00033
00037 enum fill_method {
00038 DTM_FILL_BASIC,
00039 DTM_FILL_QUAD,
00040 DTM_FILL_DYNAMIC
00041 };
00042
00046 enum gdhe_method {
00047 DTM_GDHE_FULL,
00048 DTM_GDHE_UPDATE
00049 };
00050
00054 enum image_method {
00055 DTM_NB_POINTS,
00056 DTM_Z_MOYEN,
00057 DTM_SIGMA_Z,
00058 DTM_CONFIDENCE,
00059 DTM_HSTATE,
00060 DTM_VISIBILITY,
00061 DTM_HSTATE_VISIBILITY
00062 };
00063
00064 static std::string default_conf_file;
00065
00066 private:
00067 DTM * pdtm;
00069 DTM * local_pdtm;
00071
00072 double _zscale;
00073 double _zoffset;
00074 int _luminance;
00075
00076
00077 fill_method _way;
00079 void to_image_nb_points(jafar::image::Image &, DTM*) const;
00080 void to_image_z_moyen(jafar::image::Image &, DTM*) const;
00081 void to_image_sigma_z(jafar::image::Image &, DTM*) const;
00082 void to_image_hstate(jafar::image::Image &, DTM*) const;
00083 void to_image_visibility(jafar::image::Image &, DTM*) const;
00084 void to_image_hstate_visibility(jafar::image::Image &, DTM*) const;
00085
00086 void _write_image(jafar::image::Image &, const image_method &, DTM*) const;
00087 public:
00088 Dtm(const std::string conf_file = default_conf_file,
00089 dtm_type type = DTM_FIXED,
00090 dtm_stockage stockage = X_LIGNES,
00091 const fill_method fill_way = DTM_FILL_BASIC);
00092 Dtm(const Dtm &);
00093 ~Dtm();
00094
00100 void dup(const Dtm & a);
00101
00108 void dup_empty(const Dtm & a);
00109
00118 void to_file (const std::string & path, const file_method way) const;
00119
00120
00130 void from_file (const std::string & path, const file_method way);
00131
00136 void set_gdhe_display_params(double scale, double offset, int luminance);
00137
00147 int to_gdhe (const std::string & path, const gdhe_method way) const;
00148
00156 void from_gdhe (const std::string & path);
00157
00168 int fuse(jafar::calife::Image3d& im3d, jafar::geom::T3D& t3d, jafar::geom::T3D& s2o);
00169
00186 int prepare_dynamic_fuse(jafar::calife::Image3d & im3d,
00187 jafar::geom::T3D& left, jafar::geom::T3D& right,
00188 double *intrinsec_rectified_param, int reduction,
00189 double max_depth);
00190
00195 bool is_ready_for_dynamic_fuse() { return (_way != DTM_FILL_DYNAMIC || local_pdtm != 0); };
00196
00201 int get_imax() const;
00202
00207 int get_jmax() const;
00208
00217 bool get_z(int i, int j , float * z) const;
00218
00229 void set_z(int i, int j, float);
00230
00235 double get_scale() const;
00236
00241 double get_x_orig() const;
00242
00247 double get_y_orig() const;
00248
00255 void min_max();
00256
00262 void print_info() const;
00263
00271 void print_cell_info(int i, int j) const;
00272
00281 DTM* get_data() const;
00282
00293 static void scaleZ(const std::string & orig, double scale, const std::string & res );
00294
00295
00304 void write_image(jafar::image::Image & img, const image_method & method, bool global = true) const;
00305
00313 jafar::image::Image* to_image(const image_method & method, bool global = true) const;
00314 };
00315 }
00316 }
00317
00318
00319 #endif