#include <HistogramDialog.h>
Public Member Functions | |
HistogramDialog (wxWindow *parent, wxString title, vtkImageData *imageData, int type) | |
HistogramDialog (wxWindow *parent, wxString title) | |
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 | setMPR3Dview (wxVtkMPR3DView *wxvtkmpr3Dview1) |
void | setClipping3DView (wxVtkClipping3DView *wxvtkclipping3Dview1) |
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) |
Private Attributes | |
HistogramWidget * | histogramW |
wxButton * | okBtn |
wxButton * | cancelBtn |
wxButton * | saveDataBtn |
wxButton * | loadDataBtn |
wxButton * | refreshBtn |
bool | refreshed |
vtkColorTransferFunction * | _ctfun |
vtkPiecewiseFunction * | _tfun |
vtkVolumeRayCastMapper * | volumeMapper |
vtkVolume * | newvol |
wxVtkMPR3DView * | wxvtkmpr3Dview |
wxVtkClipping3DView * | wxvtkclipping3Dview |
Definition at line 30 of file HistogramDialog.h.
HistogramDialog::HistogramDialog | ( | wxWindow * | parent, | |
wxString | title, | |||
vtkImageData * | imageData, | |||
int | type | |||
) |
Definition at line 17 of file HistogramDialog.cxx.
References _ctfun, _tfun, cancelBtn, histogramW, ID_LOAD, ID_REFRESH, ID_SAVE, loadDataBtn, okBtn, OnLoadData(), OnRefreshBtn(), OnSaveData(), refreshBtn, refreshed, saveDataBtn, wxvtkclipping3Dview, and wxvtkmpr3Dview.
00018 :wxDialog(parent,-1,title,wxDefaultPosition,wxDefaultSize,wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE ,_T("dialogBox")) 00019 { 00020 00021 _ctfun=NULL; 00022 _tfun=NULL; 00023 00024 SetBackgroundColour(wxColour(255,255,255)); 00025 /* 00026 Pointers 00027 */ 00028 wxvtkmpr3Dview=NULL; 00029 wxvtkclipping3Dview=NULL; 00030 00031 /* 00032 Histogram 00033 */ 00034 00035 histogramW=new HistogramWidget(this, -1, wxPoint(0,0), wxSize(400,400),wxNO_BORDER ,imageData,type); 00036 00037 refreshed=false; 00038 00039 /* 00040 Buttons 00041 */ 00042 okBtn = new wxButton(this,wxID_OK ,_T("OK")); 00043 cancelBtn = new wxButton(this,wxID_CANCEL,_T("Cancel")); 00044 00045 saveDataBtn = new wxButton(this,ID_SAVE,_T("Save")); 00046 loadDataBtn = new wxButton(this,ID_LOAD,_T("Load")); 00047 refreshBtn = new wxButton(this,ID_REFRESH,_T("Refresh")); 00048 00049 Connect(saveDataBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &HistogramDialog::OnSaveData ); 00050 Connect(loadDataBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &HistogramDialog::OnLoadData ); 00051 Connect(refreshBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &HistogramDialog::OnRefreshBtn ); 00052 00053 //------------------- 00054 //GUI 00055 //------------------- 00056 00057 //Upper Box 00058 wxBoxSizer * upper_box = new wxBoxSizer( wxHORIZONTAL ); 00059 //Including components for plotter control 00060 upper_box->Add( histogramW, 4, wxGROW); 00061 00062 00063 //bottom Sizer 00064 wxBoxSizer *bottomBox = new wxBoxSizer( wxHORIZONTAL ); 00065 bottomBox->Add( okBtn, wxSizerFlags().Center()); 00066 bottomBox->AddSpacer(40); 00067 bottomBox->Add( saveDataBtn,wxSizerFlags().Center() ); 00068 bottomBox->AddSpacer(40); 00069 bottomBox->Add( loadDataBtn,wxSizerFlags().Center() ); 00070 bottomBox->AddSpacer(40); 00071 bottomBox->Add( refreshBtn,wxSizerFlags().Center() ); 00072 bottomBox->AddSpacer(40); 00073 bottomBox->Add( cancelBtn,wxSizerFlags().Center() ); 00074 //Sizer 00075 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); 00076 sizer->Add(upper_box,1,wxEXPAND); 00077 sizer->Add(bottomBox,0,wxCENTER); 00078 SetAutoLayout( TRUE ); 00079 SetSizer( sizer ); 00080 SetBestSize(wxSize(600,600)); 00081 }
HistogramDialog::HistogramDialog | ( | wxWindow * | parent, | |
wxString | title | |||
) |
Definition at line 83 of file HistogramDialog.cxx.
References _ctfun, _tfun, cancelBtn, histogramW, ID_LOAD, ID_REFRESH, ID_SAVE, loadDataBtn, okBtn, OnLoadData(), OnRefreshBtn(), OnSaveData(), refreshBtn, refreshed, saveDataBtn, wxvtkclipping3Dview, and wxvtkmpr3Dview.
00084 :wxDialog(parent,-1,title,wxDefaultPosition,wxDefaultSize,wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE ,_T("dialogBox")){ 00085 _ctfun=NULL; 00086 _tfun=NULL; 00087 00088 SetBackgroundColour(wxColour(255,255,255)); 00089 /* 00090 Pointers 00091 */ 00092 wxvtkmpr3Dview=NULL; 00093 wxvtkclipping3Dview=NULL; 00094 00095 /* 00096 Histogram 00097 */ 00098 00099 histogramW=new HistogramWidget(this, -1); 00100 00101 refreshed=false; 00102 00103 /* 00104 Buttons 00105 */ 00106 okBtn = new wxButton(this,wxID_OK ,_T("OK")); 00107 cancelBtn = new wxButton(this,wxID_CANCEL,_T("Cancel")); 00108 00109 saveDataBtn = new wxButton(this,ID_SAVE,_T("Save")); 00110 loadDataBtn = new wxButton(this,ID_LOAD,_T("Load")); 00111 refreshBtn = new wxButton(this,ID_REFRESH,_T("Refresh")); 00112 00113 Connect(saveDataBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &HistogramDialog::OnSaveData ); 00114 Connect(loadDataBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &HistogramDialog::OnLoadData ); 00115 Connect(refreshBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &HistogramDialog::OnRefreshBtn ); 00116 00117 //------------------- 00118 //GUI 00119 //------------------- 00120 00121 //Upper Box 00122 wxBoxSizer * upper_box = new wxBoxSizer( wxHORIZONTAL ); 00123 //Including components for plotter control 00124 upper_box->Add( histogramW, 4, wxGROW); 00125 00126 00127 //bottom Sizer 00128 wxBoxSizer *bottomBox = new wxBoxSizer( wxHORIZONTAL ); 00129 bottomBox->Add( okBtn, wxSizerFlags().Center()); 00130 bottomBox->AddSpacer(40); 00131 bottomBox->Add( saveDataBtn,wxSizerFlags().Center() ); 00132 bottomBox->AddSpacer(40); 00133 bottomBox->Add( loadDataBtn,wxSizerFlags().Center() ); 00134 bottomBox->AddSpacer(40); 00135 bottomBox->Add( refreshBtn,wxSizerFlags().Center() ); 00136 bottomBox->AddSpacer(40); 00137 bottomBox->Add( cancelBtn,wxSizerFlags().Center() ); 00138 //Sizer 00139 wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); 00140 sizer->Add(upper_box,1,wxEXPAND); 00141 sizer->Add(bottomBox,0,wxCENTER); 00142 SetAutoLayout( TRUE ); 00143 SetSizer( sizer ); 00144 SetBestSize(wxSize(600,600)); 00145 }
int HistogramDialog::getSizeTransferenceFunction | ( | ) |
Definition at line 415 of file HistogramDialog.cxx.
References HistogramWidget::getSizeTransferenceFunction(), and histogramW.
Referenced by wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(), and OnRefreshBtn().
00416 { 00417 return histogramW->getSizeTransferenceFunction(); 00418 00419 }
int HistogramDialog::getSizeBarColor | ( | ) |
Definition at line 423 of file HistogramDialog.cxx.
References HistogramWidget::getSizeBarColor(), and histogramW.
Referenced by wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(), wxVtkMPR3DViewCntrlPanel::OnEditColorTable(), and OnRefreshBtn().
00424 { 00425 return histogramW->getSizeBarColor(); 00426 }
void HistogramDialog::getTransferenceFunctionPoint | ( | int | index, | |
int & | x, | |||
int & | y | |||
) |
Definition at line 430 of file HistogramDialog.cxx.
References HistogramWidget::getTransferenceFunctionPoint(), and histogramW.
Referenced by wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(), and OnRefreshBtn().
00431 { 00432 histogramW->getTransferenceFunctionPoint(index,x,y); 00433 }
void HistogramDialog::getDataBarColorPoint | ( | int | index, | |
int & | x, | |||
int & | red, | |||
int & | green, | |||
int & | blue | |||
) |
Definition at line 437 of file HistogramDialog.cxx.
References HistogramWidget::getDataBarColorPoint(), and histogramW.
Referenced by wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(), wxVtkMPR3DViewCntrlPanel::OnEditColorTable(), and OnRefreshBtn().
00438 { 00439 histogramW->getDataBarColorPoint(index,x,red,green,blue); 00440 }
int HistogramDialog::getHistogramPoint | ( | int | gValue | ) |
Definition at line 445 of file HistogramDialog.cxx.
References HistogramWidget::getHistogramPoint(), and histogramW.
00446 { 00447 return histogramW->getHistogramPoint(gValue); 00448 }
float HistogramDialog::getMaxShowedPorcentage | ( | ) |
Definition at line 457 of file HistogramDialog.cxx.
References HistogramWidget::getMaxShowedPorcentage(), and histogramW.
00458 { 00459 return histogramW->getMaxShowedPorcentage(); 00460 }
float HistogramDialog::getMinShowedPorcentage | ( | ) |
Definition at line 461 of file HistogramDialog.cxx.
References HistogramWidget::getMinShowedPorcentage(), and histogramW.
00462 { 00463 return histogramW->getMinShowedPorcentage(); 00464 }
float HistogramDialog::getActualShowedPorcentage | ( | ) |
Definition at line 465 of file HistogramDialog.cxx.
References HistogramWidget::getActualShowedPorcentage(), and histogramW.
00466 { 00467 return histogramW->getActualShowedPorcentage(); 00468 }
bool HistogramDialog::addPointToTransferenceFunction | ( | double | x, | |
double | y | |||
) |
Definition at line 473 of file HistogramDialog.cxx.
References HistogramWidget::addPointToTransferenceFunction(), and histogramW.
Referenced by wxMaracasMultipleVolumeRendererPanel::createControls(), and wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions().
00474 { 00475 return histogramW->addPointToTransferenceFunction(x,y); 00476 }
bool HistogramDialog::addColorPoint | ( | double | x, | |
int | red, | |||
int | green, | |||
int | blue | |||
) |
Definition at line 477 of file HistogramDialog.cxx.
References HistogramWidget::addColorPoint(), and histogramW.
Referenced by wxMaracasMultipleVolumeRendererPanel::createControls(), wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(), and wxVtkMPR3DViewCntrlPanel::OnEditColorTable().
00478 { 00479 return histogramW->addColorPoint(x,red,green,blue); 00480 }
void HistogramDialog::erasePointsTransferenceFunction | ( | ) |
Definition at line 488 of file HistogramDialog.cxx.
References HistogramWidget::erasePointsTransferenceFunction(), and histogramW.
Referenced by wxMaracasMultipleVolumeRendererPanel::createControls(), wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(), wxVtkMPR3DViewCntrlPanel::OnEditColorTable(), and OnLoadData().
00489 { 00490 histogramW->erasePointsTransferenceFunction(); 00491 }
void HistogramDialog::eraseColorPoints | ( | ) |
Definition at line 495 of file HistogramDialog.cxx.
References HistogramWidget::eraseColorPoints(), and histogramW.
Referenced by OnLoadData().
00496 { 00497 histogramW->eraseColorPoints(); 00498 }
void HistogramDialog::setTransferenceFunctionHasPoints | ( | bool | hasPoints | ) |
Definition at line 537 of file HistogramDialog.cxx.
References histogramW, and HistogramWidget::setTransferenceFunctionHasPoints().
00538 { 00539 histogramW->setTransferenceFunctionHasPoints(hasPoints); 00540 }
void HistogramDialog::setTransferenceFunctionHasColor | ( | bool | hasColorPoints | ) |
Definition at line 541 of file HistogramDialog.cxx.
References histogramW, and HistogramWidget::setTransferenceFunctionHasColor().
00542 { 00543 histogramW->setTransferenceFunctionHasColor(hasColorPoints); 00544 }
bool HistogramDialog::getRefreshed | ( | ) |
Definition at line 514 of file HistogramDialog.cxx.
References refreshed.
Referenced by wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(), and wxVtkMPR3DViewCntrlPanel::OnEditColorTable().
00515 { 00516 return refreshed; 00517 }
void HistogramDialog::setCTF | ( | vtkColorTransferFunction * | cf | ) |
Definition at line 504 of file HistogramDialog.cxx.
References _ctfun.
Referenced by wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(), and wxVtkMPR3DViewCntrlPanel::OnEditColorTable().
00505 { 00506 _ctfun=cf; 00507 00508 }
void HistogramDialog::setTF | ( | vtkPiecewiseFunction * | tf | ) |
Definition at line 509 of file HistogramDialog.cxx.
References _tfun.
Referenced by wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions().
00510 { 00511 _tfun=tf; 00512 }
void HistogramDialog::setVolumeMapper | ( | vtkVolumeRayCastMapper * | volMapper | ) |
Definition at line 519 of file HistogramDialog.cxx.
References volumeMapper.
00520 { 00521 volumeMapper=volMapper; 00522 }
void HistogramDialog::setVolume | ( | vtkVolume * | vol | ) |
Definition at line 523 of file HistogramDialog.cxx.
References newvol.
00524 { 00525 newvol=vol; 00526 }
void HistogramDialog::setMPR3Dview | ( | wxVtkMPR3DView * | wxvtkmpr3Dview1 | ) |
Definition at line 527 of file HistogramDialog.cxx.
References wxvtkmpr3Dview.
Referenced by wxVtkMPR3DViewCntrlPanel::OnEditColorTable().
00528 { 00529 wxvtkmpr3Dview=wxvtkmpr3Dview1; 00530 }
void HistogramDialog::setClipping3DView | ( | wxVtkClipping3DView * | wxvtkclipping3Dview1 | ) |
Definition at line 531 of file HistogramDialog.cxx.
References wxvtkclipping3Dview.
Referenced by wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions().
00532 { 00533 wxvtkclipping3Dview=wxvtkclipping3Dview1; 00534 }
void HistogramDialog::updatePlotter | ( | ) |
Definition at line 549 of file HistogramDialog.cxx.
References histogramW, and HistogramWidget::updatePlotter().
00550 { 00551 histogramW->updatePlotter(); 00552 }
void HistogramDialog::OnSaveData | ( | wxCommandEvent & | event | ) |
Definition at line 151 of file HistogramDialog.cxx.
References HistogramWidget::getDataBarColorPoint(), HistogramWidget::getSizeBarColor(), HistogramWidget::getSizeTransferenceFunction(), HistogramWidget::getTransferenceFunctionPoint(), and histogramW.
Referenced by HistogramDialog().
00152 { 00153 wxString nameF=wxFileSelector(_T("Save Data"), _T(" "),_T(""),_T(""),_T("*.*"),wxSAVE, NULL, -1, -1);//wxFileSelector(_T("Save Data"),wxSAVE); 00154 std::ofstream file; 00155 if(nameF.CompareTo( _T("/0") )>0) 00156 file.open( (const char*)(nameF.mb_str()) ); 00157 00158 if(file.is_open()) 00159 { 00160 file << "<histogram Data>" << std::endl; 00161 //histograms points 00162 /* 00163 file << " <histogramPoints>" << std::endl; 00164 int histogramS=histogramW->getHistogramSize(); 00165 int i=0; 00166 while(i<histogramS) 00167 { 00168 file << " <HistogramPoint>" << std::endl; 00169 file << " <greyValue>" << i << "</greyValue>" <<std::endl; 00170 file << " <number>" << histogramW->getHistogramPoint(i) << "</number>"<<std::endl; 00171 file << " </HistogramPoint>" << std::endl; 00172 i++; 00173 } 00174 file << " </histogramPoints>" << std::endl; 00175 */ 00176 //points transference Function 00177 file << " <TransferenceFunction>"<< std::endl; 00178 int tfPointS=histogramW->getSizeTransferenceFunction(); 00179 int i=0; 00180 int gv,in; 00181 while(i<tfPointS) 00182 { 00183 00184 histogramW->getTransferenceFunctionPoint(i,gv,in); 00185 file << " <Transferencepoint>" << std::endl; 00186 file << " <greyValue>" << gv << "</greyValue>" <<std::endl; 00187 file << " <intensity>" << in << "</intensity> "<<std::endl; 00188 file << " </Transferencepoint>" << std::endl; 00189 i++; 00190 } 00191 file << " </TransferenceFunction>"<< std::endl; 00192 //colorPoints 00193 file << " <Colors>"<< std::endl; 00194 int ctfPointS=histogramW->getSizeBarColor(); 00195 00196 i=0; 00197 int red,green,blue; 00198 while(i<ctfPointS) 00199 { 00200 00201 histogramW->getDataBarColorPoint(i,gv,red,green,blue); 00202 file << " <greyValueRGBpoint>" << std::endl; 00203 file << " <RGBgreyValue>" << gv << "</RGBgreyValue>" <<std::endl; 00204 file << " <red>" << red << "</red>" <<std::endl; 00205 file << " <green>" << green << "</green>" <<std::endl; 00206 file << " <blue>" << blue << "</blue>" <<std::endl; 00207 file << " </greyValueRGBpoint>" << std::endl; 00208 i++; 00209 } 00210 00211 file << " </Colors>"<< std::endl; 00212 file << "</histogram Data>" << std::endl; 00213 } 00214 file.close(); 00215 }
void HistogramDialog::OnLoadData | ( | wxCommandEvent & | event | ) |
Definition at line 217 of file HistogramDialog.cxx.
References HistogramWidget::addColorPoint(), HistogramWidget::addPointToTransferenceFunction(), eraseColorPoints(), erasePointsTransferenceFunction(), histogramW, and HistogramWidget::updatePlotter().
Referenced by HistogramDialog().
00218 { 00219 wxString nameF=wxFileSelector(_T("Load Data") ); 00220 //std::string line; 00221 std::ifstream file; 00222 if(nameF.CompareTo( _T("/0") )>0) 00223 file.open( (const char*) (nameF.mb_str()) ); 00224 00225 bool histogramReading=false,/*histogramPoints=false,histogramPoint=false,*/tf=false,ctf=false,tfp=false,ctfp=false; // JPRx 00226 int gv=-1,in=-1,red=-1,gr=-1,bl=-1/*,nPoints=-1*/; // JPRx 00227 if(file.is_open()) 00228 { 00229 //------------- 00230 erasePointsTransferenceFunction(); 00231 eraseColorPoints(); 00232 //-------------- 00233 00234 //std::getline(file,line); 00235 //int i=0; // JPRx 00236 while(!file.eof()) 00237 { 00238 std::string line; 00239 std::getline(file,line); 00240 //int a=line.find("histogram Data"); 00241 if( (int)(line.find("histogram Data"))!=-1) 00242 { 00243 histogramReading=true; 00244 00245 } 00246 /* 00247 else if(line.find("histogramPoints")!=0 && histogramReading) 00248 { 00249 histogramPoints=true; 00250 } 00251 else if(line.find("histogramPoint")!=0 && histogramReading && histogramPoints) 00252 { 00253 00254 } 00255 else if(line.find("greyValue")!=0 && histogramReading && histogramPoints) 00256 { 00257 int pos1=line.find(">"); 00258 int pos2=line.find("<",pos+1); 00259 std::string x=line.substr(pos1+1,pos2-1); 00260 gv=atoi(x.c_str()); 00261 } 00262 else if(line.find("number")!=0 && histogramReading && histogramPoints) 00263 { 00264 int pos1=line.find(">"); 00265 int pos2=line.find("<",pos+1); 00266 std::string x=line.substr(pos1+1,pos2-1); 00267 nP=atoi(x.c_str()); 00268 //add to the histogram 00269 //histogramW->addPointToTransferenceFunction(gc,in); 00270 } 00271 */ 00272 else if( (int)(line.find("TransferenceFunction"))!=-1 && histogramReading) 00273 { 00274 tf=true; 00275 } 00276 else if( (int)(line.find("<Transferencepoint>"))!=-1 && histogramReading && tf) 00277 { 00278 tfp=true; 00279 } 00280 else if( (int)(line.find("greyValue"))!=-1 && histogramReading && tf && tfp) 00281 { 00282 int pos1=line.find(">"); 00283 int pos2=line.find("<",pos1+1); 00284 std::string x=line.substr(pos1+1,pos2-pos1-1); 00285 gv=atoi(x.c_str()); 00286 00287 } 00288 else if( (int)(line.find("intensity"))!=-1 && histogramReading && tf && tfp) 00289 { 00290 int pos1=line.find(">"); 00291 int pos2=line.find("<",pos1+1); 00292 std::string x=line.substr(pos1+1,pos2-pos1-1); 00293 in=atoi(x.c_str()); 00294 histogramW->addPointToTransferenceFunction(gv,in); 00295 tfp=false; 00296 00297 } 00298 else if( (int)(line.find("Colors"))!=-1 && histogramReading) 00299 { 00300 ctf=true; 00301 } 00302 00303 else if( (int)(line.find("greyValueRGBpoint"))!=-1 && histogramReading && ctf ) 00304 { 00305 ctfp=true; 00306 00307 } 00308 else if( (int)(line.find("RGBgreyValue"))!=-1 && histogramReading && ctf && ctfp) 00309 { 00310 int pos1=line.find(">"); 00311 int pos2=line.find("<",pos1+1); 00312 std::string x=line.substr(pos1+1,pos2-pos1-1); 00313 gv=atoi(x.c_str()); 00314 00315 } 00316 else if( (int)(line.find("red"))!=-1 && histogramReading && ctf && ctfp) 00317 { 00318 int pos1=line.find(">"); 00319 int pos2=line.find("<",pos1+1); 00320 std::string x=line.substr(pos1+1,pos2-pos1-1); 00321 red=atoi(x.c_str()); 00322 00323 } 00324 else if( (int)(line.find("green"))!=-1 && histogramReading && ctf && ctfp) 00325 { 00326 int pos1=line.find(">"); 00327 int pos2=line.find("<",pos1+1); 00328 std::string x=line.substr(pos1+1,pos2-pos1-1); 00329 gr=atoi(x.c_str()); 00330 } 00331 else if( (int)(line.find("blue"))!=-1 && histogramReading && ctf && ctfp) 00332 { 00333 int pos1=line.find(">"); 00334 int pos2=line.find("<",pos1+1); 00335 std::string x=line.substr(pos1+1,pos2-pos1-1); 00336 bl=atoi(x.c_str()); 00337 histogramW->addColorPoint(gv,red,gr,bl); 00338 ctfp=false; 00339 } 00340 line.clear(); 00341 } 00342 } 00343 00344 file.close(); 00345 histogramW->updatePlotter(); 00346 }
void HistogramDialog::OnRefreshBtn | ( | wxCommandEvent & | event | ) |
Definition at line 351 of file HistogramDialog.cxx.
References _ctfun, _tfun, getDataBarColorPoint(), getSizeBarColor(), getSizeTransferenceFunction(), getTransferenceFunctionPoint(), wxVtkMPR3DView::Refresh(), wxVtkClipping3DView::Refresh(), refreshed, wxvtkclipping3Dview, and wxvtkmpr3Dview.
Referenced by HistogramDialog().
00352 { 00353 refreshed=true; 00354 00355 int i=0,xi,yi,r,g,b; 00356 00357 // -- TransferenceFunction -- 00358 int nPointsTF=getSizeTransferenceFunction(); 00359 00360 if(nPointsTF>0) 00361 { 00362 00363 int nTFPoints=getSizeTransferenceFunction(); 00364 i=0; 00365 while(i<nTFPoints) 00366 { 00367 getTransferenceFunctionPoint(i,xi,yi); 00368 _tfun->AddPoint( xi , yi/100.0 ); 00369 i++; 00370 } 00371 } 00372 //-- Color bar -- 00373 //clean colors 00374 int nPointsCTF=getSizeBarColor(); 00375 if(nPointsCTF>0) 00376 { 00377 _ctfun->RemoveAllPoints(); 00378 00379 int nCTFpoints=getSizeBarColor(); 00380 i=0; 00381 while(i<nCTFpoints) 00382 { 00383 getDataBarColorPoint(i,xi,r,g,b); 00384 _ctfun->AddRGBPoint(xi,r/255.0,g/255.0,b/255.0 ); 00385 i++; 00386 } 00387 } 00388 00389 //EED Borrame 00390 00391 /* 00392 NOTE I NEED THE UPDATE 00393 */ 00394 //if it was call from the clipping ctnrl panel 00395 if(wxvtkclipping3Dview!=NULL) 00396 { 00397 wxvtkclipping3Dview->Refresh(); 00398 00399 } 00400 else if(wxvtkmpr3Dview!=NULL) 00401 { 00402 wxvtkmpr3Dview->Refresh(); 00403 00404 } 00405 }
void HistogramDialog::initializeHistogram | ( | vtkImageData * | img | ) |
Initialize the histogram
Definition at line 558 of file HistogramDialog.cxx.
References histogramW, and HistogramWidget::initializeHistogram().
Referenced by wxMaracasMultipleVolumeRendererPanel::createControls().
00558 { 00559 histogramW->initializeHistogram(img); 00560 }
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 564 of file HistogramDialog.cxx.
References HistogramWidget::GetValuesPointsFunction(), and histogramW.
Referenced by wxMaracasMultipleVolumeRendererPanel::updateVolume().
00564 { 00565 00566 histogramW->GetValuesPointsFunction(greylevel, value); 00567 }
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 573 of file HistogramDialog.cxx.
References HistogramWidget::GetValuesColorPointsFunction(), and histogramW.
Referenced by wxMaracasMultipleVolumeRendererPanel::updateVolume().
00577 { 00578 histogramW->GetValuesColorPointsFunction(greylevel, red, green, blue); 00579 }
void HistogramDialog::SetFunctions | ( | vtkPiecewiseFunction * | _opac, | |
vtkColorTransferFunction * | _color | |||
) |
Definition at line 581 of file HistogramDialog.cxx.
Referenced by wxMaracasMultipleVolumeRendererPanel::createControls().
HistogramWidget* HistogramDialog::histogramW [private] |
Definition at line 154 of file HistogramDialog.h.
Referenced by addColorPoint(), addPointToTransferenceFunction(), eraseColorPoints(), erasePointsTransferenceFunction(), getActualShowedPorcentage(), getDataBarColorPoint(), getHistogramPoint(), getMaxShowedPorcentage(), getMinShowedPorcentage(), getSizeBarColor(), getSizeTransferenceFunction(), getTransferenceFunctionPoint(), GetValuesColorPointsFunction(), GetValuesPointsFunction(), HistogramDialog(), initializeHistogram(), OnLoadData(), OnSaveData(), setTransferenceFunctionHasColor(), setTransferenceFunctionHasPoints(), and updatePlotter().
wxButton* HistogramDialog::okBtn [private] |
wxButton* HistogramDialog::cancelBtn [private] |
wxButton* HistogramDialog::saveDataBtn [private] |
wxButton* HistogramDialog::loadDataBtn [private] |
wxButton* HistogramDialog::refreshBtn [private] |
bool HistogramDialog::refreshed [private] |
Definition at line 180 of file HistogramDialog.h.
Referenced by getRefreshed(), HistogramDialog(), and OnRefreshBtn().
vtkColorTransferFunction* HistogramDialog::_ctfun [private] |
Definition at line 182 of file HistogramDialog.h.
Referenced by HistogramDialog(), OnRefreshBtn(), setCTF(), and SetFunctions().
vtkPiecewiseFunction* HistogramDialog::_tfun [private] |
Definition at line 183 of file HistogramDialog.h.
Referenced by HistogramDialog(), OnRefreshBtn(), SetFunctions(), and setTF().
vtkVolumeRayCastMapper* HistogramDialog::volumeMapper [private] |
vtkVolume* HistogramDialog::newvol [private] |
wxVtkMPR3DView* HistogramDialog::wxvtkmpr3Dview [private] |
Definition at line 188 of file HistogramDialog.h.
Referenced by HistogramDialog(), OnRefreshBtn(), and setMPR3Dview().
Definition at line 189 of file HistogramDialog.h.
Referenced by HistogramDialog(), OnRefreshBtn(), and setClipping3DView().