HistogramWidget.h
Go to the documentation of this file.00001
00002
00003 #ifndef __HISTOGRAMW__
00004 #define __HISTOGRAMW__
00005
00006
00007
00008
00009
00010
00011 #include <wx/wxprec.h>
00012 #ifdef __BORLANDC__
00013 #pragma hdrstop
00014 #endif
00015 #ifndef WX_PRECOMP
00016 #include <wx/wx.h>
00017 #endif
00018
00019 #include "marTypes.h"
00020 #include "pPlotter.h"
00021 #include "pFunctionPoint.h"
00022 #include "vtkImageData.h"
00023 #include "pHistogram.h"
00024 #include "pPlotterScaleY.h"
00025 #include "pPlotterScaleX.h"
00026
00027
00028 #define NUM_POINTS 100
00029 #define WINDOW_SIZE 10
00030
00031 class creaMaracasVisu_EXPORT HistogramWidget:public wxPanel
00032 {
00033 public:
00034
00035
00036
00037
00038
00039
00040
00041 HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int flag,vtkImageData* imageData,int type);
00042
00043 HistogramWidget( wxWindow *parent, wxWindowID id);
00044
00045 ~HistogramWidget();
00046
00047
00048
00049
00050 void drawHistogram();
00051
00052
00053
00054 void drawTransferenceFunction();
00055
00056
00057
00058 void OnSize( wxSizeEvent &WXUNUSED(event) );
00059
00060
00061
00062
00063
00064
00065 int getSizeTransferenceFunction();
00066
00067
00068
00069 int getSizeBarColor();
00070
00071
00072
00073 void getTransferenceFunctionPoint(int index,int& x,int& y);
00074
00075
00076
00077 void getDataBarColorPoint(int index,int&x, int& red,int& green,int& blue);
00078
00079
00080
00081
00082 int getHistogramPoint(int gValue);
00083
00084
00085
00086
00087
00088
00089
00090
00091 float getMaxShowedPorcentage();
00092 float getMinShowedPorcentage();
00093 float getActualShowedPorcentage();
00094
00095
00096
00097
00098
00099
00100
00101
00102 bool addPointToTransferenceFunction(double x, double y);
00103
00104
00105
00106
00107
00108
00109
00110 bool addColorPoint(double x,int red,int green, int blue);
00111
00112
00113
00114 void updatePlotter();
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124 void erasePointsTransferenceFunction();
00125
00126
00127
00128 void eraseColorPoints();
00129
00130
00131
00132
00133
00134 void setTransferenceFunctionHasPoints(bool hasPoints);
00135 void setTransferenceFunctionHasColor(bool hasColorPoints);
00136 int getHistogramSize();
00137 void setType(int type);
00138
00142 void initializeHistogram(vtkImageData* img);
00146 void GetValuesPointsFunction(std::vector<double>& greylevel,std::vector<double>& value);
00147
00152 void GetValuesColorPointsFunction(std::vector<double>& greylevel,
00153 std::vector<double>& red,
00154 std::vector<double>& green,
00155 std::vector<double>& blue);
00156
00157
00158
00159 private:
00160
00161 pHistogram* histogram;
00162 pPlotter* plotter;
00163 int idTransferenceFunction;
00164 int histogramSize;
00165 int idHistogram;
00166
00167
00168
00169
00170
00171 bool transferenceFunctionHasPoints;
00172 bool transferenceFunctionHasColor;
00173 wxPanel* getControls();
00174
00175
00176
00177
00178 int type;
00179
00180 DECLARE_CLASS(HistogramWidget);
00181
00182
00183
00184 DECLARE_EVENT_TABLE()
00185
00186 };
00187 #endif
00188
00189