]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialog.h
creaMaracasVisu Library
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / pPlotter / HistogramDialog.h
1
2 #ifndef __HISTOGRAMSDIALOG__
3 #define __HISTOGRAMSDIALOG__
4
5
6 // ----------------------------------------------------------------------------
7 // wx headers inclusion.
8 // For compilers that support precompilation, includes <wx/wx.h>.
9 // ----------------------------------------------------------------------------
10 #include <wx/wxprec.h>
11 #ifdef __BORLANDC__
12 #pragma hdrstop
13 #endif
14 #ifndef WX_PRECOMP
15 #include <wx/wx.h>
16 #endif
17
18  //---------------------
19  // Includes
20  //----------------------
21  #include "HistogramWidget.h"
22  #include "vtkImageData.h"      
23  //#include <vector>
24  #include <vtkPiecewiseFunction.h>
25  #include <vtkColorTransferFunction.h>
26  #include <vtkVolumeRayCastMapper.h>
27  #include <vtkVolume.h>
28  #include "../wxMPRWidget.h"
29
30 class HistogramDialog:public wxDialog
31 {
32 public:
33         /*
34          Constructor
35         */
36         HistogramDialog(wxWindow *parent,wxString title,vtkImageData* imageData,int type);
37         /*
38          Methods
39         */
40         /*
41                 get number of points of the transference function
42         */
43         int getSizeTransferenceFunction();
44         /*
45                 get number of points of the barColor
46         */
47         int getSizeBarColor();
48         /*
49                 get a point of the transference function
50         */
51         void getTransferenceFunctionPoint(int index,int& x,int& y);
52         /*
53                 get a  color int the bqr color
54         */
55         void getDataBarColorPoint(int index,int&x, int& red,int& green,int& blue);
56         /*
57                 get a point of the Histogram
58                 given the grey value
59         */
60         int getHistogramPoint(int gValue);
61
62         //--------------------
63         // bar Information
64         //---------------------
65         /*
66          Get the porcentage of the positions of 
67          the min,max and actual in the bar range
68         */
69         float getMaxShowedPorcentage();
70         float getMinShowedPorcentage(); 
71         float getActualShowedPorcentage();
72
73         //---------------------------------------
74         // setting data in transferences function
75         // and in bar color
76         //----------------------------------------
77         /*
78           Adds a point to the transference function
79         */
80         bool addPointToTransferenceFunction(double x, double y);
81         /*
82                 add a color point to the histogram
83                 @param x the level of grey to which the color is assigned
84                 @param red the level of red for the color
85                 @param green the level of red for the color
86                 @param blue the level of red for the color
87         */
88         bool addColorPoint(double x,int red,int green, int blue);
89         //------------------------
90         //Erase data
91         //------------------------
92         
93         /*
94          Erase all the points that are in the transference function
95         */
96         void erasePointsTransferenceFunction();
97         void eraseColorPoints();
98         //-------------------
99         // Getter and setters
100         //-------------------
101
102         void setTransferenceFunctionHasPoints(bool hasPoints);
103         void setTransferenceFunctionHasColor(bool hasColorPoints);
104         
105         //returns if the user has pressed refresh       
106         
107         bool getRefreshed();
108         void setCTF(vtkColorTransferFunction* cf);
109         void setTF(vtkPiecewiseFunction* tf);
110         void setVolumeMapper(vtkVolumeRayCastMapper* volMapper);
111         void setVolume(vtkVolume* vol);
112         void setMPR3Dview(wxVtkMPR3DView *wxvtkmpr3Dview1);
113         void setClipping3DView(wxVtkClipping3DView *wxvtkclipping3Dview1);
114
115         //--------------------
116         // plotter Information
117         //---------------------
118         void updatePlotter();
119         
120         //-----------------------
121         //Handling events
122         //-----------------------
123
124         void OnSaveData(wxCommandEvent& event);
125         void OnLoadData(wxCommandEvent& event);
126         void OnRefreshBtn(wxCommandEvent& event);
127         
128 private:
129         /*
130         Histogram Widget
131         */
132         HistogramWidget*  histogramW;
133
134         /*
135          ok Button
136         */
137         wxButton                *okBtn;
138         /*
139          cancel Button
140         */
141         wxButton                *cancelBtn;
142         /*
143          save Button
144         */
145         wxButton                *saveDataBtn;   
146         /*
147         Load Button
148         */
149         wxButton                *loadDataBtn;
150         /*
151         Refresh Button
152         */
153         wxButton                *refreshBtn;
154
155         
156         
157         // the user had pressed refresh
158         bool refreshed;
159         
160         vtkColorTransferFunction                        *_ctfun;
161         vtkPiecewiseFunction                            *_tfun;
162         vtkVolumeRayCastMapper                          *volumeMapper; 
163         vtkVolume                                                       *newvol;
164
165         //things to refresh
166         wxVtkMPR3DView                                          *wxvtkmpr3Dview;
167         wxVtkClipping3DView                                     *wxvtkclipping3Dview;
168         
169         
170 //      DECLARE_CLASS(HistogramDialog);
171         // any class wishing to process wxWindows events must use this macro
172         //DECLARE_EVENT_TABLE()
173 };
174
175 #endif
176
177
178