2 /*# ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------ */
27 #ifndef __HistogramDialogComboBox__
28 #define __HistogramDialogComboBox__
31 // ----------------------------------------------------------------------------
32 // wx headers inclusion.
33 // For compilers that support precompilation, includes <wx/wx.h>.
34 // ----------------------------------------------------------------------------
43 #include "HistogramDialogComboBoxItem.h"
45 #include <wx/bmpcbox.h>
46 #include "vtkImageData.h"
49 #define FILENAME "/data/colorsfunction.txt"
51 #define FILENAME "colorsfunction.txt"
55 class HistogramDialogComboBox : public wxPanel
61 HistogramDialogComboBox(wxWindow* parent);
62 //HistogramDialogComboBox(int bar_width,int bar_height);
63 ~HistogramDialogComboBox();
65 void SetColors(std::vector<double> greyvect, std::vector<double> redvect, std::vector<double> greenvect, std::vector<double> bluevect);
68 std::vector<double> getGreyVector(){return _greyvect;}
69 std::vector<double> getRedVector(){return _redvect;}
70 std::vector<double> getGreenVector(){return _greenvect;}
71 std::vector<double> getBlueVector(){return _bluevect;}
73 void OnEditBitmapCombo(wxCommandEvent& event);
74 void OnBitmapComboItemSelected(wxCommandEvent& event);
76 void OnColorLevelChanged(wxCommandEvent& event);
77 void OnWindowLevelChanged(wxCommandEvent& event);
79 void setImageData(vtkImageData* img);
82 ** Returns two vectors, the grey level of the point and its value, the value is between [0,1]
84 void GetValuesPointsFunction(std::vector<double>& greylevel,std::vector<double>& value);
87 ** Returns two vectors, the grey level of the point and its value, the red, green
88 ** and blue value is between [0,1]
90 void GetValuesColorPointsFunction(std::vector<double>& greylevel,
91 std::vector<double>& red,
92 std::vector<double>& green,
93 std::vector<double>& blue);
95 double GetWindowLevel();
96 double GetColorLevel();
100 std::vector<double> _greyvect;
101 std::vector<double> _redvect;
102 std::vector<double> _greenvect;
103 std::vector<double> _bluevect;
104 std::vector<double> _greyvecttransfer;
105 std::vector<double> _value;
107 double _maxgreyvalue;
111 * Represents the color of the backGround. Default color is the parent color.
114 wxBitmapComboBox* _bitmapcombo;
115 wxSlider* _slidercolor;
116 wxSlider* _sliderwindowlevel;
117 std::vector<HistogramDialogComboBoxItem*> _bitmapsitems;
118 wxBitmap* colorBar_Bitmap;
119 wxSizer* _bitmapsizer;
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();