00001 00002 #ifndef __HistogramDialogComboBox__ 00003 #define __HistogramDialogComboBox__ 00004 00005 00006 // ---------------------------------------------------------------------------- 00007 // wx headers inclusion. 00008 // For compilers that support precompilation, includes <wx/wx.h>. 00009 // ---------------------------------------------------------------------------- 00010 00011 #ifdef __BORLANDC__ 00012 #pragma hdrstop 00013 #endif 00014 00015 #include <wx/wx.h> 00016 #include <vector> 00017 00018 #include "HistogramDialogComboBoxItem.h" 00019 #include <fstream> 00020 #include <wx/bmpcbox.h> 00021 #include "vtkImageData.h" 00022 00023 #ifdef WIN32 00024 #define FILENAME "/data/colorsfunction.txt" 00025 #else 00026 #define FILENAME "colorsfunction.txt" 00027 #endif 00028 00029 00030 class HistogramDialogComboBox : public wxPanel 00031 { 00032 public: 00033 /* 00034 Constructor 00035 */ 00036 HistogramDialogComboBox(wxWindow* parent); 00037 //HistogramDialogComboBox(int bar_width,int bar_height); 00038 ~HistogramDialogComboBox(); 00039 00040 void SetColors(std::vector<double> greyvect, std::vector<double> redvect, std::vector<double> greenvect, std::vector<double> bluevect); 00041 wxBitmap GetBitmap(); 00042 00043 std::vector<double> getGreyVector(){return _greyvect;} 00044 std::vector<double> getRedVector(){return _redvect;} 00045 std::vector<double> getGreenVector(){return _greenvect;} 00046 std::vector<double> getBlueVector(){return _bluevect;} 00047 00048 void OnEditBitmapCombo(wxCommandEvent& event); 00049 void OnBitmapComboItemSelected(wxCommandEvent& event); 00050 00051 void OnColorLevelChanged(wxCommandEvent& event); 00052 void OnWindowLevelChanged(wxCommandEvent& event); 00053 00054 void setImageData(vtkImageData* img); 00055 00059 void GetValuesPointsFunction(std::vector<double>& greylevel,std::vector<double>& value); 00060 00065 void GetValuesColorPointsFunction(std::vector<double>& greylevel, 00066 std::vector<double>& red, 00067 std::vector<double>& green, 00068 std::vector<double>& blue); 00069 00070 double GetWindowLevel(); 00071 double GetColorLevel(); 00072 00073 private: 00074 00075 std::vector<double> _greyvect; 00076 std::vector<double> _redvect; 00077 std::vector<double> _greenvect; 00078 std::vector<double> _bluevect; 00079 std::vector<double> _greyvecttransfer; 00080 std::vector<double> _value; 00081 vtkImageData* _img; 00082 double _maxgreyvalue; 00083 int _currentitem; 00084 00085 /* 00086 * Represents the color of the backGround. Default color is the parent color. 00087 */ 00088 00089 wxBitmapComboBox* _bitmapcombo; 00090 wxSlider* _slidercolor; 00091 wxSlider* _sliderwindowlevel; 00092 std::vector<HistogramDialogComboBoxItem*> _bitmapsitems; 00093 wxBitmap* colorBar_Bitmap; 00094 wxSizer* _bitmapsizer; 00095 00096 wxSizer* getBitmapCombo(); 00097 wxSizer* getSlidersWlCo(); 00098 wxBitmapComboBox* getBitmapComboElements(); 00099 void OnLoadComboBoxData(std::vector<HistogramDialogComboBoxItem*>& itembitmaps,std::string filename); 00100 void saveCurrentConfiguration(std::vector<HistogramDialogComboBoxItem*>& itembitmaps,std::string filename); 00101 void setSlidersValue(); 00102 00103 00104 00105 }; 00106 00107 #endif 00108 00109 00110