]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialogComboBox.h
9fc89ac6600153985365952f9d7639396f3852bf
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / pPlotter / HistogramDialogComboBox.h
1
2 /*# ---------------------------------------------------------------------
3 #
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 #                        pour la Sant�)
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 #
10 #  This software is governed by the CeCILL-B license under French law and
11 #  abiding by the rules of distribution of free software. You can  use,
12 #  modify and/ or redistribute the software under the terms of the CeCILL-B
13 #  license as circulated by CEA, CNRS and INRIA at the following URL
14 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 #  or in the file LICENSE.txt.
16 #
17 #  As a counterpart to the access to the source code and  rights to copy,
18 #  modify and redistribute granted by the license, users are provided only
19 #  with a limited warranty  and the software's author,  the holder of the
20 #  economic rights,  and the successive licensors  have only  limited
21 #  liability.
22 #
23 #  The fact that you are presently reading this means that you have had
24 #  knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------ */
26
27 #ifndef __HistogramDialogComboBox__
28 #define __HistogramDialogComboBox__
29
30
31 // ----------------------------------------------------------------------------
32 // wx headers inclusion.
33 // For compilers that support precompilation, includes <wx/wx.h>.
34 // ----------------------------------------------------------------------------
35
36 #ifdef __BORLANDC__
37 #pragma hdrstop
38 #endif
39
40 #include <wx/wx.h>
41 #include <vector>
42
43 #include "HistogramDialogComboBoxItem.h"
44 #include <fstream>
45 #include <wx/bmpcbox.h>
46 #include "vtkImageData.h"
47
48 #define COLORSFUNCTIONFILENAME "colorsfunction.txt"
49
50 class HistogramDialogComboBox : public wxPanel
51 {
52 public:
53         /*
54          Constructor
55         */
56         HistogramDialogComboBox(wxWindow* parent);
57         //HistogramDialogComboBox(int bar_width,int bar_height);
58         ~HistogramDialogComboBox();
59
60         void SetColors(std::vector<double> greyvect, std::vector<double> redvect, std::vector<double> greenvect, std::vector<double> bluevect);
61         wxBitmap GetBitmap();
62
63         std::vector<double> getGreyVector(){return _greyvect;}
64         std::vector<double> getRedVector(){return _redvect;}
65         std::vector<double> getGreenVector(){return _greenvect;}
66         std::vector<double> getBlueVector(){return _bluevect;}
67
68         void OnEditBitmapCombo(wxCommandEvent& event);
69         void OnBitmapComboItemSelected(wxCommandEvent& event);
70         void BitmapComboItemSelect(int value);
71
72         void OnColorLevelChanged(wxCommandEvent& event);        
73         void OnWindowLevelChanged(wxCommandEvent& event);       
74
75         void setImageData(vtkImageData* img);
76
77         /**
78         **      Returns two vectors, the grey level of the point and its value, the value is between [0,1]
79         **/
80         void GetValuesPointsFunction(std::vector<double>& greylevel,std::vector<double>& value);
81
82         /**
83         **      Returns two vectors, the grey level of the point and its value, the red, green
84         **      and blue value is between [0,1]
85         **/
86         void GetValuesColorPointsFunction(std::vector<double>& greylevel,
87                                                                         std::vector<double>& red,
88                                                                         std::vector<double>& green,
89                                                                         std::vector<double>& blue);
90
91         double GetWindowLevel();
92         double GetColorLevel();
93         void InitCurrentPathColorsFuntion();
94         std::string GetFileNameOfColorsFunction();
95
96 private:
97
98         std::vector<double> _greyvect;
99         std::vector<double> _redvect;
100         std::vector<double> _greenvect;
101         std::vector<double> _bluevect;
102         std::vector<double> _greyvecttransfer;
103         std::vector<double> _value;
104         vtkImageData* _img;
105         double _maxgreyvalue;
106         int _currentitem;       
107
108         std::string _currentpathColorsFuntion;
109
110         /*
111         * Represents the color of the backGround. Default color is the parent color. 
112         */              
113
114         wxBitmapComboBox*       _bitmapcombo;
115         wxSlider*       _slidercolor;
116         wxSlider*       _sliderwindowlevel;
117         std::vector<HistogramDialogComboBoxItem*> _bitmapsitems;
118         wxBitmap* colorBar_Bitmap;
119         wxSizer* _bitmapsizer;
120
121         wxSizer* getBitmapCombo();
122         wxSizer* getSlidersWlCo();
123         wxBitmapComboBox* getBitmapComboElements();
124         void OnLoadComboBoxData(std::vector<HistogramDialogComboBoxItem*>& itembitmaps,std::string filename);
125         void saveCurrentConfiguration(std::vector<HistogramDialogComboBoxItem*>& itembitmaps,std::string filename);
126         void setSlidersValue();
127
128
129         
130 };
131
132 #endif
133
134
135