7 // ----------------------------------------------------------------------------
8 // wx headers inclusion.
9 // For compilers that support precompilation, includes <wx/wx.h>.
10 // ----------------------------------------------------------------------------
11 #include <wx/wxprec.h>
20 #include "pFunctionPoint.h"
21 #include "vtkImageData.h"
22 #include "pHistogram.h"
23 #include "pPlotterScaleY.h"
24 #include "pPlotterScaleX.h"
27 #define NUM_POINTS 100
28 #define WINDOW_SIZE 10
30 class HistogramWidget:public wxPanel
33 //---------------------
35 //----------------------
37 //HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int flag );
40 HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int flag,vtkImageData* imageData,int type);
45 Draw the histogram in the plotter
49 Draw the transference function in the plotter
51 void drawTransferenceFunction();
53 if the user resize the window
55 void OnSize( wxSizeEvent &WXUNUSED(event) );
56 //---------------------------------------
57 // Get Information from the widget
58 //---------------------------------------
60 get number of points of the transference function
62 int getSizeTransferenceFunction();
64 get number of points of the barColor
66 int getSizeBarColor();
68 get a point of the transference function
70 void getTransferenceFunctionPoint(int index,int& x,int& y);
72 get a color int the bqr color
74 void getDataBarColorPoint(int index,int&x, int& red,int& green,int& blue);
76 get a point of the Histogram
79 int getHistogramPoint(int gValue);
81 //--------------------
83 //---------------------
85 Get the porcentage of the positions of
86 the min,max and actual in the bar range
88 float getMaxShowedPorcentage();
89 float getMinShowedPorcentage();
90 float getActualShowedPorcentage();
92 //---------------------------------------
93 // setting data in transferences function
95 //----------------------------------------
97 Adds a point to the transference function
99 bool addPointToTransferenceFunction(double x, double y);
101 add a color point to the histogram
102 @param x the level of grey to which the color is assigned
103 @param red the level of red for the color
104 @param green the level of red for the color
105 @param blue the level of red for the color
107 bool addColorPoint(double x,int red,int green, int blue);
108 //--------------------
109 // plotter Information
110 //---------------------
111 void updatePlotter();
113 //------------------------
115 //------------------------
119 Erase all the points that are in the transference function
121 void erasePointsTransferenceFunction();
123 Erase the color points in the plotter
125 void eraseColorPoints();
127 //-------------------
128 // Getter and setters
129 //-------------------
131 void setTransferenceFunctionHasPoints(bool hasPoints);
132 void setTransferenceFunctionHasColor(bool hasColorPoints);
133 int getHistogramSize();
134 void setType(int type);
140 pHistogram* histogram;
142 int idTransferenceFunction;
146 if the image has already a transference
147 function and color defines to that function
148 we have to draw it in the widget
150 bool transferenceFunctionHasPoints;
151 bool transferenceFunctionHasColor;
153 * type=1 with transference function for moving
154 * type=2 without transference function for moving
158 DECLARE_CLASS(HistogramWidget);
159 //----------------------------------------------------------------------------
160 // wxWidget macro use declaration for handdling events
161 //----------------------------------------------------------------------------
162 DECLARE_EVENT_TABLE()