HistogramDialogComboBox::HistogramDialogComboBox(wxWindow* parent)
: wxPanel(parent)
{
- _img = NULL;
- _bitmapcombo=NULL;
- _slidercolor=NULL;
- _sliderwindowlevel=NULL;
- colorBar_Bitmap=NULL;
- _bitmapsizer=NULL;
+ _img = NULL;
+ _bitmapcombo = NULL;
+ _slidercolor = NULL;
+ _sliderwindowlevel = NULL;
+ colorBar_Bitmap = NULL;
+ _bitmapsizer = NULL;
this->SetSizer(getBitmapCombo());
- _img = NULL;
- _currentitem = -1;
- _maxgreyvalue=0;
+ _img = NULL;
+ _currentitem = -1;
+ _maxgreyvalue = 0;
+printf("EED HistogramDialogComboBox\n");
}
-HistogramDialogComboBox::~HistogramDialogComboBox(){
+HistogramDialogComboBox::~HistogramDialogComboBox()
+{
}
-void HistogramDialogComboBox::SetColors(std::vector<double> greyvect, std::vector<double> redvect, std::vector<double> greenvect, std::vector<double> bluevect){
-
- _greyvect=greyvect;
- _redvect=redvect;
- _greenvect=greenvect;
- _bluevect=bluevect;
-
+void HistogramDialogComboBox::SetColors(std::vector<double> greyvect, std::vector<double> redvect, std::vector<double> greenvect, std::vector<double> bluevect)
+{
+ _greyvect = greyvect;
+ _redvect = redvect;
+ _greenvect = greenvect;
+ _bluevect = bluevect;
}
-wxSizer* HistogramDialogComboBox::getBitmapCombo(){
+wxSizer* HistogramDialogComboBox::getBitmapCombo()
+{
//_bitmapsizer = new wxBoxSizer(wxVERTICAL);
_bitmapsizer = new wxBoxSizer(wxVERTICAL);
-
-
wxBoxSizer* comboeditsizer = new wxBoxSizer(wxHORIZONTAL);
-
_bitmapcombo = getBitmapComboElements();
wxBitmap bitmap1(Edit_xpm);
_bitmapsizer->Add(getSlidersWlCo(),wxSizerFlags().Expand().Center());
return _bitmapsizer;
-
}
+
wxSizer* HistogramDialogComboBox::getSlidersWlCo(){
wxBoxSizer* sizersliders = new wxBoxSizer(wxVERTICAL);
return sizersliders;
}
-double HistogramDialogComboBox::GetWindowLevel(){
- if(_sliderwindowlevel != NULL){
+double HistogramDialogComboBox::GetWindowLevel()
+{
+ if(_sliderwindowlevel != NULL)
+ {
return _sliderwindowlevel->GetValue();
}
}
-double HistogramDialogComboBox::GetColorLevel(){
- if(_slidercolor != NULL){
+double HistogramDialogComboBox::GetColorLevel()
+{
+ if(_slidercolor != NULL)
+ {
return _slidercolor->GetValue();
}
}
-void HistogramDialogComboBox::OnColorLevelChanged(wxCommandEvent& event){
+void HistogramDialogComboBox::OnColorLevelChanged(wxCommandEvent& event)
+{
_slidercolor->GetValue();
-
wxCommandEvent newevent(wxEVT_SCROLL_THUMBTRACK,this->GetId());
ProcessEvent(newevent);
-
}
-void HistogramDialogComboBox::OnWindowLevelChanged(wxCommandEvent& event){
- _sliderwindowlevel->GetValue();
+void HistogramDialogComboBox::OnWindowLevelChanged(wxCommandEvent& event)
+{
+ _sliderwindowlevel->GetValue();
wxCommandEvent newevent(wxEVT_SCROLL_THUMBTRACK,this->GetId());
ProcessEvent(newevent);
-
}
-void HistogramDialogComboBox::setImageData(vtkImageData* img){
+void HistogramDialogComboBox::setImageData(vtkImageData* img)
+{
_maxgreyvalue = img->GetScalarRange()[1];
_img = img;
-
setSlidersValue();
-
}
-void HistogramDialogComboBox::setSlidersValue(){
+void HistogramDialogComboBox::setSlidersValue()
+{
if(_img!=NULL){
if(_slidercolor!=NULL){
_slidercolor->SetRange(_img->GetScalarRange()[0],_img->GetScalarRange()[1]);
}
}
-void HistogramDialogComboBox::OnEditBitmapCombo(wxCommandEvent& event){
-
- if(_img!=NULL){
-
+void HistogramDialogComboBox::OnEditBitmapCombo(wxCommandEvent& event)
+{
+ if(_img!=NULL)
+ {
bool createaddandremovecontrols = true;
HistogramDialog* dialog = new HistogramDialog(this,_T("Color Configuration"),createaddandremovecontrols);
dialog->initializeHistogram(_img);
dialog->setInfoPanExtraControls(_bitmapsitems);
- if(dialog->ShowModal()==wxID_OK){
+ if(dialog->ShowModal()==wxID_OK)
+ {
dialog->UpdateCurrentComboElement();
_bitmapsitems = dialog->getComboBoxItems();
}
}
-void HistogramDialogComboBox::saveCurrentConfiguration(std::vector<HistogramDialogComboBoxItem*>& itembitmaps,std::string filename){
-
+void HistogramDialogComboBox::saveCurrentConfiguration(std::vector<HistogramDialogComboBoxItem*>& itembitmaps,std::string filename)
+{
std::ofstream file;
file.open( (const char*) (filename.c_str()) );
double gv=-1,red=-1,gr=-1,bl=-1;
if(file.is_open())
{
file << "<ComboBoxData>" << std::endl;
- for(int i = 0; i < itembitmaps.size();i++){
+ for(int i = 0; i < itembitmaps.size();i++)
+ {
HistogramDialogComboBoxItem* item = itembitmaps[i];
std::vector<double> vecttransfer = item->getGreyVectorTransfer();
std::vector<double> value = item->getValueVector();
file << " <ComboBoxItem>"<< std::endl;
- for(int j = 0; j < vecttransfer.size();j++){
+ for(int j = 0; j < vecttransfer.size();j++)
+ {
if(j==0){
file << " <TransferenceFunction>"<< std::endl;
}
file << "</ComboBoxData>" << std::endl;
}
file.close();
-
}
-wxBitmapComboBox* HistogramDialogComboBox::getBitmapComboElements(){
+wxBitmapComboBox* HistogramDialogComboBox::getBitmapComboElements()
+{
std::string currentpath = crea::System::GetDllAppPath("bbcreaMaracasVisu");
currentpath.append(FILENAME);
_bitmapsitems = bitmapsitems;
wxString* choices;
choices = new wxString[bitmapsitems.size()];
- for(int i = 0; i < bitmapsitems.size();i++){
+ for(int i = 0; i < bitmapsitems.size();i++)
+ {
choices[i] = _T("");
}
wxBitmapComboBox* bitmapcombo = new wxBitmapComboBox(this, -1, _T(""), wxDefaultPosition, wxDefaultSize, bitmapsitems.size(),choices);
Connect(bitmapcombo->GetId(), wxEVT_COMMAND_COMBOBOX_SELECTED, (wxObjectEventFunction)&HistogramDialogComboBox::OnBitmapComboItemSelected);
- for(int i = 0; i < bitmapsitems.size(); i++){
+ for(int i = 0; i < bitmapsitems.size(); i++)
+ {
bitmapcombo->SetItemBitmap(i, bitmapsitems[i]->GetBitmap());
}
return bitmapcombo;
}
-void HistogramDialogComboBox::OnBitmapComboItemSelected(wxCommandEvent& event){
-
- if(_bitmapcombo!=NULL){
+
+void HistogramDialogComboBox::OnBitmapComboItemSelected(wxCommandEvent& event)
+{
+ if(_bitmapcombo!=NULL)
+ {
_currentitem = event.GetInt();
- if(_bitmapsitems.size()>_currentitem){
+ if(_bitmapsitems.size()>_currentitem)
+ {
HistogramDialogComboBoxItem* currentconfig = _bitmapsitems[_currentitem];
_greyvect = currentconfig->getGreyVector();
_redvect = currentconfig->getRedVector();
_greenvect = currentconfig->getGreenVector();
_bluevect= currentconfig->getBlueVector();
-
_greyvecttransfer = currentconfig->getGreyVectorTransfer();
_value = currentconfig->getValueVector();
wxCommandEvent newevent(wxEVT_COMMAND_COMBOBOX_SELECTED,this->GetId());