]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialogComboBox.h
#2844 creaMaracasVisu Feature New Normal - ManualPaint_model box, Refresh TransferF...
[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
46 #include <wx/bmpcbox.h>
47 #include <wx/checkbox.h>
48 #include "vtkImageData.h"
49
50 #define COLORSFUNCTIONFILENAME "colorsfunction.txt"
51
52 class HistogramDialogComboBox : public wxPanel
53 {
54 public:
55         /*
56          Constructor
57         */
58         HistogramDialogComboBox(wxWindow* parent);
59         //HistogramDialogComboBox(int bar_width,int bar_height);
60         ~HistogramDialogComboBox();
61
62         void SetColors(std::vector<double> greyvect, std::vector<double> redvect, std::vector<double> greenvect, std::vector<double> bluevect);
63         wxBitmap GetBitmap();
64
65         std::vector<double> getGreyVector(){return _greyvect;}
66         std::vector<double> getRedVector(){return _redvect;}
67         std::vector<double> getGreenVector(){return _greenvect;}
68         std::vector<double> getBlueVector(){return _bluevect;}
69
70         void OnEditBitmapCombo(wxCommandEvent& event);
71         void OnBitmapComboItemSelected(wxCommandEvent& event);
72         void BitmapComboItemSelect(int value);
73
74         void OnColorLevelChanged(wxCommandEvent& event);        
75         void OnWindowLevelChanged(wxCommandEvent& event);       
76         void OnChkBoxActive(wxCommandEvent& event);
77
78         void setImageData(vtkImageData* img);
79
80         /**
81         **      Returns two vectors, the grey level of the point and its value, the value is between [0,1]
82         **/
83         void GetValuesPointsFunction(std::vector<double>& greylevel,std::vector<double>& value);
84
85         /**
86         **      Returns two vectors, the grey level of the point and its value, the red, green
87         **      and blue value is between [0,1]
88         **/
89         void GetValuesColorPointsFunction(std::vector<double>& greylevel,
90                                                                         std::vector<double>& red,
91                                                                         std::vector<double>& green,
92                                                                         std::vector<double>& blue);
93
94         double  GetWindowLevel();
95         double  GetColorLevel();
96         bool    GetActive();
97         void    InitCurrentPathColorsFuntion();
98         std::string GetFileNameOfColorsFunction();
99
100 private:
101
102         std::vector<double> _greyvect;
103         std::vector<double> _redvect;
104         std::vector<double> _greenvect;
105         std::vector<double> _bluevect;
106         std::vector<double> _greyvecttransfer;
107         std::vector<double> _value;
108         vtkImageData* _img;
109         double _maxgreyvalue;
110         int _currentitem;       
111
112         std::string _currentpathColorsFuntion;
113
114         /*
115         * Represents the color of the backGround. Default color is the parent color. 
116         */              
117
118         wxBitmapComboBox                                                        *_bitmapcombo;
119         wxCheckBox                                                                      *_ckboxActive;
120         wxSlider                                                                        *_slidercolor;
121         wxSlider                                                                        *_sliderwindowlevel;
122         std::vector<HistogramDialogComboBoxItem*>       _bitmapsitems;
123         wxBitmap                                                                        *colorBar_Bitmap;
124         wxSizer                                                                         *_bitmapsizer;
125
126         wxSizer* getBitmapCombo();
127         wxSizer* getSlidersWlCo();
128         wxBitmapComboBox* getBitmapComboElements();
129         void OnLoadComboBoxData(std::vector<HistogramDialogComboBoxItem*>& itembitmaps,std::string filename);
130         void saveCurrentConfiguration(std::vector<HistogramDialogComboBoxItem*>& itembitmaps,std::string filename);
131         void setSlidersValue();
132
133
134         
135 };
136
137 #endif
138
139
140