1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
26 #include "HistogramDialog.h"
29 #include "OpenImage.xpm"
35 #include "creaSystem.h"
39 // IMPLEMENT_CLASS(HistogramDialog, wxDialog)
49 //-------------------------
51 //-------------------------
52 HistogramDialog::HistogramDialog(wxWindow *parent,wxString title,vtkImageData* imageData,bool extracontrols)
53 :wxDialog(parent,-1,title,wxDefaultPosition,wxDefaultSize,wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE ,_T("dialogBox"))
56 initializeHistogramDialog(extracontrols);
57 initializeHistogram(imageData);
61 HistogramDialog::HistogramDialog(wxWindow *parent,wxString title,bool extracontrols)
62 :wxDialog(parent,-1,title,wxDefaultPosition,wxDefaultSize,wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE ,_T("dialogBox")){
64 initializeHistogramDialog(extracontrols);
66 HistogramDialog::~HistogramDialog(){
70 void HistogramDialog::initializeHistogramDialog(bool extracontrols){
71 _currentcolorselectedbitmap = -1;
74 _panextracontrols=NULL;
77 SetBackgroundColour(wxColour(255,255,255));
81 //wxvtkmpr3Dview=NULL;
82 //wxvtkclipping3Dview=NULL;
88 histogramW=new HistogramWidget(this, -1);
93 wxBitmap bitmap0(Ok_xpm);
94 okBtn = new wxBitmapButton(this, wxID_OK, bitmap0,wxDefaultPosition,wxDefaultSize);
96 wxBitmap bitmap1(Cancel_xpm);
97 cancelBtn = new wxBitmapButton(this, wxID_CANCEL, bitmap1,wxDefaultPosition,wxDefaultSize);
99 //saveDataBtn = new wxButton(this,ID_SAVE,_T("Save"));
100 //loadDataBtn = new wxButton(this,ID_LOAD,_T("Load"));
101 //refreshBtn = new wxButton(this,ID_REFRESH,_T("Refresh"));
103 //Connect(saveDataBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &HistogramDialog::OnSaveData );
104 //Connect(loadDataBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &HistogramDialog::OnLoadData );
105 //Connect(refreshBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &HistogramDialog::OnRefreshBtn );
107 //-------------------
109 //-------------------
112 wxBoxSizer * upper_box = new wxBoxSizer( wxHORIZONTAL );
113 //Including components for plotter control
115 upper_box->Add( histogramW, 4, wxGROW);
116 upper_box->Add( getControls(extracontrols),wxSizerFlags().Center() );
119 wxBoxSizer *bottomBox = new wxBoxSizer( wxHORIZONTAL );
120 bottomBox->Add( okBtn, wxSizerFlags().Center());
121 bottomBox->AddSpacer(40);
122 //bottomBox->Add( saveDataBtn,wxSizerFlags().Center() );
123 //bottomBox->AddSpacer(40);
124 //bottomBox->Add( loadDataBtn,wxSizerFlags().Center() );
125 //bottomBox->AddSpacer(40);
126 //bottomBox->Add( refreshBtn,wxSizerFlags().Center() );
127 //bottomBox->AddSpacer(40);
128 bottomBox->Add( cancelBtn,wxSizerFlags().Center() );
131 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
132 sizer->Add(upper_box,1,wxEXPAND);
133 sizer->Add(bottomBox,0,wxCENTER);
134 SetAutoLayout( TRUE );
136 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
137 #if wxMAJOR_VERSION <= 2
138 SetBestSize(wxSize(600,600));
140 SetSize(wxSize(600,600));
143 wxPanel* HistogramDialog::getPanExtraControls(){
144 wxBoxSizer* sizer0 = new wxBoxSizer(wxVERTICAL);
145 _panextracontrols = new wxPanel(this);
147 _panextracontrols->SetSizer(sizer0);
148 _panextracontrols->SetAutoLayout(true);
150 return _panextracontrols;
153 ** Set to true in the constructor
155 void HistogramDialog::setInfoPanExtraControls(std::vector<HistogramDialogComboBoxItem*> comboitems){
156 _comboitems = comboitems;
157 if(_panextracontrols!=NULL){
158 _panextracontrols->Show(false);
159 for(int i=0; i < comboitems.size();i++){
161 wxBitmap bitmap = comboitems[i]->GetBitmap();
164 _panextracontrols->GetSizer()->Add(getBitmapButtonDelete(bitmap),wxSizerFlags().Center());
165 _panextracontrols->GetSizer()->AddSpacer(5);
169 wxButton* button = new wxButton(_panextracontrols,wxID_ANY);
170 button->SetToolTip(wxString("Add the current color to the list of predefined",wxConvUTF8));
171 button->SetLabel(wxString(_T("Add")));
172 Connect(button->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&HistogramDialog::OnEditColorsCombo);
173 _panextracontrols->GetSizer()->Add(button);
174 _panextracontrols->Layout();
175 _panextracontrols->Refresh();
176 _panextracontrols->Show(true);
182 wxSizer* HistogramDialog::getBitmapButtonDelete(wxBitmap bitmap){
183 //wxCheckBox* checkbox = new wxCheckBox(_panextracontrols,wxID_ANY,_T(""));
184 wxBitmap bitmap0(Delete_xpm);
185 wxBitmapButton* deletebutton = new wxBitmapButton(_panextracontrols,wxID_ANY,bitmap0,wxDefaultPosition,wxSize(20,20));
186 deletebutton->SetToolTip(wxString("Delete the color from the list",wxConvUTF8));
187 Connect(deletebutton->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&HistogramDialog::OnDeleteColor);
188 _deletebuttonsvector.push_back(deletebutton);
190 //wxBitmap bitmap0(OpenImage_xpm);
191 wxBitmapButton* button = new wxBitmapButton(_panextracontrols,wxID_ANY,bitmap,wxDefaultPosition,wxSize(30,30));
192 button->SetToolTip(wxString("Load the current color configuration.",wxConvUTF8));
193 bitmapbuttonsvect.push_back(button);
194 Connect(button->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&HistogramDialog::OnEditColorsCombo);
197 s.Printf(_T("%d"),i);*/
199 //button->SetBitmapLabel(comboitems[i]->GetBitmap());
200 // wxStaticBitmap* button = new wxStaticBitmap(_panextracontrols,i,comboitems[i]->GetBitmap(),wxDefaultPosition,wxSize(30,30));
201 wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
202 sizer->Add(button,wxSizerFlags().Center());
204 sizer->Add(deletebutton,wxSizerFlags().Center());
207 void HistogramDialog::OnDeleteColor(wxCommandEvent& event){
208 for(int i = 0; i < _deletebuttonsvector.size();i++){
209 if(event.GetId()==_deletebuttonsvector[i]->GetId()){
210 _currentcolorselectedbitmap = -1;
211 //this->eraseColorPoints();
212 //this->erasePointsTransferenceFunction();
213 HistogramDialogComboBoxItem* temp;
214 temp = _comboitems[i];
215 _deletebuttonsvector[i]->Hide();
216 bitmapbuttonsvect[i]->Hide();
219 _panextracontrols->GetSizer()->Remove(i*2);
221 _panextracontrols->GetSizer()->Remove(i*2);
222 for(int k = i; k < _comboitems.size()-1;k++){
223 _comboitems[k] = _comboitems[k+1];
224 _deletebuttonsvector[k] = _deletebuttonsvector[k+1];
225 bitmapbuttonsvect[k] = bitmapbuttonsvect[k+1];
227 _comboitems.pop_back();
228 _deletebuttonsvector.pop_back();
229 bitmapbuttonsvect.pop_back();
232 _panextracontrols->Layout();
234 void HistogramDialog::OnEditColorsCombo(wxCommandEvent& event){
235 bool loadconfig = false;
236 UpdateCurrentComboElement();
237 for(int i = 0; i < bitmapbuttonsvect.size();i++){
238 if(event.GetId()==bitmapbuttonsvect[i]->GetId()){
239 if(i<_comboitems.size()){
240 _currentcolorselectedbitmap = i;
242 HistogramDialogComboBoxItem* currentconfig = _comboitems[i];
243 std::vector<double> greyvect = currentconfig->getGreyVector();
244 std::vector<double> _redvect = currentconfig->getRedVector();
245 std::vector<double> _greenvect = currentconfig->getGreenVector();
246 std::vector<double> _bluevect= currentconfig->getBlueVector();
247 this->eraseColorPoints();
248 this->erasePointsTransferenceFunction();
249 for(int i = 0; i < currentconfig->getGreyVector().size();i++){
250 double greyv = currentconfig->getGreyVector()[i];
251 double red = currentconfig->getRedVector()[i];
252 double green = currentconfig->getGreenVector()[i];
253 double blue = currentconfig->getBlueVector()[i];
255 this->addColorPoint(greyv*_maxgreyvalue, red*255.0, green*255.0, blue*255.0);
257 for(int i = 0; i < currentconfig->getGreyVectorTransfer().size();i++){
258 double greyv = currentconfig->getGreyVectorTransfer()[i];
259 double value = currentconfig->getValueVector()[i];
260 std::cout<<"void HistogramDialog::OnEditColorsCombo(wxCommandEvent& event){"<<greyv<<" "<<value<<std::endl;
261 this->addPointToTransferenceFunction(greyv*_maxgreyvalue, value*100);
267 AddNewBitmapButton();
270 _panextracontrols->Layout();
274 void HistogramDialog::UpdateCurrentComboElement(){
275 if(_currentcolorselectedbitmap >= 0 && _currentcolorselectedbitmap < _comboitems.size()){
276 setCurrentColorConfigurationIntoButton();
279 void HistogramDialog::AddNewBitmapButton(){
280 this->eraseColorPoints();
281 this->erasePointsTransferenceFunction();
282 HistogramDialogComboBoxItem* boxitem = new HistogramDialogComboBoxItem();
283 wxBitmap bitmap = boxitem->GetBitmap();
284 wxSizer* sizer = getBitmapButtonDelete(bitmap);
285 _panextracontrols->GetSizer()->Insert(_comboitems.size()*2,sizer,wxSizerFlags().Center());
286 _panextracontrols->GetSizer()->InsertSpacer(_comboitems.size()*2+1,5);
287 _comboitems.push_back(boxitem);
288 _currentcolorselectedbitmap = _comboitems.size()-1;
290 void HistogramDialog::setCurrentColorConfigurationIntoButton(){
292 std::vector<double> greylevel;
293 std::vector<double> red;
294 std::vector<double> green;
295 std::vector<double> blue;
296 std::vector<double> red0;
297 std::vector<double> green0;
298 std::vector<double> blue0;
299 GetValuesColorPointsFunction(greylevel,red,green,blue);
301 for(int i = 0;i< greylevel.size();i++){
302 greylevel[i] = greylevel[i]/_maxgreyvalue;
303 /*std::cout<<"HistogramDialog::setCurrentColorConfigurationIntoButton(){red"<<red[i]<<std::endl;
304 std::cout<<"HistogramDialog::setCurrentColorConfigurationIntoButton(){green"<<green[i]<<std::endl;
305 std::cout<<"HistogramDialog::setCurrentColorConfigurationIntoButton(){blue"<<blue[i]<<std::endl;*/
306 red0.push_back(red[i]);
307 green0.push_back(green[i]);
308 blue0.push_back(blue[i]);
309 /*std::cout<<"HistogramDialog::setCurrentColorConfigurationIntoButton(){red"<<red0[i]<<std::endl;
310 std::cout<<"HistogramDialog::setCurrentColorConfigurationIntoButton(){green"<<green0[i]<<std::endl;
311 std::cout<<"HistogramDialog::setCurrentColorConfigurationIntoButton(){blue"<<blue0[i]<<std::endl;*/
314 std::vector<double> greylevel1;
315 std::vector<double> value;
316 this->GetValuesPointsFunction(greylevel1,value);
318 for(int i = 0;i< greylevel1.size();i++){
319 greylevel1[i] = greylevel1[i]/_maxgreyvalue;
321 std::cout<<"void HistogramDialog::setCurrentColorConfigurationIntoButton(){"<<greylevel1[i]<<std::endl;
322 std::cout<<"void HistogramDialog::setCurrentColorConfigurationIntoButton(){"<<value[i]<<std::endl;
324 if(_currentcolorselectedbitmap >= 0 && _currentcolorselectedbitmap < _comboitems.size()){
325 _comboitems[_currentcolorselectedbitmap]->SetColors(greylevel,red0,green0,blue0);
326 _comboitems[_currentcolorselectedbitmap]->SetTransferFunction(greylevel1,value);
327 bitmapbuttonsvect[_currentcolorselectedbitmap]->SetBitmapLabel(_comboitems[_currentcolorselectedbitmap]->GetBitmap());
331 wxSizer* HistogramDialog::getControls(bool extracontrols){
333 wxSizer* sizer = new wxBoxSizer(wxVERTICAL);
335 wxBitmap bitmap0(OpenImage_xpm);
336 wxBitmapButton* opendata = new wxBitmapButton(this, -1, bitmap0,wxDefaultPosition,wxSize(30,30));
337 Connect(opendata->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&HistogramDialog::OnLoadData);
338 sizer->Add(opendata,wxSizerFlags().Center());
343 wxBitmap bitmap1(Save_xpm);
344 wxBitmapButton* savedata = new wxBitmapButton(this, -1, bitmap1,wxDefaultPosition,wxSize(30,30));
345 Connect(savedata->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&HistogramDialog::OnSaveData);
346 sizer->Add(savedata,wxSizerFlags().Center());
350 sizer->Add(getPanExtraControls(),wxSizerFlags().Center());
352 //sizer->Add(getBitmapCombo(),wxSizerFlags().Center());
361 //-----------------------
363 //-----------------------
365 void HistogramDialog::OnSaveData(wxCommandEvent& event)
367 //wxFileSelector(_T("Save Data"),wxSAVE);
368 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
369 #if wxMAJOR_VERSION <= 2
370 wxString nameF=wxFileSelector(_T("Save Data"), _T(" "),_T(""),_T(""),_T("*.*"),wxSAVE, NULL, -1, -1);
372 wxString nameF=wxFileSelector(_T("Save Data"), _T(" "),_T(""),_T(""),_T("*.*"),wxFD_SAVE, NULL, -1, -1);
376 if(nameF.CompareTo( _T("/0") )>0)
377 file.open( (const char*)(nameF.mb_str()) );
381 file << "<histogram Data>" << std::endl;
384 file << " <histogramPoints>" << std::endl;
385 int histogramS=histogramW->getHistogramSize();
389 file << " <HistogramPoint>" << std::endl;
390 file << " <greyValue>" << i << "</greyValue>" <<std::endl;
391 file << " <number>" << histogramW->getHistogramPoint(i) << "</number>"<<std::endl;
392 file << " </HistogramPoint>" << std::endl;
395 file << " </histogramPoints>" << std::endl;
397 //points transference Function
398 file << " <TransferenceFunction>"<< std::endl;
399 int tfPointS=histogramW->getSizeTransferenceFunction();
405 histogramW->getTransferenceFunctionPoint(i,gv,in);
406 file << " <Transferencepoint>" << std::endl;
407 file << " <greyValue>" << gv << "</greyValue>" <<std::endl;
408 file << " <intensity>" << in << "</intensity> "<<std::endl;
409 file << " </Transferencepoint>" << std::endl;
412 file << " </TransferenceFunction>"<< std::endl;
414 file << " <Colors>"<< std::endl;
415 int ctfPointS=histogramW->getSizeBarColor();
422 histogramW->getDataBarColorPoint(i,gv,red,green,blue);
423 file << " <greyValueRGBpoint>" << std::endl;
424 file << " <RGBgreyValue>" << gv << "</RGBgreyValue>" <<std::endl;
425 file << " <red>" << red << "</red>" <<std::endl;
426 file << " <green>" << green << "</green>" <<std::endl;
427 file << " <blue>" << blue << "</blue>" <<std::endl;
428 file << " </greyValueRGBpoint>" << std::endl;
432 file << " </Colors>"<< std::endl;
433 file << "</histogram Data>" << std::endl;
438 void HistogramDialog::OnLoadData(wxCommandEvent& event)
440 wxString nameF=wxFileSelector(_T("Load Data") );
443 if(nameF.CompareTo( _T("/0") )>0)
444 file.open( (const char*) (nameF.mb_str()) );
446 bool histogramReading=false,/*histogramPoints=false,histogramPoint=false,*/tf=false,ctf=false,tfp=false,ctfp=false; // JPRx
447 int gv=-1,in=-1,red=-1,gr=-1,bl=-1/*,nPoints=-1*/; // JPRx
451 erasePointsTransferenceFunction();
455 //std::getline(file,line);
460 std::getline(file,line);
461 //int a=line.find("histogram Data");
462 if( (int)(line.find("histogram Data"))!=-1)
464 histogramReading=true;
468 else if(line.find("histogramPoints")!=0 && histogramReading)
470 histogramPoints=true;
472 else if(line.find("histogramPoint")!=0 && histogramReading && histogramPoints)
476 else if(line.find("greyValue")!=0 && histogramReading && histogramPoints)
478 int pos1=line.find(">");
479 int pos2=line.find("<",pos+1);
480 std::string x=line.substr(pos1+1,pos2-1);
483 else if(line.find("number")!=0 && histogramReading && histogramPoints)
485 int pos1=line.find(">");
486 int pos2=line.find("<",pos+1);
487 std::string x=line.substr(pos1+1,pos2-1);
489 //add to the histogram
490 //histogramW->addPointToTransferenceFunction(gc,in);
493 else if( (int)(line.find("TransferenceFunction"))!=-1 && histogramReading)
497 else if( (int)(line.find("<Transferencepoint>"))!=-1 && histogramReading && tf)
501 else if( (int)(line.find("greyValue"))!=-1 && histogramReading && tf && tfp)
503 int pos1=line.find(">");
504 int pos2=line.find("<",pos1+1);
505 std::string x=line.substr(pos1+1,pos2-pos1-1);
509 else if( (int)(line.find("intensity"))!=-1 && histogramReading && tf && tfp)
511 int pos1=line.find(">");
512 int pos2=line.find("<",pos1+1);
513 std::string x=line.substr(pos1+1,pos2-pos1-1);
515 histogramW->addPointToTransferenceFunction(gv,in);
519 else if( (int)(line.find("Colors"))!=-1 && histogramReading)
524 else if( (int)(line.find("greyValueRGBpoint"))!=-1 && histogramReading && ctf )
529 else if( (int)(line.find("RGBgreyValue"))!=-1 && histogramReading && ctf && ctfp)
531 int pos1=line.find(">");
532 int pos2=line.find("<",pos1+1);
533 std::string x=line.substr(pos1+1,pos2-pos1-1);
537 else if( (int)(line.find("red"))!=-1 && histogramReading && ctf && ctfp)
539 int pos1=line.find(">");
540 int pos2=line.find("<",pos1+1);
541 std::string x=line.substr(pos1+1,pos2-pos1-1);
545 else if( (int)(line.find("green"))!=-1 && histogramReading && ctf && ctfp)
547 int pos1=line.find(">");
548 int pos2=line.find("<",pos1+1);
549 std::string x=line.substr(pos1+1,pos2-pos1-1);
552 else if( (int)(line.find("blue"))!=-1 && histogramReading && ctf && ctfp)
554 int pos1=line.find(">");
555 int pos2=line.find("<",pos1+1);
556 std::string x=line.substr(pos1+1,pos2-pos1-1);
558 histogramW->addColorPoint(gv,red,gr,bl);
566 histogramW->updatePlotter();
572 void HistogramDialog::OnRefreshBtn(wxCommandEvent &event)
578 // -- TransferenceFunction --
579 int nPointsTF=getSizeTransferenceFunction();
584 int nTFPoints=getSizeTransferenceFunction();
588 getTransferenceFunctionPoint(i,xi,yi);
589 _tfun->AddPoint( xi , yi/100.0 );
595 int nPointsCTF=getSizeBarColor();
598 _ctfun->RemoveAllPoints();
600 int nCTFpoints=getSizeBarColor();
604 getDataBarColorPoint(i,xi,r,g,b);
605 _ctfun->AddRGBPoint(xi,r/255.0,g/255.0,b/255.0 );
613 NOTE I NEED THE UPDATE
615 //if it was call from the clipping ctnrl panel
616 //if(wxvtkclipping3Dview!=NULL)
618 // wxvtkclipping3Dview->Refresh();
621 //else if(wxvtkmpr3Dview!=NULL)
623 // wxvtkmpr3Dview->Refresh();
629 //-----------------------
631 //-----------------------
634 get number of points of the transference function
636 int HistogramDialog::getSizeTransferenceFunction()
638 return histogramW->getSizeTransferenceFunction();
642 get number of points of the barColor
644 int HistogramDialog::getSizeBarColor()
646 return histogramW->getSizeBarColor();
649 get a point of the transference function
651 void HistogramDialog::getTransferenceFunctionPoint(int index,int& x,int& y)
653 histogramW->getTransferenceFunctionPoint(index,x,y);
656 get a color int the bqr color
658 void HistogramDialog::getDataBarColorPoint(int index,int&x, int& red,int& green,int& blue)
660 histogramW->getDataBarColorPoint(index,x,red,green,blue);
663 get a point of the Histogram
666 int HistogramDialog::getHistogramPoint(int gValue)
668 return histogramW->getHistogramPoint(gValue);
671 //--------------------
673 //---------------------
675 Get the porcentage of the positions of
676 the min,max and actual in the bar range
678 float HistogramDialog::getMaxShowedPorcentage()
680 return histogramW->getMaxShowedPorcentage();
682 float HistogramDialog::getMinShowedPorcentage()
684 return histogramW->getMinShowedPorcentage();
686 float HistogramDialog::getActualShowedPorcentage()
688 return histogramW->getActualShowedPorcentage();
690 //---------------------------------------
691 // setting data in transferences function
693 //----------------------------------------
694 bool HistogramDialog::addPointToTransferenceFunction(double x, double y)
696 return histogramW->addPointToTransferenceFunction(x,y);
698 bool HistogramDialog::addColorPoint(double x,int red,int green, int blue)
700 return histogramW->addColorPoint(x,red,green,blue);
702 //------------------------
704 //------------------------
707 Erase all the points that are in the transference function
709 void HistogramDialog::erasePointsTransferenceFunction()
711 histogramW->erasePointsTransferenceFunction();
714 Erase the color points in the plotter
716 void HistogramDialog::eraseColorPoints()
718 histogramW->eraseColorPoints();
721 //-------------------
722 // Getter and setters
723 //-------------------
725 void HistogramDialog::setCTF(vtkColorTransferFunction *cf)
730 void HistogramDialog:: setTF(vtkPiecewiseFunction *tf)
735 bool HistogramDialog::getRefreshed()
740 #if (VTK_MAJOR_VERSION <= 7)
741 void HistogramDialog::setVolumeMapper(vtkVolumeRayCastMapper* volMapper)
743 void HistogramDialog::setVolumeMapper(vtkFixedPointVolumeRayCastMapper* volMapper)
746 volumeMapper=volMapper;
748 void HistogramDialog::setVolume(vtkVolume* vol)
752 //void HistogramDialog::setMPR3Dview(wxVtkMPR3DView *wxvtkmpr3Dview1)
754 // wxvtkmpr3Dview=wxvtkmpr3Dview1;
756 //void HistogramDialog::setClipping3DView(wxVtkClipping3DView *wxvtkclipping3Dview1)
758 // wxvtkclipping3Dview=wxvtkclipping3Dview1;
762 void HistogramDialog::setTransferenceFunctionHasPoints(bool hasPoints)
764 histogramW->setTransferenceFunctionHasPoints(hasPoints);
766 void HistogramDialog::setTransferenceFunctionHasColor(bool hasColorPoints)
768 histogramW->setTransferenceFunctionHasColor(hasColorPoints);
771 //--------------------
772 // plotter Information
773 //---------------------
774 void HistogramDialog::updatePlotter()
776 histogramW->updatePlotter();
781 ** Initialize the histogram
783 void HistogramDialog::initializeHistogram(vtkImageData* img){
784 _maxgreyvalue = img->GetScalarRange()[1];
785 histogramW->initializeHistogram(img);
788 ** Returns two vectors, the grey level of the point and its value, the value is between [0,1]
790 void HistogramDialog::GetValuesPointsFunction(std::vector<double>& greylevel,std::vector<double>& value){
792 histogramW->GetValuesPointsFunction(greylevel, value);
796 ** Returns two vectors, the grey level of the point and its value, the red, green
797 ** and blue value is between [0,1]
799 void HistogramDialog::GetValuesColorPointsFunction(std::vector<double>& greylevel,
800 std::vector<double>& red,
801 std::vector<double>& green,
802 std::vector<double>& blue)
804 histogramW->GetValuesColorPointsFunction(greylevel, red, green, blue);
807 void HistogramDialog::SetFunctions(vtkPiecewiseFunction* _opac, vtkColorTransferFunction* _color){