00001 #ifndef PGH_2DOBJECT
00002 #define PGH_2DOBJECT
00003
00004 #include <boost/numeric/ublas/vector.hpp>
00005 #include <boost/smart_ptr.hpp>
00006 #include <iostream>
00007 #include <list>
00008 #include <string>
00009 #include "mimasconfig.h"
00010 #include "mimasexception.h"
00011 #include "pgh.h"
00012 #include "object.h"
00013 #include "pgh_type.h"
00014 #include "image.h"
00015 #ifdef HAVE_XALAN
00016 #include "xml_reference.h"
00017 #endif
00018
00019 namespace mimas {
00044 class pgh_2dobject : public object
00045 {
00046 public:
00047 typedef std::string string;
00048 typedef boost::numeric::ublas::vector< double > Vector;
00049 private:
00050 string name;
00051 pgh_ptr_list pghlist;
00052 int num_pghs;
00053
00054
00055
00056
00057
00058
00059 line_ptr_list_ptr poly_data;
00060
00061
00062
00063 int bounding_box_x, bounding_box_y;
00064
00065
00066 private:
00067 void deletePghList(void);
00068
00069
00070 protected:
00071 void deleteLineInfo(void);
00072
00073 public:
00074
00075 line_ptr_list_ptr poly_data_GUI;
00076
00077
00078
00084 double canny_sigma;
00085 double canny_precision;
00086 double canny_lowthre;
00087 double canny_upthre;
00088 int canny_lenthre;
00089
00090
00091 int roi_lx;
00092 int roi_ly;
00093 int roi_ux;
00094 int roi_uy;
00095
00096
00101 pgh_type pgh_pairs_type;
00102 double pgh_dbin_max;
00103 double pgh_dbin_size;
00104 double pgh_dist_ramp;
00105 int pgh_num_abin;
00106 double pgh_angle_sigma;
00107
00108
00109 double min_line_length;
00110
00111 Vector ref_point_displ;
00112
00113 int track_roi_lx;
00114 int track_roi_ly;
00115 int track_roi_ux;
00116 int track_roi_uy;
00117
00119 pgh_2dobject(void) { init(); };
00120 ~pgh_2dobject(void);
00121
00123 void init(void);
00124
00125 void clear(void);
00126
00127 string getName(void);
00128 int getNumPghs(void);
00129 pgh_type getPghType(void);
00130 void setName(const std::string &n);
00131 pgh_ptr_list *getPghList(void);
00132 line_ptr_list_ptr getListofLines(void);
00133 line_ptr_list_ptr getListofLinesGUI(void);
00134 void createFromLines( const line_ptr_list &geom ) throw (mimasexception);
00135 void createFromLines( const line_ptr_list &geom, double *cx, double *cy) throw (mimasexception);
00136
00137
00138 void createFromPgmFile(char *pgmfilename);
00139 void createFromImage(image<int> &imagein);
00140
00141
00142
00143 void createFromPolyFile(char *polyfilename);
00144 void createFromPolyFile(char *polyfilename, double *cx, double *cy);
00145 void createFromPgmFile(char *pgmfilename, double *cx, double *cy);
00146 void createFromPgmFile(char *pgmfilename, double *cx, double *cy, char *polyfilename);
00147 void createFromImage(image<int> &imagein, double *cx, double *cy);
00148 void createFromImage(image<int> &imagein, double *cx, double *cy, char *polyfilename);
00149
00150
00151
00152 int getWidth(void) { return bounding_box_x; }
00153 int getHeight(void) { return bounding_box_y; }
00154
00155 #ifdef HAVE_XALAN
00156
00157 void saveObjectParameters( const char *fileName );
00158
00159
00160 void loadObjectParameters( const char *fileName );
00161
00162 protected:
00163 void storeObjectParams( std::ostream &stream );
00164 void extractObjectParams( xml_reference< XalanElement >
00165 &docElement );
00166 #endif
00167 };
00168
00169 typedef boost::shared_ptr< pgh_2dobject > pgh_2dobject_ptr;
00170
00171 typedef std::list< pgh_2dobject_ptr > pgh_2dobject_ptr_list;
00172
00173 }
00174
00175 #endif