]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialogComboBox.h
ee5b947e8a7a5b1b9804dd6784dcd95c0dc8db64
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / pPlotter / HistogramDialogComboBox.h
1
2 #ifndef __HistogramDialogComboBox__
3 #define __HistogramDialogComboBox__
4
5
6 // ----------------------------------------------------------------------------
7 // wx headers inclusion.
8 // For compilers that support precompilation, includes <wx/wx.h>.
9 // ----------------------------------------------------------------------------
10
11 #ifdef __BORLANDC__
12 #pragma hdrstop
13 #endif
14
15 #include <wx/wx.h>
16 #include <vector>
17
18 #include "HistogramDialogComboBoxItem.h"
19 #include <fstream>
20 #include <wx/bmpcbox.h>
21 #include "vtkImageData.h"
22
23 #ifdef WIN32
24 #define FILENAME "/data/colorsfunction.txt"
25 #else
26 #define FILENAME "~/.creaMaracasVisu/data/colorsfunction.txt"
27 #endif
28
29
30 class HistogramDialogComboBox : public wxPanel
31 {
32 public:
33         /*
34          Constructor
35         */
36         HistogramDialogComboBox(wxWindow* parent);
37         //HistogramDialogComboBox(int bar_width,int bar_height);
38         ~HistogramDialogComboBox();
39
40         void SetColors(std::vector<double> greyvect, std::vector<double> redvect, std::vector<double> greenvect, std::vector<double> bluevect);
41         wxBitmap GetBitmap();
42
43         std::vector<double> getGreyVector(){return _greyvect;}
44         std::vector<double> getRedVector(){return _redvect;}
45         std::vector<double> getGreenVector(){return _greenvect;}
46         std::vector<double> getBlueVector(){return _bluevect;}
47
48         void OnEditBitmapCombo(wxCommandEvent& event);
49         void OnBitmapComboItemSelected(wxCommandEvent& event);
50
51         void OnColorLevelChanged(wxCommandEvent& event);        
52         void OnWindowLevelChanged(wxCommandEvent& event);       
53
54         void setImageData(vtkImageData* img);
55
56         /**
57         **      Returns two vectors, the grey level of the point and its value, the value is between [0,1]
58         **/
59         void GetValuesPointsFunction(std::vector<double>& greylevel,std::vector<double>& value);
60
61         /**
62         **      Returns two vectors, the grey level of the point and its value, the red, green
63         **      and blue value is between [0,1]
64         **/
65         void GetValuesColorPointsFunction(std::vector<double>& greylevel,
66                                                                         std::vector<double>& red,
67                                                                         std::vector<double>& green,
68                                                                         std::vector<double>& blue);
69
70         double GetWindowLevel();
71         double GetColorLevel();
72
73 private:
74
75         std::vector<double> _greyvect;
76         std::vector<double> _redvect;
77         std::vector<double> _greenvect;
78         std::vector<double> _bluevect;
79         std::vector<double> _greyvecttransfer;
80         std::vector<double> _value;
81         vtkImageData* _img;
82         double _maxgreyvalue;
83         int _currentitem;       
84
85         /*
86         * Represents the color of the backGround. Default color is the parent color. 
87         */              
88
89         wxBitmapComboBox*       _bitmapcombo;
90         wxSlider*       _slidercolor;
91         wxSlider*       _sliderwindowlevel;
92         std::vector<HistogramDialogComboBoxItem*> _bitmapsitems;
93         wxBitmap* colorBar_Bitmap;
94         wxSizer* _bitmapsizer;
95
96         wxSizer* getBitmapCombo();
97         wxSizer* getSlidersWlCo();
98         wxBitmapComboBox* getBitmapComboElements();
99         void OnLoadComboBoxData(std::vector<HistogramDialogComboBoxItem*>& itembitmaps,std::string filename);
100         void saveCurrentConfiguration(std::vector<HistogramDialogComboBoxItem*>& itembitmaps,std::string filename);
101         void setSlidersValue();
102
103
104         
105 };
106
107 #endif
108
109
110