X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FpPlotter%2FHistogramDialogComboBox.cxx;h=4730763c14a87ca48b1c1c69414c7d7a683c04eb;hb=24937478048aca664712bb708240bff79879e0d9;hp=f3586470487e8fa0a41d04224efc243715d2da74;hpb=acfa60fa044ebc12067c4daba555d18c7d66b2d5;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialogComboBox.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialogComboBox.cxx index f358647..4730763 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialogComboBox.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialogComboBox.cxx @@ -11,7 +11,7 @@ HistogramDialogComboBox::HistogramDialogComboBox(wxWindow* parent) : wxPanel(parent) { - _img = NULL; + _img = NULL; _bitmapcombo = NULL; _slidercolor = NULL; _sliderwindowlevel = NULL; @@ -19,10 +19,15 @@ HistogramDialogComboBox::HistogramDialogComboBox(wxWindow* parent) _bitmapsizer = NULL; this->SetSizer(getBitmapCombo()); - _img = NULL; + _img = NULL; _currentitem = -1; _maxgreyvalue = 0; printf("EED HistogramDialogComboBox\n"); +#ifdef LINUX + std::string currentpath = crea::System::GetExecutablePath(); + currentpath.append("/data/"); + crea::System::createDirectory(currentpath.c_str()); +#endif } HistogramDialogComboBox::~HistogramDialogComboBox() @@ -52,7 +57,6 @@ wxSizer* HistogramDialogComboBox::getBitmapCombo() comboeditsizer->Add(_bitmapcombo,wxSizerFlags().Center().FixedMinSize()); comboeditsizer->Add(edit,wxSizerFlags().Center()); - _bitmapsizer->Add(comboeditsizer,wxSizerFlags().FixedMinSize().Center()); _bitmapsizer->AddSpacer(5); _bitmapsizer->Add(getSlidersWlCo(),wxSizerFlags().Expand().Center()); @@ -60,7 +64,8 @@ wxSizer* HistogramDialogComboBox::getBitmapCombo() return _bitmapsizer; } -wxSizer* HistogramDialogComboBox::getSlidersWlCo(){ +wxSizer* HistogramDialogComboBox::getSlidersWlCo() +{ wxBoxSizer* sizersliders = new wxBoxSizer(wxVERTICAL); _slidercolor = new wxSlider(this, -1,1,0,1,wxDefaultPosition,wxDefaultSize,wxSL_LABELS); @@ -69,7 +74,7 @@ wxSizer* HistogramDialogComboBox::getSlidersWlCo(){ sizersliders->Add(_slidercolor,wxSizerFlags().Expand().Center()); sizersliders->Add(_sliderwindowlevel,wxSizerFlags().Expand().Center()); - Connect(_slidercolor->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction)&HistogramDialogComboBox::OnColorLevelChanged); + Connect(_slidercolor->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction)&HistogramDialogComboBox::OnColorLevelChanged); Connect(_sliderwindowlevel->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction)&HistogramDialogComboBox::OnWindowLevelChanged); return sizersliders; @@ -77,39 +82,39 @@ wxSizer* HistogramDialogComboBox::getSlidersWlCo(){ double HistogramDialogComboBox::GetWindowLevel() { - if(_sliderwindowlevel != NULL) - { - return _sliderwindowlevel->GetValue(); - } + double val(0.0); + if(_sliderwindowlevel != NULL) + val= _sliderwindowlevel->GetValue(); + return val; // JPR } double HistogramDialogComboBox::GetColorLevel() { - if(_slidercolor != NULL) - { - return _slidercolor->GetValue(); - } + double val(0.0); + if(_slidercolor != NULL) + val = _slidercolor->GetValue(); + return val; // JPR } void HistogramDialogComboBox::OnColorLevelChanged(wxCommandEvent& event) { - _slidercolor->GetValue(); - wxCommandEvent newevent(wxEVT_SCROLL_THUMBTRACK,this->GetId()); - ProcessEvent(newevent); + _slidercolor->GetValue(); + wxCommandEvent newevent(wxEVT_SCROLL_THUMBTRACK,this->GetId()); + ProcessEvent(newevent); } void HistogramDialogComboBox::OnWindowLevelChanged(wxCommandEvent& event) { - _sliderwindowlevel->GetValue(); - wxCommandEvent newevent(wxEVT_SCROLL_THUMBTRACK,this->GetId()); - ProcessEvent(newevent); + _sliderwindowlevel->GetValue(); + wxCommandEvent newevent(wxEVT_SCROLL_THUMBTRACK,this->GetId()); + ProcessEvent(newevent); } void HistogramDialogComboBox::setImageData(vtkImageData* img) { - _maxgreyvalue = img->GetScalarRange()[1]; - _img = img; - setSlidersValue(); + _maxgreyvalue = img->GetScalarRange()[1]; + _img = img; + setSlidersValue(); } void HistogramDialogComboBox::setSlidersValue() @@ -127,7 +132,7 @@ void HistogramDialogComboBox::setSlidersValue() } void HistogramDialogComboBox::OnEditBitmapCombo(wxCommandEvent& event) -{ +{ if(_img!=NULL) { bool createaddandremovecontrols = true; @@ -137,12 +142,20 @@ void HistogramDialogComboBox::OnEditBitmapCombo(wxCommandEvent& event) if(dialog->ShowModal()==wxID_OK) { - dialog->UpdateCurrentComboElement(); _bitmapsitems = dialog->getComboBoxItems(); - - std::string currentpath = crea::System::GetDllAppPath("bbcreaMaracasVisu"); + //std::string currentpath = crea::System::GetDllAppPath("bbcreaMaracasVisu"); // JPR + std::string dllLastName; + std::string currentpath; + #ifdef WIN32 + dllLastName = "bbcreaMaracasVisu"; + currentpath = crea::System::GetDllAppPath(dllLastName); + #endif + #ifdef LINUX + currentpath = crea::System::GetExecutablePath(); + currentpath.append("/data/"); + #endif currentpath.append(FILENAME); std::vector redvect,greenvect,bluevect; @@ -226,6 +239,10 @@ wxBitmapComboBox* HistogramDialogComboBox::getBitmapComboElements() std::string currentpath = ""; #ifdef WIN32 currentpath = crea::System::GetDllAppPath("bbcreaMaracasVisu"); +#endif +#ifdef LINUX + currentpath = crea::System::GetExecutablePath(); + currentpath.append("/data/"); #endif currentpath.append(FILENAME); @@ -301,81 +318,81 @@ void HistogramDialogComboBox::OnLoadComboBoxData(std::vector")!=-1)) - { - item = new HistogramDialogComboBoxItem(); - }else if((int)(line.find(""))!=-1){ - int pos1=line.find(">"); - int pos2=line.find("<",pos1+1); - std::string x=line.substr(pos1+1,pos2-pos1-1); - gvtransfer=atof(x.c_str()); - greyvecttransfunct.push_back(gvtransfer); - }else if((int)(line.find(""))!=-1){ - int pos1=line.find(">"); - int pos2=line.find("<",pos1+1); - std::string x=line.substr(pos1+1,pos2-pos1-1); - intensity=atof(x.c_str()); - value.push_back(intensity); - } - else if( (int)(line.find(""))!=-1) - { - int pos1=line.find(">"); - int pos2=line.find("<",pos1+1); - std::string x=line.substr(pos1+1,pos2-pos1-1); - gv=atof(x.c_str()); - greyvect.push_back(gv); - } - else if( (int)(line.find(""))!=-1) - { - int pos1=line.find(">"); - int pos2=line.find("<",pos1+1); - std::string x=line.substr(pos1+1,pos2-pos1-1); - red=atof(x.c_str()); - redvect.push_back(red); - } - else if( (int)(line.find(""))!=-1) - { - int pos1=line.find(">"); - int pos2=line.find("<",pos1+1); - std::string x=line.substr(pos1+1,pos2-pos1-1); - gr=atof(x.c_str()); - greenvect.push_back(gr); - } - else if( (int)(line.find(""))!=-1 ) - { - int pos1=line.find(">"); - int pos2=line.find("<",pos1+1); - std::string x=line.substr(pos1+1,pos2-pos1-1); - bl=atof(x.c_str()); - bluevect.push_back(bl); + { + item = new HistogramDialogComboBoxItem(); + }else if((int)(line.find(""))!=-1) { + int pos1=line.find(">"); + int pos2=line.find("<",pos1+1); + std::string x=line.substr(pos1+1,pos2-pos1-1); + gvtransfer=atof(x.c_str()); + greyvecttransfunct.push_back(gvtransfer); + }else if((int)(line.find(""))!=-1) { + int pos1=line.find(">"); + int pos2=line.find("<",pos1+1); + std::string x=line.substr(pos1+1,pos2-pos1-1); + intensity=atof(x.c_str()); + value.push_back(intensity); + } + else if( (int)(line.find(""))!=-1) + { + int pos1=line.find(">"); + int pos2=line.find("<",pos1+1); + std::string x=line.substr(pos1+1,pos2-pos1-1); + gv=atof(x.c_str()); + greyvect.push_back(gv); + } + else if( (int)(line.find(""))!=-1) + { + int pos1=line.find(">"); + int pos2=line.find("<",pos1+1); + std::string x=line.substr(pos1+1,pos2-pos1-1); + red=atof(x.c_str()); + redvect.push_back(red); + } + else if( (int)(line.find(""))!=-1) + { + int pos1=line.find(">"); + int pos2=line.find("<",pos1+1); + std::string x=line.substr(pos1+1,pos2-pos1-1); + gr=atof(x.c_str()); + greenvect.push_back(gr); + } + else if( (int)(line.find(""))!=-1 ) + { + int pos1=line.find(">"); + int pos2=line.find("<",pos1+1); + std::string x=line.substr(pos1+1,pos2-pos1-1); + bl=atof(x.c_str()); + bluevect.push_back(bl); - }else if( (int)(line.find(""))!=-1 ){ + }else if( (int)(line.find(""))!=-1 ) { - item->SetColors(greyvect,redvect,greenvect,bluevect); - item->SetTransferFunction(greyvecttransfunct,value); - /*for(int i = 0; i < greyvecttransfunct.size();i++){ + item->SetColors(greyvect,redvect,greenvect,bluevect); + item->SetTransferFunction(greyvecttransfunct,value); + /*for(int i = 0; i < greyvecttransfunct.size();i++){ std::cout<<"HistogramDialogComboBox::OnLoadComboBoxData("<& greylevel,std::vector& value) { - for(int i = 0; i < _greyvecttransfer.size();i++){ + for(int i = 0; i < _greyvecttransfer.size();i++) { greylevel.push_back(_greyvecttransfer[i]*_maxgreyvalue); value.push_back(_value[i]); } @@ -399,7 +416,7 @@ void HistogramDialogComboBox::GetValuesColorPointsFunction(std::vector& std::vector& green, std::vector& blue) { - for(int i = 0; i < _greyvect.size();i++){ + for(int i = 0; i < _greyvect.size();i++) { greylevel.push_back(_greyvect[i]*_maxgreyvalue); red.push_back(_redvect[i]); green.push_back(_greenvect[i]);