2 #ifndef __HISTOGRAMSDIALOG__
3 #define __HISTOGRAMSDIALOG__
6 // ----------------------------------------------------------------------------
7 // wx headers inclusion.
8 // For compilers that support precompilation, includes <wx/wx.h>.
9 // ----------------------------------------------------------------------------
10 #include <wx/wxprec.h>
18 //---------------------
20 //----------------------
21 #include "HistogramWidget.h"
22 #include "vtkImageData.h"
24 #include <vtkPiecewiseFunction.h>
25 #include <vtkColorTransferFunction.h>
26 #include <vtkVolumeRayCastMapper.h>
27 #include <vtkVolume.h>
28 #include "../wxMPRWidget.h"
30 class HistogramDialog:public wxDialog
36 HistogramDialog(wxWindow *parent,wxString title,vtkImageData* imageData,int type);
40 HistogramDialog(wxWindow *parent,wxString title);
45 get number of points of the transference function
47 int getSizeTransferenceFunction();
49 get number of points of the barColor
51 int getSizeBarColor();
53 get a point of the transference function
55 void getTransferenceFunctionPoint(int index,int& x,int& y);
57 get a color int the bqr color
59 void getDataBarColorPoint(int index,int&x, int& red,int& green,int& blue);
61 get a point of the Histogram
64 int getHistogramPoint(int gValue);
66 //--------------------
68 //---------------------
70 Get the porcentage of the positions of
71 the min,max and actual in the bar range
73 float getMaxShowedPorcentage();
74 float getMinShowedPorcentage();
75 float getActualShowedPorcentage();
77 //---------------------------------------
78 // setting data in transferences function
80 //----------------------------------------
82 Adds a point to the transference function
84 bool addPointToTransferenceFunction(double x, double y);
86 add a color point to the histogram
87 @param x the level of grey to which the color is assigned
88 @param red the level of red for the color
89 @param green the level of red for the color
90 @param blue the level of red for the color
92 bool addColorPoint(double x,int red,int green, int blue);
93 //------------------------
95 //------------------------
98 Erase all the points that are in the transference function
100 void erasePointsTransferenceFunction();
101 void eraseColorPoints();
102 //-------------------
103 // Getter and setters
104 //-------------------
106 void setTransferenceFunctionHasPoints(bool hasPoints);
107 void setTransferenceFunctionHasColor(bool hasColorPoints);
109 //returns if the user has pressed refresh
112 void setCTF(vtkColorTransferFunction* cf);
113 void setTF(vtkPiecewiseFunction* tf);
114 void setVolumeMapper(vtkVolumeRayCastMapper* volMapper);
115 void setVolume(vtkVolume* vol);
116 void setMPR3Dview(wxVtkMPR3DView *wxvtkmpr3Dview1);
117 void setClipping3DView(wxVtkClipping3DView *wxvtkclipping3Dview1);
119 //--------------------
120 // plotter Information
121 //---------------------
122 void updatePlotter();
124 //-----------------------
126 //-----------------------
128 void OnSaveData(wxCommandEvent& event);
129 void OnLoadData(wxCommandEvent& event);
130 void OnRefreshBtn(wxCommandEvent& event);
133 ** Initialize the histogram
135 void initializeHistogram(vtkImageData* img);
137 ** Returns two vectors, the grey level of the point and its value, the value is between [0,1]
139 void GetValuesPointsFunction(std::vector<double>& greylevel,std::vector<double>& value);
142 ** Returns two vectors, the grey level of the point and its value, the red, green
143 ** and blue value is between [0,1]
145 void GetValuesColorPointsFunction(std::vector<double>& greylevel,
146 std::vector<double>& red,
147 std::vector<double>& green,
148 std::vector<double>& blue);
149 void SetFunctions(vtkPiecewiseFunction* _opac, vtkColorTransferFunction* _color);
154 HistogramWidget* histogramW;
167 wxButton *saveDataBtn;
171 wxButton *loadDataBtn;
175 wxButton *refreshBtn;
179 // the user had pressed refresh
182 vtkColorTransferFunction *_ctfun;
183 vtkPiecewiseFunction *_tfun;
184 vtkVolumeRayCastMapper *volumeMapper;
188 wxVtkMPR3DView *wxvtkmpr3Dview;
189 wxVtkClipping3DView *wxvtkclipping3Dview;
192 // DECLARE_CLASS(HistogramDialog);
193 // any class wishing to process wxWindows events must use this macro
194 //DECLARE_EVENT_TABLE()