7 // ----------------------------------------------------------------------------
8 // wx headers inclusion.
9 // For compilers that support precompilation, includes <wx/wx.h>.
10 // ----------------------------------------------------------------------------
11 #include <wx/wxprec.h>
21 #include "pFunctionPoint.h"
22 #include "vtkImageData.h"
23 #include "pHistogram.h"
24 #include "pPlotterScaleY.h"
25 #include "pPlotterScaleX.h"
28 #define NUM_POINTS 100
29 #define WINDOW_SIZE 10
31 class MARACASVISULIB_EXPORTS HistogramWidget:public wxPanel
34 //---------------------
36 //----------------------
38 //HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int flag );
41 HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int flag,vtkImageData* imageData,int type);
46 Draw the histogram in the plotter
50 Draw the transference function in the plotter
52 void drawTransferenceFunction();
54 if the user resize the window
56 void OnSize( wxSizeEvent &WXUNUSED(event) );
57 //---------------------------------------
58 // Get Information from the widget
59 //---------------------------------------
61 get number of points of the transference function
63 int getSizeTransferenceFunction();
65 get number of points of the barColor
67 int getSizeBarColor();
69 get a point of the transference function
71 void getTransferenceFunctionPoint(int index,int& x,int& y);
73 get a color int the bqr color
75 void getDataBarColorPoint(int index,int&x, int& red,int& green,int& blue);
77 get a point of the Histogram
80 int getHistogramPoint(int gValue);
82 //--------------------
84 //---------------------
86 Get the porcentage of the positions of
87 the min,max and actual in the bar range
89 float getMaxShowedPorcentage();
90 float getMinShowedPorcentage();
91 float getActualShowedPorcentage();
93 //---------------------------------------
94 // setting data in transferences function
96 //----------------------------------------
98 Adds a point to the transference function
100 bool addPointToTransferenceFunction(double x, double y);
102 add a color point to the histogram
103 @param x the level of grey to which the color is assigned
104 @param red the level of red for the color
105 @param green the level of red for the color
106 @param blue the level of red for the color
108 bool addColorPoint(double x,int red,int green, int blue);
109 //--------------------
110 // plotter Information
111 //---------------------
112 void updatePlotter();
114 //------------------------
116 //------------------------
120 Erase all the points that are in the transference function
122 void erasePointsTransferenceFunction();
124 Erase the color points in the plotter
126 void eraseColorPoints();
128 //-------------------
129 // Getter and setters
130 //-------------------
132 void setTransferenceFunctionHasPoints(bool hasPoints);
133 void setTransferenceFunctionHasColor(bool hasColorPoints);
134 int getHistogramSize();
135 void setType(int type);
141 pHistogram* histogram;
143 int idTransferenceFunction;
147 if the image has already a transference
148 function and color defines to that function
149 we have to draw it in the widget
151 bool transferenceFunctionHasPoints;
152 bool transferenceFunctionHasColor;
154 * type=1 with transference function for moving
155 * type=2 without transference function for moving
159 DECLARE_CLASS(HistogramWidget);
160 //----------------------------------------------------------------------------
161 // wxWidget macro use declaration for handdling events
162 //----------------------------------------------------------------------------
163 DECLARE_EVENT_TABLE()