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 #include "../wxMPRWidget.h"
00029
00030 class HistogramDialog:public wxDialog
00031 {
00032 public:
00033
00034
00035
00036 HistogramDialog(wxWindow *parent,wxString title,vtkImageData* imageData,int type);
00037
00038
00039
00040 HistogramDialog(wxWindow *parent,wxString title);
00041
00042
00043
00044
00045
00046
00047 int getSizeTransferenceFunction();
00048
00049
00050
00051 int getSizeBarColor();
00052
00053
00054
00055 void getTransferenceFunctionPoint(int index,int& x,int& y);
00056
00057
00058
00059 void getDataBarColorPoint(int index,int&x, int& red,int& green,int& blue);
00060
00061
00062
00063
00064 int getHistogramPoint(int gValue);
00065
00066
00067
00068
00069
00070
00071
00072
00073 float getMaxShowedPorcentage();
00074 float getMinShowedPorcentage();
00075 float getActualShowedPorcentage();
00076
00077
00078
00079
00080
00081
00082
00083
00084 bool addPointToTransferenceFunction(double x, double y);
00085
00086
00087
00088
00089
00090
00091
00092 bool addColorPoint(double x,int red,int green, int blue);
00093
00094
00095
00096
00097
00098
00099
00100 void erasePointsTransferenceFunction();
00101 void eraseColorPoints();
00102
00103
00104
00105
00106 void setTransferenceFunctionHasPoints(bool hasPoints);
00107 void setTransferenceFunctionHasColor(bool hasColorPoints);
00108
00109
00110
00111 bool getRefreshed();
00112 void setCTF(vtkColorTransferFunction* cf);
00113 void setTF(vtkPiecewiseFunction* tf);
00114 void setVolumeMapper(vtkVolumeRayCastMapper* volMapper);
00115 void setVolume(vtkVolume* vol);
00116 void setMPR3Dview(wxVtkMPR3DView *wxvtkmpr3Dview1);
00117 void setClipping3DView(wxVtkClipping3DView *wxvtkclipping3Dview1);
00118
00119
00120
00121
00122 void updatePlotter();
00123
00124
00125
00126
00127
00128 void OnSaveData(wxCommandEvent& event);
00129 void OnLoadData(wxCommandEvent& event);
00130 void OnRefreshBtn(wxCommandEvent& event);
00131
00135 void initializeHistogram(vtkImageData* img);
00139 void GetValuesPointsFunction(std::vector<double>& greylevel,std::vector<double>& value);
00140
00145 void GetValuesColorPointsFunction(std::vector<double>& greylevel,
00146 std::vector<double>& red,
00147 std::vector<double>& green,
00148 std::vector<double>& blue);
00149 void SetFunctions(vtkPiecewiseFunction* _opac, vtkColorTransferFunction* _color);
00150 private:
00151
00152
00153
00154 HistogramWidget* histogramW;
00155
00156
00157
00158
00159 wxButton *okBtn;
00160
00161
00162
00163 wxButton *cancelBtn;
00164
00165
00166
00167 wxButton *saveDataBtn;
00168
00169
00170
00171 wxButton *loadDataBtn;
00172
00173
00174
00175 wxButton *refreshBtn;
00176
00177
00178
00179
00180 bool refreshed;
00181
00182 vtkColorTransferFunction *_ctfun;
00183 vtkPiecewiseFunction *_tfun;
00184 vtkVolumeRayCastMapper *volumeMapper;
00185 vtkVolume *newvol;
00186
00187
00188 wxVtkMPR3DView *wxvtkmpr3Dview;
00189 wxVtkClipping3DView *wxvtkclipping3Dview;
00190
00191
00192
00193
00194
00195 };
00196
00197 #endif
00198
00199
00200