00001 // This is brl/bbas/bgui/bgui_histogram_tableau.h 00002 #ifndef bgui_histogram_tableau_h_ 00003 #define bgui_histogram_tableau_h_ 00004 //: 00005 // \file 00006 // \author Matt Leotta 00007 // \brief A tableau to a histogram for an image 00008 // The histogram is plotted on an easy2D tableau 00009 // 00010 // \verbatim 00011 // Modifications 00012 // Ozge Can Ozcanli May 2006 Added vil support to the update method 00013 // 00014 // \endverbatim 00015 00016 #include <vil1/vil1_memory_image_of.h> 00017 #include <vil1/vil1_rgb.h> 00018 #include <vil/vil_image_view.h> 00019 #include <vgui/vgui_tableau.h> 00020 #include <vgui/vgui_event.h> 00021 #include <vgui/vgui_soview2D.h> 00022 #include <vgui/vgui_easy2D_tableau_sptr.h> 00023 00024 #include "bgui_histogram_tableau_sptr.h" 00025 00026 class bgui_histogram_tableau : public vgui_tableau 00027 { 00028 public: 00029 //: Constructor takes all the labels used on the graph. 00030 bgui_histogram_tableau(); 00031 //: Destructor. 00032 ~bgui_histogram_tableau(); 00033 //: Update the histogram 00034 void update(vil1_memory_image_of< vil1_rgb<unsigned char> >& img); 00035 void update(vil_image_view< vxl_byte >& img); 00036 //: Return the name of this tableau. 00037 vcl_string type_name() const { return "bgui_histogram_tableau";} 00038 //: Handles all events for this tableau. 00039 bool handle(const vgui_event&); 00040 //: Clear the data 00041 void clear(); 00042 private: 00043 int left_offset_; 00044 int top_offset_; 00045 int graph_width_; 00046 int graph_height_; 00047 //: List of points. 00048 vcl_vector<float> xpoints_, ypoints_; 00049 vgui_easy2D_tableau_sptr easy_; 00050 vgui_soview2D_linestrip* plot_; 00051 vcl_vector<double> data_; 00052 }; 00053 00054 00055 struct bgui_histogram_tableau_new : public bgui_histogram_tableau_sptr 00056 { 00057 typedef bgui_histogram_tableau_sptr base; 00058 bgui_histogram_tableau_new() 00059 : base(new bgui_histogram_tableau()) { } 00060 }; 00061 00062 #endif // bgui_histogram_tableau_h_