#include <HistogramDialog.h>
Public Member Functions | |
HistogramDialog (wxWindow *parent, wxString title, vtkImageData *imageData, bool extracontrols=false) | |
HistogramDialog (wxWindow *parent, wxString title, bool extracontrols=false) | |
~HistogramDialog () | |
int | getSizeTransferenceFunction () |
int | getSizeBarColor () |
void | getTransferenceFunctionPoint (int index, int &x, int &y) |
void | getDataBarColorPoint (int index, int &x, int &red, int &green, int &blue) |
int | getHistogramPoint (int gValue) |
float | getMaxShowedPorcentage () |
float | getMinShowedPorcentage () |
float | getActualShowedPorcentage () |
bool | addPointToTransferenceFunction (double x, double y) |
bool | addColorPoint (double x, int red, int green, int blue) |
void | erasePointsTransferenceFunction () |
void | eraseColorPoints () |
void | setTransferenceFunctionHasPoints (bool hasPoints) |
void | setTransferenceFunctionHasColor (bool hasColorPoints) |
bool | getRefreshed () |
void | setCTF (vtkColorTransferFunction *cf) |
void | setTF (vtkPiecewiseFunction *tf) |
void | setVolumeMapper (vtkVolumeRayCastMapper *volMapper) |
void | setVolume (vtkVolume *vol) |
void | updatePlotter () |
void | OnSaveData (wxCommandEvent &event) |
void | OnLoadData (wxCommandEvent &event) |
void | OnRefreshBtn (wxCommandEvent &event) |
void | initializeHistogram (vtkImageData *img) |
void | GetValuesPointsFunction (std::vector< double > &greylevel, std::vector< double > &value) |
void | GetValuesColorPointsFunction (std::vector< double > &greylevel, std::vector< double > &red, std::vector< double > &green, std::vector< double > &blue) |
void | SetFunctions (vtkPiecewiseFunction *_opac, vtkColorTransferFunction *_color) |
void | setInfoPanExtraControls (std::vector< HistogramDialogComboBoxItem * > comboitems) |
void | OnEditColorsCombo (wxCommandEvent &event) |
void | OnDeleteColor (wxCommandEvent &event) |
std::vector < HistogramDialogComboBoxItem * > | getComboBoxItems () |
void | UpdateCurrentComboElement () |
Private Member Functions | |
wxSizer * | getControls (bool extracontrols=false) |
void | initializeHistogramDialog (bool extracontrols) |
wxPanel * | getPanExtraControls () |
void | setCurrentColorConfigurationIntoButton () |
void | AddNewBitmapButton () |
wxSizer * | getBitmapButtonDelete (wxBitmap bitmap) |
Private Attributes | |
HistogramWidget * | histogramW |
wxBitmapButton * | okBtn |
wxBitmapButton * | cancelBtn |
wxButton * | saveDataBtn |
wxButton * | loadDataBtn |
wxButton * | refreshBtn |
wxPanel * | _panextracontrols |
bool | refreshed |
vtkColorTransferFunction * | _ctfun |
vtkPiecewiseFunction * | _tfun |
vtkVolumeRayCastMapper * | volumeMapper |
vtkVolume * | newvol |
std::vector< wxBitmapButton * > | bitmapbuttonsvect |
std::vector < HistogramDialogComboBoxItem * > | _comboitems |
std::vector< wxBitmapButton * > | _deletebuttonsvector |
int | _maxgreyvalue |
int | _currentcolorselectedbitmap |
Definition at line 34 of file HistogramDialog.h.
HistogramDialog::HistogramDialog | ( | wxWindow * | parent, | |
wxString | title, | |||
vtkImageData * | imageData, | |||
bool | extracontrols = false | |||
) |
Definition at line 27 of file HistogramDialog.cxx.
References initializeHistogram(), and initializeHistogramDialog().
00028 :wxDialog(parent,-1,title,wxDefaultPosition,wxDefaultSize,wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE ,_T("dialogBox")) 00029 { 00030 00031 initializeHistogramDialog(extracontrols); 00032 initializeHistogram(imageData); 00033 00034 }
HistogramDialog::HistogramDialog | ( | wxWindow * | parent, | |
wxString | title, | |||
bool | extracontrols = false | |||
) |
Definition at line 36 of file HistogramDialog.cxx.
References initializeHistogramDialog().
00037 :wxDialog(parent,-1,title,wxDefaultPosition,wxDefaultSize,wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE ,_T("dialogBox")){ 00038 00039 initializeHistogramDialog(extracontrols); 00040 }
HistogramDialog::~HistogramDialog | ( | ) |
Definition at line 41 of file HistogramDialog.cxx.
bool HistogramDialog::addColorPoint | ( | double | x, | |
int | red, | |||
int | green, | |||
int | blue | |||
) |
Definition at line 661 of file HistogramDialog.cxx.
References HistogramWidget::addColorPoint(), and histogramW.
Referenced by wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions(), wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(), OnEditColorsCombo(), and wxVtkMPR3DViewCntrlPanel::OnEditColorTable().
00662 { 00663 return histogramW->addColorPoint(x,red,green,blue); 00664 }
void HistogramDialog::AddNewBitmapButton | ( | ) | [private] |
Definition at line 249 of file HistogramDialog.cxx.
References _comboitems, _currentcolorselectedbitmap, _panextracontrols, eraseColorPoints(), erasePointsTransferenceFunction(), HistogramDialogComboBoxItem::GetBitmap(), and getBitmapButtonDelete().
Referenced by OnEditColorsCombo().
00249 { 00250 this->eraseColorPoints(); 00251 this->erasePointsTransferenceFunction(); 00252 HistogramDialogComboBoxItem* boxitem = new HistogramDialogComboBoxItem(); 00253 wxBitmap bitmap = boxitem->GetBitmap(); 00254 wxSizer* sizer = getBitmapButtonDelete(bitmap); 00255 _panextracontrols->GetSizer()->Insert(_comboitems.size()*2,sizer,wxSizerFlags().Center()); 00256 _panextracontrols->GetSizer()->InsertSpacer(_comboitems.size()*2+1,5); 00257 _comboitems.push_back(boxitem); 00258 _currentcolorselectedbitmap = _comboitems.size()-1; 00259 }
bool HistogramDialog::addPointToTransferenceFunction | ( | double | x, | |
double | y | |||
) |
Definition at line 657 of file HistogramDialog.cxx.
References HistogramWidget::addPointToTransferenceFunction(), and histogramW.
Referenced by wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions(), wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(), and OnEditColorsCombo().
00658 { 00659 return histogramW->addPointToTransferenceFunction(x,y); 00660 }
void HistogramDialog::eraseColorPoints | ( | ) |
Definition at line 679 of file HistogramDialog.cxx.
References HistogramWidget::eraseColorPoints(), and histogramW.
Referenced by AddNewBitmapButton(), OnEditColorsCombo(), and OnLoadData().
00680 { 00681 histogramW->eraseColorPoints(); 00682 }
void HistogramDialog::erasePointsTransferenceFunction | ( | ) |
Definition at line 672 of file HistogramDialog.cxx.
References HistogramWidget::erasePointsTransferenceFunction(), and histogramW.
Referenced by AddNewBitmapButton(), wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions(), wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(), OnEditColorsCombo(), wxVtkMPR3DViewCntrlPanel::OnEditColorTable(), and OnLoadData().
00673 { 00674 histogramW->erasePointsTransferenceFunction(); 00675 }
float HistogramDialog::getActualShowedPorcentage | ( | ) |
Definition at line 649 of file HistogramDialog.cxx.
References HistogramWidget::getActualShowedPorcentage(), and histogramW.
00650 { 00651 return histogramW->getActualShowedPorcentage(); 00652 }
wxSizer * HistogramDialog::getBitmapButtonDelete | ( | wxBitmap | bitmap | ) | [private] |
Definition at line 152 of file HistogramDialog.cxx.
References _deletebuttonsvector, _panextracontrols, bitmapbuttonsvect, OnDeleteColor(), and OnEditColorsCombo().
Referenced by AddNewBitmapButton(), and setInfoPanExtraControls().
00152 { 00153 //wxCheckBox* checkbox = new wxCheckBox(_panextracontrols,wxID_ANY,_T("")); 00154 wxBitmap bitmap0(Delete_xpm); 00155 wxBitmapButton* deletebutton = new wxBitmapButton(_panextracontrols,wxID_ANY,bitmap0,wxDefaultPosition,wxSize(20,20)); 00156 deletebutton->SetToolTip(wxString("Delete the color from the list",wxConvUTF8)); 00157 Connect(deletebutton->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&HistogramDialog::OnDeleteColor); 00158 _deletebuttonsvector.push_back(deletebutton); 00159 00160 //wxBitmap bitmap0(OpenImage_xpm); 00161 wxBitmapButton* button = new wxBitmapButton(_panextracontrols,wxID_ANY,bitmap,wxDefaultPosition,wxSize(30,30)); 00162 button->SetToolTip(wxString("Load the current color configuration.",wxConvUTF8)); 00163 bitmapbuttonsvect.push_back(button); 00164 Connect(button->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&HistogramDialog::OnEditColorsCombo); 00165 /*char c[10]; 00166 wxString s; 00167 s.Printf(_T("%d"),i);*/ 00168 00169 //button->SetBitmapLabel(comboitems[i]->GetBitmap()); 00170 // wxStaticBitmap* button = new wxStaticBitmap(_panextracontrols,i,comboitems[i]->GetBitmap(),wxDefaultPosition,wxSize(30,30)); 00171 wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL); 00172 sizer->Add(button,wxSizerFlags().Center()); 00173 sizer->AddSpacer(5); 00174 sizer->Add(deletebutton,wxSizerFlags().Center()); 00175 return sizer; 00176 }
std::vector<HistogramDialogComboBoxItem*> HistogramDialog::getComboBoxItems | ( | ) | [inline] |
Definition at line 169 of file HistogramDialog.h.
References _comboitems.
Referenced by HistogramDialogComboBox::OnEditBitmapCombo().
00169 {return _comboitems;}
wxSizer * HistogramDialog::getControls | ( | bool | extracontrols = false |
) | [private] |
Definition at line 301 of file HistogramDialog.cxx.
References getPanExtraControls(), OnLoadData(), and OnSaveData().
Referenced by initializeHistogramDialog().
00301 { 00302 00303 wxSizer* sizer = new wxBoxSizer(wxVERTICAL); 00304 00305 wxBitmap bitmap0(OpenImage_xpm); 00306 wxBitmapButton* opendata = new wxBitmapButton(this, -1, bitmap0,wxDefaultPosition,wxSize(30,30)); 00307 Connect(opendata->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&HistogramDialog::OnLoadData); 00308 sizer->Add(opendata,wxSizerFlags().Center()); 00309 sizer->AddSpacer(5); 00310 00311 00312 00313 wxBitmap bitmap1(Save_xpm); 00314 wxBitmapButton* savedata = new wxBitmapButton(this, -1, bitmap1,wxDefaultPosition,wxSize(30,30)); 00315 Connect(savedata->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&HistogramDialog::OnSaveData); 00316 sizer->Add(savedata,wxSizerFlags().Center()); 00317 sizer->AddSpacer(5); 00318 00319 if(extracontrols){ 00320 sizer->Add(getPanExtraControls(),wxSizerFlags().Center()); 00321 } 00322 //sizer->Add(getBitmapCombo(),wxSizerFlags().Center()); 00323 00324 00325 00326 return sizer; 00327 00328 00329 }
void HistogramDialog::getDataBarColorPoint | ( | int | index, | |
int & | x, | |||
int & | red, | |||
int & | green, | |||
int & | blue | |||
) |
Definition at line 621 of file HistogramDialog.cxx.
References HistogramWidget::getDataBarColorPoint(), and histogramW.
Referenced by wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions(), wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(), wxVtkMPR3DViewCntrlPanel::OnEditColorTable(), and OnRefreshBtn().
00622 { 00623 histogramW->getDataBarColorPoint(index,x,red,green,blue); 00624 }
int HistogramDialog::getHistogramPoint | ( | int | gValue | ) |
Definition at line 629 of file HistogramDialog.cxx.
References HistogramWidget::getHistogramPoint(), and histogramW.
00630 { 00631 return histogramW->getHistogramPoint(gValue); 00632 }
float HistogramDialog::getMaxShowedPorcentage | ( | ) |
Definition at line 641 of file HistogramDialog.cxx.
References HistogramWidget::getMaxShowedPorcentage(), and histogramW.
00642 { 00643 return histogramW->getMaxShowedPorcentage(); 00644 }
float HistogramDialog::getMinShowedPorcentage | ( | ) |
Definition at line 645 of file HistogramDialog.cxx.
References HistogramWidget::getMinShowedPorcentage(), and histogramW.
00646 { 00647 return histogramW->getMinShowedPorcentage(); 00648 }
wxPanel * HistogramDialog::getPanExtraControls | ( | ) | [private] |
Definition at line 113 of file HistogramDialog.cxx.
References _panextracontrols.
Referenced by getControls().
00113 { 00114 wxBoxSizer* sizer0 = new wxBoxSizer(wxVERTICAL); 00115 _panextracontrols = new wxPanel(this); 00116 00117 _panextracontrols->SetSizer(sizer0); 00118 _panextracontrols->SetAutoLayout(true); 00119 00120 return _panextracontrols; 00121 }
bool HistogramDialog::getRefreshed | ( | ) |
Definition at line 698 of file HistogramDialog.cxx.
References refreshed.
Referenced by wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions(), wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(), and wxVtkMPR3DViewCntrlPanel::OnEditColorTable().
00699 { 00700 return refreshed; 00701 }
int HistogramDialog::getSizeBarColor | ( | ) |
Definition at line 607 of file HistogramDialog.cxx.
References HistogramWidget::getSizeBarColor(), and histogramW.
Referenced by wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions(), wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(), wxVtkMPR3DViewCntrlPanel::OnEditColorTable(), and OnRefreshBtn().
00608 { 00609 return histogramW->getSizeBarColor(); 00610 }
int HistogramDialog::getSizeTransferenceFunction | ( | ) |
Definition at line 599 of file HistogramDialog.cxx.
References HistogramWidget::getSizeTransferenceFunction(), and histogramW.
Referenced by wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions(), wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(), and OnRefreshBtn().
00600 { 00601 return histogramW->getSizeTransferenceFunction(); 00602 00603 }
void HistogramDialog::getTransferenceFunctionPoint | ( | int | index, | |
int & | x, | |||
int & | y | |||
) |
Definition at line 614 of file HistogramDialog.cxx.
References HistogramWidget::getTransferenceFunctionPoint(), and histogramW.
Referenced by wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions(), wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(), and OnRefreshBtn().
00615 { 00616 histogramW->getTransferenceFunctionPoint(index,x,y); 00617 }
void HistogramDialog::GetValuesColorPointsFunction | ( | std::vector< double > & | greylevel, | |
std::vector< double > & | red, | |||
std::vector< double > & | green, | |||
std::vector< double > & | blue | |||
) |
Returns two vectors, the grey level of the point and its value, the red, green and blue value is between [0,1]
Definition at line 758 of file HistogramDialog.cxx.
References HistogramWidget::GetValuesColorPointsFunction(), and histogramW.
Referenced by setCurrentColorConfigurationIntoButton().
00762 { 00763 histogramW->GetValuesColorPointsFunction(greylevel, red, green, blue); 00764 }
void HistogramDialog::GetValuesPointsFunction | ( | std::vector< double > & | greylevel, | |
std::vector< double > & | value | |||
) |
Returns two vectors, the grey level of the point and its value, the value is between [0,1]
Definition at line 749 of file HistogramDialog.cxx.
References HistogramWidget::GetValuesPointsFunction(), and histogramW.
Referenced by setCurrentColorConfigurationIntoButton().
00749 { 00750 00751 histogramW->GetValuesPointsFunction(greylevel, value); 00752 }
void HistogramDialog::initializeHistogram | ( | vtkImageData * | img | ) |
Initialize the histogram
Definition at line 742 of file HistogramDialog.cxx.
References _maxgreyvalue, histogramW, and HistogramWidget::initializeHistogram().
Referenced by HistogramDialog(), HistogramDialogComboBox::OnEditBitmapCombo(), and CutModelMainPanel::ShowStatistics().
00742 { 00743 _maxgreyvalue = img->GetScalarRange()[1]; 00744 histogramW->initializeHistogram(img); 00745 }
void HistogramDialog::initializeHistogramDialog | ( | bool | extracontrols | ) | [private] |
Definition at line 45 of file HistogramDialog.cxx.
References _ctfun, _currentcolorselectedbitmap, _maxgreyvalue, _panextracontrols, _tfun, cancelBtn, getControls(), histogramW, and okBtn.
Referenced by HistogramDialog().
00045 { 00046 _currentcolorselectedbitmap = -1; 00047 _ctfun=NULL; 00048 _tfun=NULL; 00049 _panextracontrols=NULL; 00050 _maxgreyvalue = 1; 00051 00052 SetBackgroundColour(wxColour(255,255,255)); 00053 /* 00054 Pointers 00055 */ 00056 //wxvtkmpr3Dview=NULL; 00057 //wxvtkclipping3Dview=NULL; 00058 00059 /* 00060 Histogram 00061 */ 00062 00063 histogramW=new HistogramWidget(this, -1); 00064 00065 /* 00066 Buttons 00067 */ 00068 wxBitmap bitmap0(Ok_xpm); 00069 okBtn = new wxBitmapButton(this, wxID_OK, bitmap0,wxDefaultPosition,wxDefaultSize); 00070 00071 wxBitmap bitmap1(Cancel_xpm); 00072 cancelBtn = new wxBitmapButton(this, wxID_CANCEL, bitmap1,wxDefaultPosition,wxDefaultSize); 00073 00074 //saveDataBtn = new wxButton(this,ID_SAVE,_T("Save")); 00075 //loadDataBtn = new wxButton(this,ID_LOAD,_T("Load")); 00076 //refreshBtn = new wxButton(this,ID_REFRESH,_T("Refresh")); 00077 00078 //Connect(saveDataBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &HistogramDialog::OnSaveData ); 00079 //Connect(loadDataBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &HistogramDialog::OnLoadData ); 00080 //Connect(refreshBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &HistogramDialog::OnRefreshBtn ); 00081 00082 //------------------- 00083 //GUI 00084 //------------------- 00085 00086 //Upper Box 00087 wxBoxSizer * upper_box = new wxBoxSizer( wxHORIZONTAL ); 00088 //Including components for plotter control 00089 00090 upper_box->Add( histogramW, 4, wxGROW); 00091 upper_box->Add( getControls(extracontrols),wxSizerFlags().Center() ); 00092 00093 //bottom Sizer 00094 wxBoxSizer *bottomBox = new wxBoxSizer( wxHORIZONTAL ); 00095 bottomBox->Add( okBtn, wxSizerFlags().Center()); 00096 bottomBox->AddSpacer(40); 00097 //bottomBox->Add( saveDataBtn,wxSizerFlags().Center() ); 00098 //bottomBox->AddSpacer(40); 00099 //bottomBox->Add( loadDataBtn,wxSizerFlags().Center() ); 00100 //bottomBox->AddSpacer(40); 00101 //bottomBox->Add( refreshBtn,wxSizerFlags().Center() ); 00102 //bottomBox->AddSpacer(40); 00103 bottomBox->Add( cancelBtn,wxSizerFlags().Center() ); 00104 00105 //Sizer 00106 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); 00107 sizer->Add(upper_box,1,wxEXPAND); 00108 sizer->Add(bottomBox,0,wxCENTER); 00109 SetAutoLayout( TRUE ); 00110 SetSizer( sizer ); 00111 SetBestSize(wxSize(600,600)); 00112 }
void HistogramDialog::OnDeleteColor | ( | wxCommandEvent & | event | ) |
Definition at line 177 of file HistogramDialog.cxx.
References _comboitems, _currentcolorselectedbitmap, _deletebuttonsvector, _panextracontrols, and bitmapbuttonsvect.
Referenced by getBitmapButtonDelete().
00177 { 00178 for(int i = 0; i < _deletebuttonsvector.size();i++){ 00179 if(event.GetId()==_deletebuttonsvector[i]->GetId()){ 00180 _currentcolorselectedbitmap = -1; 00181 //this->eraseColorPoints(); 00182 //this->erasePointsTransferenceFunction(); 00183 HistogramDialogComboBoxItem* temp; 00184 temp = _comboitems[i]; 00185 _deletebuttonsvector[i]->Hide(); 00186 bitmapbuttonsvect[i]->Hide(); 00187 delete temp; 00188 //Remove buttons 00189 _panextracontrols->GetSizer()->Remove(i*2); 00190 //Remove Space 00191 _panextracontrols->GetSizer()->Remove(i*2); 00192 for(int k = i; k < _comboitems.size()-1;k++){ 00193 _comboitems[k] = _comboitems[k+1]; 00194 _deletebuttonsvector[k] = _deletebuttonsvector[k+1]; 00195 bitmapbuttonsvect[k] = bitmapbuttonsvect[k+1]; 00196 } 00197 _comboitems.pop_back(); 00198 _deletebuttonsvector.pop_back(); 00199 bitmapbuttonsvect.pop_back(); 00200 } 00201 } 00202 _panextracontrols->Layout(); 00203 }
void HistogramDialog::OnEditColorsCombo | ( | wxCommandEvent & | event | ) |
Definition at line 204 of file HistogramDialog.cxx.
References _comboitems, _currentcolorselectedbitmap, _maxgreyvalue, _panextracontrols, addColorPoint(), AddNewBitmapButton(), addPointToTransferenceFunction(), bitmapbuttonsvect, eraseColorPoints(), erasePointsTransferenceFunction(), HistogramDialogComboBoxItem::getBlueVector(), HistogramDialogComboBoxItem::getGreenVector(), HistogramDialogComboBoxItem::getGreyVector(), HistogramDialogComboBoxItem::getGreyVectorTransfer(), HistogramDialogComboBoxItem::getRedVector(), HistogramDialogComboBoxItem::getValueVector(), and UpdateCurrentComboElement().
Referenced by getBitmapButtonDelete(), and setInfoPanExtraControls().
00204 { 00205 bool loadconfig = false; 00206 UpdateCurrentComboElement(); 00207 for(int i = 0; i < bitmapbuttonsvect.size();i++){ 00208 if(event.GetId()==bitmapbuttonsvect[i]->GetId()){ 00209 if(i<_comboitems.size()){ 00210 _currentcolorselectedbitmap = i; 00211 loadconfig = true; 00212 HistogramDialogComboBoxItem* currentconfig = _comboitems[i]; 00213 std::vector<double> greyvect = currentconfig->getGreyVector(); 00214 std::vector<double> _redvect = currentconfig->getRedVector(); 00215 std::vector<double> _greenvect = currentconfig->getGreenVector(); 00216 std::vector<double> _bluevect= currentconfig->getBlueVector(); 00217 this->eraseColorPoints(); 00218 this->erasePointsTransferenceFunction(); 00219 for(int i = 0; i < currentconfig->getGreyVector().size();i++){ 00220 double greyv = currentconfig->getGreyVector()[i]; 00221 double red = currentconfig->getRedVector()[i]; 00222 double green = currentconfig->getGreenVector()[i]; 00223 double blue = currentconfig->getBlueVector()[i]; 00224 00225 this->addColorPoint(greyv*_maxgreyvalue, red*255.0, green*255.0, blue*255.0); 00226 } 00227 for(int i = 0; i < currentconfig->getGreyVectorTransfer().size();i++){ 00228 double greyv = currentconfig->getGreyVectorTransfer()[i]; 00229 double value = currentconfig->getValueVector()[i]; 00230 std::cout<<"void HistogramDialog::OnEditColorsCombo(wxCommandEvent& event){"<<greyv<<" "<<value<<std::endl; 00231 this->addPointToTransferenceFunction(greyv*_maxgreyvalue, value*100); 00232 } 00233 } 00234 } 00235 } 00236 if(!loadconfig){ 00237 AddNewBitmapButton(); 00238 } 00239 00240 _panextracontrols->Layout(); 00241 this->Layout(); 00242 this->Refresh(); 00243 }
void HistogramDialog::OnLoadData | ( | wxCommandEvent & | event | ) |
Definition at line 401 of file HistogramDialog.cxx.
References HistogramWidget::addColorPoint(), HistogramWidget::addPointToTransferenceFunction(), eraseColorPoints(), erasePointsTransferenceFunction(), histogramW, and HistogramWidget::updatePlotter().
Referenced by getControls().
00402 { 00403 wxString nameF=wxFileSelector(_T("Load Data") ); 00404 //std::string line; 00405 std::ifstream file; 00406 if(nameF.CompareTo( _T("/0") )>0) 00407 file.open( (const char*) (nameF.mb_str()) ); 00408 00409 bool histogramReading=false,/*histogramPoints=false,histogramPoint=false,*/tf=false,ctf=false,tfp=false,ctfp=false; // JPRx 00410 int gv=-1,in=-1,red=-1,gr=-1,bl=-1/*,nPoints=-1*/; // JPRx 00411 if(file.is_open()) 00412 { 00413 //------------- 00414 erasePointsTransferenceFunction(); 00415 eraseColorPoints(); 00416 //-------------- 00417 00418 //std::getline(file,line); 00419 //int i=0; // JPRx 00420 while(!file.eof()) 00421 { 00422 std::string line; 00423 std::getline(file,line); 00424 //int a=line.find("histogram Data"); 00425 if( (int)(line.find("histogram Data"))!=-1) 00426 { 00427 histogramReading=true; 00428 00429 } 00430 /* 00431 else if(line.find("histogramPoints")!=0 && histogramReading) 00432 { 00433 histogramPoints=true; 00434 } 00435 else if(line.find("histogramPoint")!=0 && histogramReading && histogramPoints) 00436 { 00437 00438 } 00439 else if(line.find("greyValue")!=0 && histogramReading && histogramPoints) 00440 { 00441 int pos1=line.find(">"); 00442 int pos2=line.find("<",pos+1); 00443 std::string x=line.substr(pos1+1,pos2-1); 00444 gv=atoi(x.c_str()); 00445 } 00446 else if(line.find("number")!=0 && histogramReading && histogramPoints) 00447 { 00448 int pos1=line.find(">"); 00449 int pos2=line.find("<",pos+1); 00450 std::string x=line.substr(pos1+1,pos2-1); 00451 nP=atoi(x.c_str()); 00452 //add to the histogram 00453 //histogramW->addPointToTransferenceFunction(gc,in); 00454 } 00455 */ 00456 else if( (int)(line.find("TransferenceFunction"))!=-1 && histogramReading) 00457 { 00458 tf=true; 00459 } 00460 else if( (int)(line.find("<Transferencepoint>"))!=-1 && histogramReading && tf) 00461 { 00462 tfp=true; 00463 } 00464 else if( (int)(line.find("greyValue"))!=-1 && histogramReading && tf && tfp) 00465 { 00466 int pos1=line.find(">"); 00467 int pos2=line.find("<",pos1+1); 00468 std::string x=line.substr(pos1+1,pos2-pos1-1); 00469 gv=atoi(x.c_str()); 00470 00471 } 00472 else if( (int)(line.find("intensity"))!=-1 && histogramReading && tf && tfp) 00473 { 00474 int pos1=line.find(">"); 00475 int pos2=line.find("<",pos1+1); 00476 std::string x=line.substr(pos1+1,pos2-pos1-1); 00477 in=atoi(x.c_str()); 00478 histogramW->addPointToTransferenceFunction(gv,in); 00479 tfp=false; 00480 00481 } 00482 else if( (int)(line.find("Colors"))!=-1 && histogramReading) 00483 { 00484 ctf=true; 00485 } 00486 00487 else if( (int)(line.find("greyValueRGBpoint"))!=-1 && histogramReading && ctf ) 00488 { 00489 ctfp=true; 00490 00491 } 00492 else if( (int)(line.find("RGBgreyValue"))!=-1 && histogramReading && ctf && ctfp) 00493 { 00494 int pos1=line.find(">"); 00495 int pos2=line.find("<",pos1+1); 00496 std::string x=line.substr(pos1+1,pos2-pos1-1); 00497 gv=atoi(x.c_str()); 00498 00499 } 00500 else if( (int)(line.find("red"))!=-1 && histogramReading && ctf && ctfp) 00501 { 00502 int pos1=line.find(">"); 00503 int pos2=line.find("<",pos1+1); 00504 std::string x=line.substr(pos1+1,pos2-pos1-1); 00505 red=atoi(x.c_str()); 00506 00507 } 00508 else if( (int)(line.find("green"))!=-1 && histogramReading && ctf && ctfp) 00509 { 00510 int pos1=line.find(">"); 00511 int pos2=line.find("<",pos1+1); 00512 std::string x=line.substr(pos1+1,pos2-pos1-1); 00513 gr=atoi(x.c_str()); 00514 } 00515 else if( (int)(line.find("blue"))!=-1 && histogramReading && ctf && ctfp) 00516 { 00517 int pos1=line.find(">"); 00518 int pos2=line.find("<",pos1+1); 00519 std::string x=line.substr(pos1+1,pos2-pos1-1); 00520 bl=atoi(x.c_str()); 00521 histogramW->addColorPoint(gv,red,gr,bl); 00522 ctfp=false; 00523 } 00524 line.clear(); 00525 } 00526 } 00527 00528 file.close(); 00529 histogramW->updatePlotter(); 00530 }
void HistogramDialog::OnRefreshBtn | ( | wxCommandEvent & | event | ) |
Definition at line 535 of file HistogramDialog.cxx.
References _ctfun, _tfun, getDataBarColorPoint(), getSizeBarColor(), getSizeTransferenceFunction(), getTransferenceFunctionPoint(), and refreshed.
00536 { 00537 refreshed=true; 00538 00539 int i=0,xi,yi,r,g,b; 00540 00541 // -- TransferenceFunction -- 00542 int nPointsTF=getSizeTransferenceFunction(); 00543 00544 if(nPointsTF>0) 00545 { 00546 00547 int nTFPoints=getSizeTransferenceFunction(); 00548 i=0; 00549 while(i<nTFPoints) 00550 { 00551 getTransferenceFunctionPoint(i,xi,yi); 00552 _tfun->AddPoint( xi , yi/100.0 ); 00553 i++; 00554 } 00555 } 00556 //-- Color bar -- 00557 //clean colors 00558 int nPointsCTF=getSizeBarColor(); 00559 if(nPointsCTF>0) 00560 { 00561 _ctfun->RemoveAllPoints(); 00562 00563 int nCTFpoints=getSizeBarColor(); 00564 i=0; 00565 while(i<nCTFpoints) 00566 { 00567 getDataBarColorPoint(i,xi,r,g,b); 00568 _ctfun->AddRGBPoint(xi,r/255.0,g/255.0,b/255.0 ); 00569 i++; 00570 } 00571 } 00572 00573 //EED Borrame 00574 00575 /* 00576 NOTE I NEED THE UPDATE 00577 */ 00578 //if it was call from the clipping ctnrl panel 00579 //if(wxvtkclipping3Dview!=NULL) 00580 //{ 00581 // wxvtkclipping3Dview->Refresh(); 00582 00583 //} 00584 //else if(wxvtkmpr3Dview!=NULL) 00585 //{ 00586 // wxvtkmpr3Dview->Refresh(); 00587 00588 //} 00589 }
void HistogramDialog::OnSaveData | ( | wxCommandEvent & | event | ) |
Definition at line 335 of file HistogramDialog.cxx.
References HistogramWidget::getDataBarColorPoint(), HistogramWidget::getSizeBarColor(), HistogramWidget::getSizeTransferenceFunction(), HistogramWidget::getTransferenceFunctionPoint(), and histogramW.
Referenced by getControls().
00336 { 00337 wxString nameF=wxFileSelector(_T("Save Data"), _T(" "),_T(""),_T(""),_T("*.*"),wxSAVE, NULL, -1, -1);//wxFileSelector(_T("Save Data"),wxSAVE); 00338 std::ofstream file; 00339 if(nameF.CompareTo( _T("/0") )>0) 00340 file.open( (const char*)(nameF.mb_str()) ); 00341 00342 if(file.is_open()) 00343 { 00344 file << "<histogram Data>" << std::endl; 00345 //histograms points 00346 /* 00347 file << " <histogramPoints>" << std::endl; 00348 int histogramS=histogramW->getHistogramSize(); 00349 int i=0; 00350 while(i<histogramS) 00351 { 00352 file << " <HistogramPoint>" << std::endl; 00353 file << " <greyValue>" << i << "</greyValue>" <<std::endl; 00354 file << " <number>" << histogramW->getHistogramPoint(i) << "</number>"<<std::endl; 00355 file << " </HistogramPoint>" << std::endl; 00356 i++; 00357 } 00358 file << " </histogramPoints>" << std::endl; 00359 */ 00360 //points transference Function 00361 file << " <TransferenceFunction>"<< std::endl; 00362 int tfPointS=histogramW->getSizeTransferenceFunction(); 00363 int i=0; 00364 int gv,in; 00365 while(i<tfPointS) 00366 { 00367 00368 histogramW->getTransferenceFunctionPoint(i,gv,in); 00369 file << " <Transferencepoint>" << std::endl; 00370 file << " <greyValue>" << gv << "</greyValue>" <<std::endl; 00371 file << " <intensity>" << in << "</intensity> "<<std::endl; 00372 file << " </Transferencepoint>" << std::endl; 00373 i++; 00374 } 00375 file << " </TransferenceFunction>"<< std::endl; 00376 //colorPoints 00377 file << " <Colors>"<< std::endl; 00378 int ctfPointS=histogramW->getSizeBarColor(); 00379 00380 i=0; 00381 int red,green,blue; 00382 while(i<ctfPointS) 00383 { 00384 00385 histogramW->getDataBarColorPoint(i,gv,red,green,blue); 00386 file << " <greyValueRGBpoint>" << std::endl; 00387 file << " <RGBgreyValue>" << gv << "</RGBgreyValue>" <<std::endl; 00388 file << " <red>" << red << "</red>" <<std::endl; 00389 file << " <green>" << green << "</green>" <<std::endl; 00390 file << " <blue>" << blue << "</blue>" <<std::endl; 00391 file << " </greyValueRGBpoint>" << std::endl; 00392 i++; 00393 } 00394 00395 file << " </Colors>"<< std::endl; 00396 file << "</histogram Data>" << std::endl; 00397 } 00398 file.close(); 00399 }
void HistogramDialog::setCTF | ( | vtkColorTransferFunction * | cf | ) |
Definition at line 688 of file HistogramDialog.cxx.
References _ctfun.
Referenced by wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions(), wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(), and wxVtkMPR3DViewCntrlPanel::OnEditColorTable().
00689 { 00690 _ctfun=cf; 00691 00692 }
void HistogramDialog::setCurrentColorConfigurationIntoButton | ( | ) | [private] |
Definition at line 260 of file HistogramDialog.cxx.
References _comboitems, _currentcolorselectedbitmap, _maxgreyvalue, bitmapbuttonsvect, GetValuesColorPointsFunction(), and GetValuesPointsFunction().
Referenced by UpdateCurrentComboElement().
00260 { 00261 00262 std::vector<double> greylevel; 00263 std::vector<double> red; 00264 std::vector<double> green; 00265 std::vector<double> blue; 00266 std::vector<double> red0; 00267 std::vector<double> green0; 00268 std::vector<double> blue0; 00269 GetValuesColorPointsFunction(greylevel,red,green,blue); 00270 00271 for(int i = 0;i< greylevel.size();i++){ 00272 greylevel[i] = greylevel[i]/_maxgreyvalue; 00273 /*std::cout<<"HistogramDialog::setCurrentColorConfigurationIntoButton(){red"<<red[i]<<std::endl; 00274 std::cout<<"HistogramDialog::setCurrentColorConfigurationIntoButton(){green"<<green[i]<<std::endl; 00275 std::cout<<"HistogramDialog::setCurrentColorConfigurationIntoButton(){blue"<<blue[i]<<std::endl;*/ 00276 red0.push_back(red[i]); 00277 green0.push_back(green[i]); 00278 blue0.push_back(blue[i]); 00279 /*std::cout<<"HistogramDialog::setCurrentColorConfigurationIntoButton(){red"<<red0[i]<<std::endl; 00280 std::cout<<"HistogramDialog::setCurrentColorConfigurationIntoButton(){green"<<green0[i]<<std::endl; 00281 std::cout<<"HistogramDialog::setCurrentColorConfigurationIntoButton(){blue"<<blue0[i]<<std::endl;*/ 00282 } 00283 00284 std::vector<double> greylevel1; 00285 std::vector<double> value; 00286 this->GetValuesPointsFunction(greylevel1,value); 00287 00288 for(int i = 0;i< greylevel1.size();i++){ 00289 greylevel1[i] = greylevel1[i]/_maxgreyvalue; 00290 value[i] = value[i]; 00291 std::cout<<"void HistogramDialog::setCurrentColorConfigurationIntoButton(){"<<greylevel1[i]<<std::endl; 00292 std::cout<<"void HistogramDialog::setCurrentColorConfigurationIntoButton(){"<<value[i]<<std::endl; 00293 } 00294 if(_currentcolorselectedbitmap >= 0 && _currentcolorselectedbitmap < _comboitems.size()){ 00295 _comboitems[_currentcolorselectedbitmap]->SetColors(greylevel,red0,green0,blue0); 00296 _comboitems[_currentcolorselectedbitmap]->SetTransferFunction(greylevel1,value); 00297 bitmapbuttonsvect[_currentcolorselectedbitmap]->SetBitmapLabel(_comboitems[_currentcolorselectedbitmap]->GetBitmap()); 00298 } 00299 }
void HistogramDialog::SetFunctions | ( | vtkPiecewiseFunction * | _opac, | |
vtkColorTransferFunction * | _color | |||
) |
void HistogramDialog::setInfoPanExtraControls | ( | std::vector< HistogramDialogComboBoxItem * > | comboitems | ) |
Set to true in the constructor
Definition at line 125 of file HistogramDialog.cxx.
References _comboitems, _panextracontrols, getBitmapButtonDelete(), and OnEditColorsCombo().
Referenced by HistogramDialogComboBox::OnEditBitmapCombo().
00125 { 00126 _comboitems = comboitems; 00127 if(_panextracontrols!=NULL){ 00128 _panextracontrols->Show(false); 00129 for(int i=0; i < comboitems.size();i++){ 00130 00131 wxBitmap bitmap = comboitems[i]->GetBitmap(); 00132 00133 00134 _panextracontrols->GetSizer()->Add(getBitmapButtonDelete(bitmap),wxSizerFlags().Center()); 00135 _panextracontrols->GetSizer()->AddSpacer(5); 00136 00137 } 00138 00139 wxButton* button = new wxButton(_panextracontrols,wxID_ANY); 00140 button->SetToolTip(wxString("Add the current color to the list of predefined",wxConvUTF8)); 00141 button->SetLabel(wxString(_T("Add"))); 00142 Connect(button->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&HistogramDialog::OnEditColorsCombo); 00143 _panextracontrols->GetSizer()->Add(button); 00144 _panextracontrols->Layout(); 00145 _panextracontrols->Refresh(); 00146 _panextracontrols->Show(true); 00147 this->Layout(); 00148 this->Refresh(); 00149 00150 } 00151 }
void HistogramDialog::setTF | ( | vtkPiecewiseFunction * | tf | ) |
Definition at line 693 of file HistogramDialog.cxx.
References _tfun.
Referenced by wxVtkClipping3DViewVolCntrlPanel::OnBtnVolumeFunctions(), and wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions().
00694 { 00695 _tfun=tf; 00696 }
void HistogramDialog::setTransferenceFunctionHasColor | ( | bool | hasColorPoints | ) |
Definition at line 725 of file HistogramDialog.cxx.
References histogramW, and HistogramWidget::setTransferenceFunctionHasColor().
00726 { 00727 histogramW->setTransferenceFunctionHasColor(hasColorPoints); 00728 }
void HistogramDialog::setTransferenceFunctionHasPoints | ( | bool | hasPoints | ) |
Definition at line 721 of file HistogramDialog.cxx.
References histogramW, and HistogramWidget::setTransferenceFunctionHasPoints().
00722 { 00723 histogramW->setTransferenceFunctionHasPoints(hasPoints); 00724 }
void HistogramDialog::setVolume | ( | vtkVolume * | vol | ) |
Definition at line 707 of file HistogramDialog.cxx.
References newvol.
00708 { 00709 newvol=vol; 00710 }
void HistogramDialog::setVolumeMapper | ( | vtkVolumeRayCastMapper * | volMapper | ) |
Definition at line 703 of file HistogramDialog.cxx.
References volumeMapper.
00704 { 00705 volumeMapper=volMapper; 00706 }
void HistogramDialog::UpdateCurrentComboElement | ( | ) |
Definition at line 244 of file HistogramDialog.cxx.
References _comboitems, _currentcolorselectedbitmap, and setCurrentColorConfigurationIntoButton().
Referenced by HistogramDialogComboBox::OnEditBitmapCombo(), and OnEditColorsCombo().
00244 { 00245 if(_currentcolorselectedbitmap >= 0 && _currentcolorselectedbitmap < _comboitems.size()){ 00246 setCurrentColorConfigurationIntoButton(); 00247 } 00248 }
void HistogramDialog::updatePlotter | ( | ) |
Definition at line 733 of file HistogramDialog.cxx.
References histogramW, and HistogramWidget::updatePlotter().
00734 { 00735 histogramW->updatePlotter(); 00736 }
std::vector<HistogramDialogComboBoxItem*> HistogramDialog::_comboitems [private] |
Definition at line 233 of file HistogramDialog.h.
Referenced by AddNewBitmapButton(), getComboBoxItems(), OnDeleteColor(), OnEditColorsCombo(), setCurrentColorConfigurationIntoButton(), setInfoPanExtraControls(), and UpdateCurrentComboElement().
vtkColorTransferFunction* HistogramDialog::_ctfun [private] |
Definition at line 210 of file HistogramDialog.h.
Referenced by initializeHistogramDialog(), OnRefreshBtn(), setCTF(), and SetFunctions().
int HistogramDialog::_currentcolorselectedbitmap [private] |
Definition at line 241 of file HistogramDialog.h.
Referenced by AddNewBitmapButton(), initializeHistogramDialog(), OnDeleteColor(), OnEditColorsCombo(), setCurrentColorConfigurationIntoButton(), and UpdateCurrentComboElement().
std::vector<wxBitmapButton*> HistogramDialog::_deletebuttonsvector [private] |
Definition at line 238 of file HistogramDialog.h.
Referenced by getBitmapButtonDelete(), and OnDeleteColor().
int HistogramDialog::_maxgreyvalue [private] |
Definition at line 240 of file HistogramDialog.h.
Referenced by initializeHistogram(), initializeHistogramDialog(), OnEditColorsCombo(), and setCurrentColorConfigurationIntoButton().
wxPanel* HistogramDialog::_panextracontrols [private] |
Definition at line 204 of file HistogramDialog.h.
Referenced by AddNewBitmapButton(), getBitmapButtonDelete(), getPanExtraControls(), initializeHistogramDialog(), OnDeleteColor(), OnEditColorsCombo(), and setInfoPanExtraControls().
vtkPiecewiseFunction* HistogramDialog::_tfun [private] |
Definition at line 211 of file HistogramDialog.h.
Referenced by initializeHistogramDialog(), OnRefreshBtn(), SetFunctions(), and setTF().
std::vector<wxBitmapButton*> HistogramDialog::bitmapbuttonsvect [private] |
Definition at line 232 of file HistogramDialog.h.
Referenced by getBitmapButtonDelete(), OnDeleteColor(), OnEditColorsCombo(), and setCurrentColorConfigurationIntoButton().
wxBitmapButton* HistogramDialog::cancelBtn [private] |
Definition at line 190 of file HistogramDialog.h.
Referenced by initializeHistogramDialog().
HistogramWidget* HistogramDialog::histogramW [private] |
Definition at line 177 of file HistogramDialog.h.
Referenced by addColorPoint(), addPointToTransferenceFunction(), eraseColorPoints(), erasePointsTransferenceFunction(), getActualShowedPorcentage(), getDataBarColorPoint(), getHistogramPoint(), getMaxShowedPorcentage(), getMinShowedPorcentage(), getSizeBarColor(), getSizeTransferenceFunction(), getTransferenceFunctionPoint(), GetValuesColorPointsFunction(), GetValuesPointsFunction(), initializeHistogram(), initializeHistogramDialog(), OnLoadData(), OnSaveData(), setTransferenceFunctionHasColor(), setTransferenceFunctionHasPoints(), and updatePlotter().
wxButton* HistogramDialog::loadDataBtn [private] |
Definition at line 198 of file HistogramDialog.h.
vtkVolume* HistogramDialog::newvol [private] |
Definition at line 213 of file HistogramDialog.h.
Referenced by setVolume().
wxBitmapButton* HistogramDialog::okBtn [private] |
Definition at line 185 of file HistogramDialog.h.
Referenced by initializeHistogramDialog().
wxButton* HistogramDialog::refreshBtn [private] |
Definition at line 202 of file HistogramDialog.h.
bool HistogramDialog::refreshed [private] |
Definition at line 208 of file HistogramDialog.h.
Referenced by getRefreshed(), and OnRefreshBtn().
wxButton* HistogramDialog::saveDataBtn [private] |
Definition at line 194 of file HistogramDialog.h.
vtkVolumeRayCastMapper* HistogramDialog::volumeMapper [private] |
Definition at line 212 of file HistogramDialog.h.
Referenced by setVolumeMapper().