1 // This is brl/bbas/bgui/bgui_histogram_tableau.h
2 #ifndef bgui_histogram_tableau_h_
3 #define bgui_histogram_tableau_h_
4 //:
5 // \file
6 // \author  Matt Leotta
7 // \brief   A tableau to a histogram for an image
8 //  The histogram is plotted on an easy2D tableau
9 //
10 // \verbatim
11 //  Modifications
12 //   Ozge Can Ozcanli    May 2006  Added vil support to the update method
13 //
14 // \endverbatim
15 
16 #include <vil1/vil1_memory_image_of.h>
17 #include <vil1/vil1_rgb.h>
18 #include <vil/vil_image_view.h>
19 #include <vgui/vgui_tableau.h>
20 #include <vgui/vgui_event.h>
21 #include <vgui/vgui_soview2D.h>
22 #include <vgui/vgui_easy2D_tableau_sptr.h>
23 
24 #include "bgui_histogram_tableau_sptr.h"
25 
26 class bgui_histogram_tableau : public vgui_tableau
27 {
28  public:
29   //: Constructor takes all the labels used on the graph.
30   bgui_histogram_tableau();
31   //: Destructor.
32   ~bgui_histogram_tableau();
33   //: Update the histogram
34   void update(vil1_memory_image_of< vil1_rgb<unsigned char> >& img);
35   void update(vil_image_view< vxl_byte >& img);
36   //: Return the name of this tableau.
type_name()37   std::string type_name() const { return "bgui_histogram_tableau";}
38   //: Handles all events for this tableau.
39   bool handle(const vgui_event&);
40   //: Clear the data
41   void clear();
42  private:
43   int left_offset_;
44   int top_offset_;
45   int graph_width_;
46   int graph_height_;
47   //: List of points.
48   std::vector<float> xpoints_, ypoints_;
49   vgui_easy2D_tableau_sptr easy_;
50   vgui_soview2D_linestrip* plot_;
51   std::vector<double> data_;
52 };
53 
54 
55 struct bgui_histogram_tableau_new : public bgui_histogram_tableau_sptr
56 {
57   typedef bgui_histogram_tableau_sptr base;
bgui_histogram_tableau_newbgui_histogram_tableau_new58   bgui_histogram_tableau_new()
59     : base(new bgui_histogram_tableau()) { }
60 };
61 
62 #endif // bgui_histogram_tableau_h_
63