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 SetBestSize(wxSize(600,600));
138 wxPanel* HistogramDialog::getPanExtraControls(){
139 wxBoxSizer* sizer0 = new wxBoxSizer(wxVERTICAL);
140 _panextracontrols = new wxPanel(this);
142 _panextracontrols->SetSizer(sizer0);
143 _panextracontrols->SetAutoLayout(true);
145 return _panextracontrols;
148 ** Set to true in the constructor
150 void HistogramDialog::setInfoPanExtraControls(std::vector<HistogramDialogComboBoxItem*> comboitems){
151 _comboitems = comboitems;
152 if(_panextracontrols!=NULL){
153 _panextracontrols->Show(false);
154 for(int i=0; i < comboitems.size();i++){
156 wxBitmap bitmap = comboitems[i]->GetBitmap();
159 _panextracontrols->GetSizer()->Add(getBitmapButtonDelete(bitmap),wxSizerFlags().Center());
160 _panextracontrols->GetSizer()->AddSpacer(5);
164 wxButton* button = new wxButton(_panextracontrols,wxID_ANY);
165 button->SetToolTip(wxString("Add the current color to the list of predefined",wxConvUTF8));
166 button->SetLabel(wxString(_T("Add")));
167 Connect(button->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&HistogramDialog::OnEditColorsCombo);
168 _panextracontrols->GetSizer()->Add(button);
169 _panextracontrols->Layout();
170 _panextracontrols->Refresh();
171 _panextracontrols->Show(true);
177 wxSizer* HistogramDialog::getBitmapButtonDelete(wxBitmap bitmap){
178 //wxCheckBox* checkbox = new wxCheckBox(_panextracontrols,wxID_ANY,_T(""));
179 wxBitmap bitmap0(Delete_xpm);
180 wxBitmapButton* deletebutton = new wxBitmapButton(_panextracontrols,wxID_ANY,bitmap0,wxDefaultPosition,wxSize(20,20));
181 deletebutton->SetToolTip(wxString("Delete the color from the list",wxConvUTF8));
182 Connect(deletebutton->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&HistogramDialog::OnDeleteColor);
183 _deletebuttonsvector.push_back(deletebutton);
185 //wxBitmap bitmap0(OpenImage_xpm);
186 wxBitmapButton* button = new wxBitmapButton(_panextracontrols,wxID_ANY,bitmap,wxDefaultPosition,wxSize(30,30));
187 button->SetToolTip(wxString("Load the current color configuration.",wxConvUTF8));
188 bitmapbuttonsvect.push_back(button);
189 Connect(button->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&HistogramDialog::OnEditColorsCombo);
192 s.Printf(_T("%d"),i);*/
194 //button->SetBitmapLabel(comboitems[i]->GetBitmap());
195 // wxStaticBitmap* button = new wxStaticBitmap(_panextracontrols,i,comboitems[i]->GetBitmap(),wxDefaultPosition,wxSize(30,30));
196 wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
197 sizer->Add(button,wxSizerFlags().Center());
199 sizer->Add(deletebutton,wxSizerFlags().Center());
202 void HistogramDialog::OnDeleteColor(wxCommandEvent& event){
203 for(int i = 0; i < _deletebuttonsvector.size();i++){
204 if(event.GetId()==_deletebuttonsvector[i]->GetId()){
205 _currentcolorselectedbitmap = -1;
206 //this->eraseColorPoints();
207 //this->erasePointsTransferenceFunction();
208 HistogramDialogComboBoxItem* temp;
209 temp = _comboitems[i];
210 _deletebuttonsvector[i]->Hide();
211 bitmapbuttonsvect[i]->Hide();
214 _panextracontrols->GetSizer()->Remove(i*2);
216 _panextracontrols->GetSizer()->Remove(i*2);
217 for(int k = i; k < _comboitems.size()-1;k++){
218 _comboitems[k] = _comboitems[k+1];
219 _deletebuttonsvector[k] = _deletebuttonsvector[k+1];
220 bitmapbuttonsvect[k] = bitmapbuttonsvect[k+1];
222 _comboitems.pop_back();
223 _deletebuttonsvector.pop_back();
224 bitmapbuttonsvect.pop_back();
227 _panextracontrols->Layout();
229 void HistogramDialog::OnEditColorsCombo(wxCommandEvent& event){
230 bool loadconfig = false;
231 UpdateCurrentComboElement();
232 for(int i = 0; i < bitmapbuttonsvect.size();i++){
233 if(event.GetId()==bitmapbuttonsvect[i]->GetId()){
234 if(i<_comboitems.size()){
235 _currentcolorselectedbitmap = i;
237 HistogramDialogComboBoxItem* currentconfig = _comboitems[i];
238 std::vector<double> greyvect = currentconfig->getGreyVector();
239 std::vector<double> _redvect = currentconfig->getRedVector();
240 std::vector<double> _greenvect = currentconfig->getGreenVector();
241 std::vector<double> _bluevect= currentconfig->getBlueVector();
242 this->eraseColorPoints();
243 this->erasePointsTransferenceFunction();
244 for(int i = 0; i < currentconfig->getGreyVector().size();i++){
245 double greyv = currentconfig->getGreyVector()[i];
246 double red = currentconfig->getRedVector()[i];
247 double green = currentconfig->getGreenVector()[i];
248 double blue = currentconfig->getBlueVector()[i];
250 this->addColorPoint(greyv*_maxgreyvalue, red*255.0, green*255.0, blue*255.0);
252 for(int i = 0; i < currentconfig->getGreyVectorTransfer().size();i++){
253 double greyv = currentconfig->getGreyVectorTransfer()[i];
254 double value = currentconfig->getValueVector()[i];
255 std::cout<<"void HistogramDialog::OnEditColorsCombo(wxCommandEvent& event){"<<greyv<<" "<<value<<std::endl;
256 this->addPointToTransferenceFunction(greyv*_maxgreyvalue, value*100);
262 AddNewBitmapButton();
265 _panextracontrols->Layout();
269 void HistogramDialog::UpdateCurrentComboElement(){
270 if(_currentcolorselectedbitmap >= 0 && _currentcolorselectedbitmap < _comboitems.size()){
271 setCurrentColorConfigurationIntoButton();
274 void HistogramDialog::AddNewBitmapButton(){
275 this->eraseColorPoints();
276 this->erasePointsTransferenceFunction();
277 HistogramDialogComboBoxItem* boxitem = new HistogramDialogComboBoxItem();
278 wxBitmap bitmap = boxitem->GetBitmap();
279 wxSizer* sizer = getBitmapButtonDelete(bitmap);
280 _panextracontrols->GetSizer()->Insert(_comboitems.size()*2,sizer,wxSizerFlags().Center());
281 _panextracontrols->GetSizer()->InsertSpacer(_comboitems.size()*2+1,5);
282 _comboitems.push_back(boxitem);
283 _currentcolorselectedbitmap = _comboitems.size()-1;
285 void HistogramDialog::setCurrentColorConfigurationIntoButton(){
287 std::vector<double> greylevel;
288 std::vector<double> red;
289 std::vector<double> green;
290 std::vector<double> blue;
291 std::vector<double> red0;
292 std::vector<double> green0;
293 std::vector<double> blue0;
294 GetValuesColorPointsFunction(greylevel,red,green,blue);
296 for(int i = 0;i< greylevel.size();i++){
297 greylevel[i] = greylevel[i]/_maxgreyvalue;
298 /*std::cout<<"HistogramDialog::setCurrentColorConfigurationIntoButton(){red"<<red[i]<<std::endl;
299 std::cout<<"HistogramDialog::setCurrentColorConfigurationIntoButton(){green"<<green[i]<<std::endl;
300 std::cout<<"HistogramDialog::setCurrentColorConfigurationIntoButton(){blue"<<blue[i]<<std::endl;*/
301 red0.push_back(red[i]);
302 green0.push_back(green[i]);
303 blue0.push_back(blue[i]);
304 /*std::cout<<"HistogramDialog::setCurrentColorConfigurationIntoButton(){red"<<red0[i]<<std::endl;
305 std::cout<<"HistogramDialog::setCurrentColorConfigurationIntoButton(){green"<<green0[i]<<std::endl;
306 std::cout<<"HistogramDialog::setCurrentColorConfigurationIntoButton(){blue"<<blue0[i]<<std::endl;*/
309 std::vector<double> greylevel1;
310 std::vector<double> value;
311 this->GetValuesPointsFunction(greylevel1,value);
313 for(int i = 0;i< greylevel1.size();i++){
314 greylevel1[i] = greylevel1[i]/_maxgreyvalue;
316 std::cout<<"void HistogramDialog::setCurrentColorConfigurationIntoButton(){"<<greylevel1[i]<<std::endl;
317 std::cout<<"void HistogramDialog::setCurrentColorConfigurationIntoButton(){"<<value[i]<<std::endl;
319 if(_currentcolorselectedbitmap >= 0 && _currentcolorselectedbitmap < _comboitems.size()){
320 _comboitems[_currentcolorselectedbitmap]->SetColors(greylevel,red0,green0,blue0);
321 _comboitems[_currentcolorselectedbitmap]->SetTransferFunction(greylevel1,value);
322 bitmapbuttonsvect[_currentcolorselectedbitmap]->SetBitmapLabel(_comboitems[_currentcolorselectedbitmap]->GetBitmap());
326 wxSizer* HistogramDialog::getControls(bool extracontrols){
328 wxSizer* sizer = new wxBoxSizer(wxVERTICAL);
330 wxBitmap bitmap0(OpenImage_xpm);
331 wxBitmapButton* opendata = new wxBitmapButton(this, -1, bitmap0,wxDefaultPosition,wxSize(30,30));
332 Connect(opendata->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&HistogramDialog::OnLoadData);
333 sizer->Add(opendata,wxSizerFlags().Center());
338 wxBitmap bitmap1(Save_xpm);
339 wxBitmapButton* savedata = new wxBitmapButton(this, -1, bitmap1,wxDefaultPosition,wxSize(30,30));
340 Connect(savedata->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&HistogramDialog::OnSaveData);
341 sizer->Add(savedata,wxSizerFlags().Center());
345 sizer->Add(getPanExtraControls(),wxSizerFlags().Center());
347 //sizer->Add(getBitmapCombo(),wxSizerFlags().Center());
356 //-----------------------
358 //-----------------------
360 void HistogramDialog::OnSaveData(wxCommandEvent& event)
362 //wxFileSelector(_T("Save Data"),wxSAVE);
363 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
364 #if wxMAJOR_VERSION <= 2
365 wxString nameF=wxFileSelector(_T("Save Data"), _T(" "),_T(""),_T(""),_T("*.*"),wxSAVE, NULL, -1, -1);
367 wxString nameF=wxFileSelector(_T("Save Data"), _T(" "),_T(""),_T(""),_T("*.*"),wxFD_SAVE, NULL, -1, -1);
371 if(nameF.CompareTo( _T("/0") )>0)
372 file.open( (const char*)(nameF.mb_str()) );
376 file << "<histogram Data>" << std::endl;
379 file << " <histogramPoints>" << std::endl;
380 int histogramS=histogramW->getHistogramSize();
384 file << " <HistogramPoint>" << std::endl;
385 file << " <greyValue>" << i << "</greyValue>" <<std::endl;
386 file << " <number>" << histogramW->getHistogramPoint(i) << "</number>"<<std::endl;
387 file << " </HistogramPoint>" << std::endl;
390 file << " </histogramPoints>" << std::endl;
392 //points transference Function
393 file << " <TransferenceFunction>"<< std::endl;
394 int tfPointS=histogramW->getSizeTransferenceFunction();
400 histogramW->getTransferenceFunctionPoint(i,gv,in);
401 file << " <Transferencepoint>" << std::endl;
402 file << " <greyValue>" << gv << "</greyValue>" <<std::endl;
403 file << " <intensity>" << in << "</intensity> "<<std::endl;
404 file << " </Transferencepoint>" << std::endl;
407 file << " </TransferenceFunction>"<< std::endl;
409 file << " <Colors>"<< std::endl;
410 int ctfPointS=histogramW->getSizeBarColor();
417 histogramW->getDataBarColorPoint(i,gv,red,green,blue);
418 file << " <greyValueRGBpoint>" << std::endl;
419 file << " <RGBgreyValue>" << gv << "</RGBgreyValue>" <<std::endl;
420 file << " <red>" << red << "</red>" <<std::endl;
421 file << " <green>" << green << "</green>" <<std::endl;
422 file << " <blue>" << blue << "</blue>" <<std::endl;
423 file << " </greyValueRGBpoint>" << std::endl;
427 file << " </Colors>"<< std::endl;
428 file << "</histogram Data>" << std::endl;
433 void HistogramDialog::OnLoadData(wxCommandEvent& event)
435 wxString nameF=wxFileSelector(_T("Load Data") );
438 if(nameF.CompareTo( _T("/0") )>0)
439 file.open( (const char*) (nameF.mb_str()) );
441 bool histogramReading=false,/*histogramPoints=false,histogramPoint=false,*/tf=false,ctf=false,tfp=false,ctfp=false; // JPRx
442 int gv=-1,in=-1,red=-1,gr=-1,bl=-1/*,nPoints=-1*/; // JPRx
446 erasePointsTransferenceFunction();
450 //std::getline(file,line);
455 std::getline(file,line);
456 //int a=line.find("histogram Data");
457 if( (int)(line.find("histogram Data"))!=-1)
459 histogramReading=true;
463 else if(line.find("histogramPoints")!=0 && histogramReading)
465 histogramPoints=true;
467 else if(line.find("histogramPoint")!=0 && histogramReading && histogramPoints)
471 else if(line.find("greyValue")!=0 && histogramReading && histogramPoints)
473 int pos1=line.find(">");
474 int pos2=line.find("<",pos+1);
475 std::string x=line.substr(pos1+1,pos2-1);
478 else if(line.find("number")!=0 && histogramReading && histogramPoints)
480 int pos1=line.find(">");
481 int pos2=line.find("<",pos+1);
482 std::string x=line.substr(pos1+1,pos2-1);
484 //add to the histogram
485 //histogramW->addPointToTransferenceFunction(gc,in);
488 else if( (int)(line.find("TransferenceFunction"))!=-1 && histogramReading)
492 else if( (int)(line.find("<Transferencepoint>"))!=-1 && histogramReading && tf)
496 else if( (int)(line.find("greyValue"))!=-1 && histogramReading && tf && tfp)
498 int pos1=line.find(">");
499 int pos2=line.find("<",pos1+1);
500 std::string x=line.substr(pos1+1,pos2-pos1-1);
504 else if( (int)(line.find("intensity"))!=-1 && histogramReading && tf && tfp)
506 int pos1=line.find(">");
507 int pos2=line.find("<",pos1+1);
508 std::string x=line.substr(pos1+1,pos2-pos1-1);
510 histogramW->addPointToTransferenceFunction(gv,in);
514 else if( (int)(line.find("Colors"))!=-1 && histogramReading)
519 else if( (int)(line.find("greyValueRGBpoint"))!=-1 && histogramReading && ctf )
524 else if( (int)(line.find("RGBgreyValue"))!=-1 && histogramReading && ctf && ctfp)
526 int pos1=line.find(">");
527 int pos2=line.find("<",pos1+1);
528 std::string x=line.substr(pos1+1,pos2-pos1-1);
532 else if( (int)(line.find("red"))!=-1 && histogramReading && ctf && ctfp)
534 int pos1=line.find(">");
535 int pos2=line.find("<",pos1+1);
536 std::string x=line.substr(pos1+1,pos2-pos1-1);
540 else if( (int)(line.find("green"))!=-1 && histogramReading && ctf && ctfp)
542 int pos1=line.find(">");
543 int pos2=line.find("<",pos1+1);
544 std::string x=line.substr(pos1+1,pos2-pos1-1);
547 else if( (int)(line.find("blue"))!=-1 && histogramReading && ctf && ctfp)
549 int pos1=line.find(">");
550 int pos2=line.find("<",pos1+1);
551 std::string x=line.substr(pos1+1,pos2-pos1-1);
553 histogramW->addColorPoint(gv,red,gr,bl);
561 histogramW->updatePlotter();
567 void HistogramDialog::OnRefreshBtn(wxCommandEvent &event)
573 // -- TransferenceFunction --
574 int nPointsTF=getSizeTransferenceFunction();
579 int nTFPoints=getSizeTransferenceFunction();
583 getTransferenceFunctionPoint(i,xi,yi);
584 _tfun->AddPoint( xi , yi/100.0 );
590 int nPointsCTF=getSizeBarColor();
593 _ctfun->RemoveAllPoints();
595 int nCTFpoints=getSizeBarColor();
599 getDataBarColorPoint(i,xi,r,g,b);
600 _ctfun->AddRGBPoint(xi,r/255.0,g/255.0,b/255.0 );
608 NOTE I NEED THE UPDATE
610 //if it was call from the clipping ctnrl panel
611 //if(wxvtkclipping3Dview!=NULL)
613 // wxvtkclipping3Dview->Refresh();
616 //else if(wxvtkmpr3Dview!=NULL)
618 // wxvtkmpr3Dview->Refresh();
624 //-----------------------
626 //-----------------------
629 get number of points of the transference function
631 int HistogramDialog::getSizeTransferenceFunction()
633 return histogramW->getSizeTransferenceFunction();
637 get number of points of the barColor
639 int HistogramDialog::getSizeBarColor()
641 return histogramW->getSizeBarColor();
644 get a point of the transference function
646 void HistogramDialog::getTransferenceFunctionPoint(int index,int& x,int& y)
648 histogramW->getTransferenceFunctionPoint(index,x,y);
651 get a color int the bqr color
653 void HistogramDialog::getDataBarColorPoint(int index,int&x, int& red,int& green,int& blue)
655 histogramW->getDataBarColorPoint(index,x,red,green,blue);
658 get a point of the Histogram
661 int HistogramDialog::getHistogramPoint(int gValue)
663 return histogramW->getHistogramPoint(gValue);
666 //--------------------
668 //---------------------
670 Get the porcentage of the positions of
671 the min,max and actual in the bar range
673 float HistogramDialog::getMaxShowedPorcentage()
675 return histogramW->getMaxShowedPorcentage();
677 float HistogramDialog::getMinShowedPorcentage()
679 return histogramW->getMinShowedPorcentage();
681 float HistogramDialog::getActualShowedPorcentage()
683 return histogramW->getActualShowedPorcentage();
685 //---------------------------------------
686 // setting data in transferences function
688 //----------------------------------------
689 bool HistogramDialog::addPointToTransferenceFunction(double x, double y)
691 return histogramW->addPointToTransferenceFunction(x,y);
693 bool HistogramDialog::addColorPoint(double x,int red,int green, int blue)
695 return histogramW->addColorPoint(x,red,green,blue);
697 //------------------------
699 //------------------------
702 Erase all the points that are in the transference function
704 void HistogramDialog::erasePointsTransferenceFunction()
706 histogramW->erasePointsTransferenceFunction();
709 Erase the color points in the plotter
711 void HistogramDialog::eraseColorPoints()
713 histogramW->eraseColorPoints();
716 //-------------------
717 // Getter and setters
718 //-------------------
720 void HistogramDialog::setCTF(vtkColorTransferFunction *cf)
725 void HistogramDialog:: setTF(vtkPiecewiseFunction *tf)
730 bool HistogramDialog::getRefreshed()
735 void HistogramDialog::setVolumeMapper(vtkVolumeRayCastMapper* volMapper)
737 volumeMapper=volMapper;
739 void HistogramDialog::setVolume(vtkVolume* vol)
743 //void HistogramDialog::setMPR3Dview(wxVtkMPR3DView *wxvtkmpr3Dview1)
745 // wxvtkmpr3Dview=wxvtkmpr3Dview1;
747 //void HistogramDialog::setClipping3DView(wxVtkClipping3DView *wxvtkclipping3Dview1)
749 // wxvtkclipping3Dview=wxvtkclipping3Dview1;
753 void HistogramDialog::setTransferenceFunctionHasPoints(bool hasPoints)
755 histogramW->setTransferenceFunctionHasPoints(hasPoints);
757 void HistogramDialog::setTransferenceFunctionHasColor(bool hasColorPoints)
759 histogramW->setTransferenceFunctionHasColor(hasColorPoints);
762 //--------------------
763 // plotter Information
764 //---------------------
765 void HistogramDialog::updatePlotter()
767 histogramW->updatePlotter();
772 ** Initialize the histogram
774 void HistogramDialog::initializeHistogram(vtkImageData* img){
775 _maxgreyvalue = img->GetScalarRange()[1];
776 histogramW->initializeHistogram(img);
779 ** Returns two vectors, the grey level of the point and its value, the value is between [0,1]
781 void HistogramDialog::GetValuesPointsFunction(std::vector<double>& greylevel,std::vector<double>& value){
783 histogramW->GetValuesPointsFunction(greylevel, value);
787 ** Returns two vectors, the grey level of the point and its value, the red, green
788 ** and blue value is between [0,1]
790 void HistogramDialog::GetValuesColorPointsFunction(std::vector<double>& greylevel,
791 std::vector<double>& red,
792 std::vector<double>& green,
793 std::vector<double>& blue)
795 histogramW->GetValuesColorPointsFunction(greylevel, red, green, blue);
798 void HistogramDialog::SetFunctions(vtkPiecewiseFunction* _opac, vtkColorTransferFunction* _color){