HistogramDialog.h
Go to the documentation of this file.00001
00002 #ifndef __HISTOGRAMSDIALOG__
00003 #define __HISTOGRAMSDIALOG__
00004
00005
00006
00007
00008
00009
00010 #include <wx/wxprec.h>
00011 #ifdef __BORLANDC__
00012 #pragma hdrstop
00013 #endif
00014 #ifndef WX_PRECOMP
00015 #include <wx/wx.h>
00016 #endif
00017
00018
00019
00020
00021 #include "HistogramWidget.h"
00022 #include "vtkImageData.h"
00023
00024 #include <vtkPiecewiseFunction.h>
00025 #include <vtkColorTransferFunction.h>
00026 #include <vtkVolumeRayCastMapper.h>
00027 #include <vtkVolume.h>
00028
00029
00030 #include "HistogramDialogComboBoxItem.h"
00031 #include <wx/checkbox.h>
00032 #include <wx/statbmp.h>
00033
00034 class HistogramDialog:public wxDialog
00035 {
00036 public:
00037
00038
00039
00040 HistogramDialog(wxWindow *parent,wxString title,vtkImageData* imageData,bool extracontrols=false);
00041
00042
00043
00044 HistogramDialog(wxWindow *parent,wxString title,bool extracontrols=false);
00045 ~HistogramDialog();
00046
00047
00048
00049
00050
00051
00052 int getSizeTransferenceFunction();
00053
00054
00055
00056 int getSizeBarColor();
00057
00058
00059
00060 void getTransferenceFunctionPoint(int index,int& x,int& y);
00061
00062
00063
00064 void getDataBarColorPoint(int index,int&x, int& red,int& green,int& blue);
00065
00066
00067
00068
00069 int getHistogramPoint(int gValue);
00070
00071
00072
00073
00074
00075
00076
00077
00078 float getMaxShowedPorcentage();
00079 float getMinShowedPorcentage();
00080 float getActualShowedPorcentage();
00081
00082
00083
00084
00085
00086
00087
00088
00089 bool addPointToTransferenceFunction(double x, double y);
00090
00091
00092
00093
00094
00095
00096
00097 bool addColorPoint(double x,int red,int green, int blue);
00098
00099
00100
00101
00102
00103
00104
00105 void erasePointsTransferenceFunction();
00106 void eraseColorPoints();
00107
00108
00109
00110
00111 void setTransferenceFunctionHasPoints(bool hasPoints);
00112 void setTransferenceFunctionHasColor(bool hasColorPoints);
00113
00114
00115
00116 bool getRefreshed();
00117 void setCTF(vtkColorTransferFunction* cf);
00118 void setTF(vtkPiecewiseFunction* tf);
00119 void setVolumeMapper(vtkVolumeRayCastMapper* volMapper);
00120 void setVolume(vtkVolume* vol);
00121
00122
00123
00124
00125
00126
00127 void updatePlotter();
00128
00129
00130
00131
00132
00133 void OnSaveData(wxCommandEvent& event);
00134 void OnLoadData(wxCommandEvent& event);
00135 void OnRefreshBtn(wxCommandEvent& event);
00136
00137
00141 void initializeHistogram(vtkImageData* img);
00145 void GetValuesPointsFunction(std::vector<double>& greylevel,std::vector<double>& value);
00146
00151 void GetValuesColorPointsFunction(std::vector<double>& greylevel,
00152 std::vector<double>& red,
00153 std::vector<double>& green,
00154 std::vector<double>& blue);
00155 void SetFunctions(vtkPiecewiseFunction* _opac, vtkColorTransferFunction* _color);
00156
00160 void setInfoPanExtraControls(std::vector<HistogramDialogComboBoxItem*> comboitems);
00161
00162
00166 void OnEditColorsCombo(wxCommandEvent& event);
00167 void OnDeleteColor(wxCommandEvent& event);
00168
00169 std::vector<HistogramDialogComboBoxItem*> getComboBoxItems(){return _comboitems;}
00170
00171 void UpdateCurrentComboElement();
00172
00173 private:
00174
00175
00176
00177 HistogramWidget* histogramW;
00181
00182
00183
00184
00185 wxBitmapButton *okBtn;
00186
00187
00188
00189
00190 wxBitmapButton *cancelBtn;
00191
00192
00193
00194 wxButton *saveDataBtn;
00195
00196
00197
00198 wxButton *loadDataBtn;
00199
00200
00201
00202 wxButton *refreshBtn;
00203
00204 wxPanel* _panextracontrols;
00205
00206
00207
00208 bool refreshed;
00209
00210 vtkColorTransferFunction *_ctfun;
00211 vtkPiecewiseFunction *_tfun;
00212 vtkVolumeRayCastMapper *volumeMapper;
00213 vtkVolume *newvol;
00214
00215
00216
00217
00218
00219
00220 wxSizer* getControls(bool extracontrols = false);
00221
00222
00223
00224
00225
00226
00227
00228 void initializeHistogramDialog(bool extracontrols);
00229
00230 wxPanel* getPanExtraControls();
00231
00232 std::vector<wxBitmapButton*> bitmapbuttonsvect;
00233 std::vector<HistogramDialogComboBoxItem*> _comboitems;
00234
00235 void setCurrentColorConfigurationIntoButton();
00236 void AddNewBitmapButton();
00237 wxSizer* getBitmapButtonDelete(wxBitmap bitmap);
00238 std::vector<wxBitmapButton*> _deletebuttonsvector;
00239
00240 int _maxgreyvalue;
00241 int _currentcolorselectedbitmap;
00242 };
00243
00244 #endif
00245
00246
00247