X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FInterface_Icons_NDimensions%2FinterfSegmentationPanels.cxx;h=46fb279043e0fdc75f50db7f168d8eabe252f071;hb=7ef64acb00d37e665e0bf019b9a7ede2495bf155;hp=995344bcf3f31d432af84dd01fa56fdb003e436c;hpb=507a00d9d7800568d6e8ae91905f2b07cd2b30ae;p=creaContours.git diff --git a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx index 995344b..46fb279 100644 --- a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx +++ b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx @@ -30,17 +30,15 @@ interfSegmentationPanelVTK::interfSegmentationPanelVTK(wxWindow * parent) : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) { int sizeZ = interfMainPanel::getInstance()->GetImageDataSizeZ(); - double range[2]; interfMainPanel::getInstance()->getImageRange(range); - int min = (int)floor (range[0]); int max = (int)ceil (range[1]); wxButton *segmentationOneSliceBtn = new wxButton(this,-1,_T("Current slice"), wxDefaultPosition, wxSize(200,35) ); wxButton *segmentationAllSliceBtn = new wxButton(this,-1,_T("All slices") ,wxDefaultPosition, wxSize(200,35) ); - _isovalue = new wxSlider(this, -1, 40 , min, max, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); - _sampling = new wxSlider(this, -1, 20 , 4, 50, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); + _isovalue = new wxSlider(this, -1, 40 , min, max, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); + _sampling = new wxSlider(this, -1, 20 , 4, 50, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); wxString lstOptions[3]; lstOptions[0]=_T("A"); lstOptions[1]=_T("B"); @@ -48,11 +46,9 @@ interfSegmentationPanelVTK::interfSegmentationPanelVTK(wxWindow * parent) methodRadiobox = new wxRadioBox(this, -1, _T("Method (find ctrl. Points)"), wxDefaultPosition, wxSize(200,45), 3 , lstOptions, 3, wxRA_SPECIFY_COLS); methodRadiobox->SetSelection(2); _staticTextSegmentation = new wxStaticText(this,-1,_T(" ")); - _mbarrange = new mBarRange(this,70, 65); _mbarrange->SetMin(0); _mbarrange->SetStart(0); - _mbarrange->SetOrientation( true ); _mbarrange->setActiveStateTo(true); _mbarrange->setVisibleLabels( true ); @@ -62,8 +58,7 @@ interfSegmentationPanelVTK::interfSegmentationPanelVTK(wxWindow * parent) _mbarrange->setIfWithActualDrawed( false ); _mbarrange->SetStart( 0 ); _mbarrange->SetEnd( sizeZ ); - - wxFlexGridSizer * sizer = new wxFlexGridSizer(1); + wxFlexGridSizer * sizer = new wxFlexGridSizer(20,1,0,0); sizer->Add( new wxStaticText(this, -1, _T("Isovalue (Gray level)")), 1, wxGROW ); sizer->Add( _isovalue, 1, wxGROW ); sizer->Add( methodRadiobox , 1, wxGROW ); @@ -74,13 +69,9 @@ interfSegmentationPanelVTK::interfSegmentationPanelVTK(wxWindow * parent) sizer->Add( _staticTextSegmentation, 1, wxGROW ); sizer->Add( segmentationAllSliceBtn, 1, wxGROW ); sizer->Add( _mbarrange, 1, wxGROW ); - this->SetSizer( sizer ); -// panel->SetSize( sizePanel ); - this->SetSize( wxDefaultSize ); this->SetAutoLayout( true ); this->Layout(); - //_segmentationFrame->SetEventHandler( this ); //segmentationOneSliceBtn->SetEventHandler( this ); //segmentationAllSliceBtn->SetEventHandler( this ); @@ -89,7 +80,6 @@ interfSegmentationPanelVTK::interfSegmentationPanelVTK(wxWindow * parent) Connect( segmentationAllSliceBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) &interfSegmentationPanelVTK::onSegmentationAllSlice); } - interfSegmentationPanelVTK::~interfSegmentationPanelVTK() { } @@ -108,9 +98,7 @@ void interfSegmentationPanelVTK::onSegmentationPressedITK(wxCommandEvent& event wxFlexGridSizer* flexsizer = new wxFlexGridSizer(1); segmentPanelITK->SetSizer(flexsizer, true); segmentPanelITK->SetAutoLayout( true ); - wxPanel* panel = new wxPanel(this, -1);//contourevent->getSegmentationPanelITK(segmentPanelITK); - wxStaticText* stattext = new wxStaticText(segmentPanelITK, -1, wxString(_T(" Automatic ITK Segmentation ")), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE|wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE, wxString(_T(""))); @@ -129,23 +117,23 @@ void interfSegmentationPanelVTK::onSegmentationOneSlice( wxCommandEvent& event ) int sampling = _sampling->GetValue(); int method = methodRadiobox->GetSelection(); interfMainPanel::getInstance()->onSegmentationOneSlice(isovalue, sampling, method); - } + void interfSegmentationPanelVTK::onSegmentationAllSlice( wxCommandEvent& event ) { int minZ=_mbarrange->GetStart(); int maxZ=_mbarrange->GetEnd(); - int isovalue = _isovalue->GetValue(); int sampling = _sampling->GetValue(); int method = methodRadiobox->GetSelection(); - interfMainPanel::getInstance()->onSegmentationAllSlice(minZ, maxZ, isovalue, sampling, method); } -void interfSegmentationPanelVTK::setLabel(wxString tmpString){ +void interfSegmentationPanelVTK::setLabel(wxString tmpString) +{ _staticTextSegmentation->SetLabel(tmpString); } + /** ** start of new implementation ** interfSegmentationPanelITK @@ -155,10 +143,8 @@ interfSegmentationPanelITK::interfSegmentationPanelITK(wxWindow * parent) { double range[2]; interfMainPanel::getInstance()->getImageRange(range); - // int min = (int)floor (range[0]); // int max = (int)ceil (range[1]); - //The labels //wxStaticText * distance = new wxStaticText(this, wxID_ANY, wxT("Initial Distance"), wxPoint(5, 5)); @@ -174,9 +160,7 @@ interfSegmentationPanelITK::interfSegmentationPanelITK(wxWindow * parent) new wxStaticText(this, wxID_ANY, wxT("Iterations"), wxPoint(5, 130)); //wxStaticText * infStrength = new wxStaticText(this, wxID_ANY, wxT("Inflation Strength"), wxPoint(5, 155)); - //Text Controls - _distance = new wxTextCtrl(this, wxID_ANY, wxT("5.0"), wxPoint(98,5), wxSize(80, 20), 0, wxDefaultValidator, wxTextCtrlNameStr); _sigma = new wxTextCtrl(this, wxID_ANY, wxT("1.2"), wxPoint(98,30), wxSize(80, 20), 0, wxDefaultValidator, wxTextCtrlNameStr); _alfa = new wxTextCtrl(this, wxID_ANY, wxT("-1.0"), wxPoint(98,55), wxSize(80, 20), 0, wxDefaultValidator, wxTextCtrlNameStr); @@ -184,46 +168,37 @@ interfSegmentationPanelITK::interfSegmentationPanelITK(wxWindow * parent) _propagation = new wxTextCtrl(this, wxID_ANY, wxT("6.0"), wxPoint(98,105), wxSize(80, 20), 0, wxDefaultValidator, wxTextCtrlNameStr); _iterations = new wxTextCtrl(this, wxID_ANY, wxT("800"), wxPoint(98,130), wxSize(80, 20), 0, wxDefaultValidator, wxTextCtrlNameStr); _infStrength = new wxTextCtrl(this, wxID_ANY, wxT("3.0"), wxPoint(98,155), wxSize(80, 20), 0, wxDefaultValidator, wxTextCtrlNameStr); - //El boton //wxButton * bot = new wxButton(this, 6, wxT("One Slice"), wxPoint(98, 180), wxSize(70, 25), 0, wxDefaultValidator, wxT("button")); - //Conexion del boton con su respectivo manejador Connect(6, wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction) &interfSegmentationPanelITK::onSegmentationOneSlice); - - } -interfSegmentationPanelITK::~interfSegmentationPanelITK(){ +interfSegmentationPanelITK::~interfSegmentationPanelITK() +{ } void interfSegmentationPanelITK::onSegmentationOneSlice( wxCommandEvent& event ) { - wxString distanc=_distance->GetValue(); - wxString sigm=_sigma->GetValue(); - wxString alf=_alfa->GetValue(); - wxString bet=_beta->GetValue(); - wxString prop=_propagation->GetValue(); - wxString iter=_iterations->GetValue(); - wxString infS=_infStrength->GetValue(); - + wxString distanc = _distance->GetValue(); + wxString sigm = _sigma->GetValue(); + wxString alf = _alfa->GetValue(); + wxString bet = _beta->GetValue(); + wxString prop = _propagation->GetValue(); + wxString iter = _iterations->GetValue(); + wxString infS = _infStrength->GetValue(); interfMainPanel::getInstance()->onSegmentationOneSliceITK(distanc, sigm, alf, bet, prop, iter, infS); - } + void interfSegmentationPanelITK::onSegmentationAllSlice( wxCommandEvent& event ) { - /*int minZ=_mbarrange->GetStart(); int maxZ=_mbarrange->GetEnd(); - int isovalue = _isovalue->GetValue(); int sampling = _sampling->GetValue(); int method = methodRadiobox->GetSelection(); - - interfMainPanel::getInstance()->onSegmentationAllSlice(minZ, maxZ, isovalue, sampling, method);*/ - } //------------------------------------------------------------------------------------------------------------ @@ -237,39 +212,33 @@ interfMirrorPanel::interfMirrorPanel(wxWindow* parent) : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) { _axisStatus = true; - wxButton *axisShowBtn = new wxButton(this,wxID_ANY,_T("Show/Hide Axis"), wxDefaultPosition, wxSize(200,35) ); wxButton *mirrorGoBtn = new wxButton(this,wxID_ANY,_T("Mirror Contour"), wxDefaultPosition, wxSize(200,35) ); _thickness = new wxSlider(this, -1, 4, 1, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); - Connect( axisShowBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfMirrorPanel::onAxisShow ); Connect( mirrorGoBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfMirrorPanel::onMirrorGo ); - - wxFlexGridSizer * sizer = new wxFlexGridSizer(1); + wxFlexGridSizer * sizer = new wxFlexGridSizer(20,1,0,0); sizer -> Add( axisShowBtn, 1, wxGROW ); sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW ); sizer -> Add( new wxStaticText(this,-1,_T("Thickness")) , 1, wxGROW ); sizer -> Add( _thickness, 1, wxGROW ); sizer -> Add( mirrorGoBtn, 1, wxGROW ); - this->SetSizer( sizer ); this->SetAutoLayout( true ); this->Layout(); } -interfMirrorPanel::~interfMirrorPanel(){ +interfMirrorPanel::~interfMirrorPanel() +{ } void interfMirrorPanel::onAxisShow(wxCommandEvent& event) { - if (!_axisStatus) { interfMainPanel::getInstance()->onMirrorAxisShow(); _axisStatus=true; - } - else - { + } else { interfMainPanel::getInstance()->onMirrorAxisHide(); _axisStatus=false; } @@ -290,30 +259,23 @@ void interfMirrorPanel::onChangeWidth(wxScrollEvent& event) } - - - - - BEGIN_EVENT_TABLE(interfMirrorPanel, wxPanel) EVT_SCROLL(interfMirrorPanel :: onChangeWidth) END_EVENT_TABLE() + ////////////////////////////////////////////////////////////// interfTestPanel::interfTestPanel(wxWindow* parent) : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) { wxButton *button1 = new wxButton(this,wxID_ANY,_T("Button 1"), wxDefaultPosition, wxSize(200,35) ); - wxButton *button2 = new wxButton(this,wxID_ANY,_T("Button 2"), wxDefaultPosition, wxSize(200,35) ); - + wxButton *button2 = new wxButton(this,wxID_ANY,_T("Button 2"), wxDefaultPosition, wxSize(200,35) ); Connect( button1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfTestPanel::onButton1Pressed ); Connect( button2->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfTestPanel::onButton2Pressed ); - - wxFlexGridSizer * sizer = new wxFlexGridSizer(1); + wxFlexGridSizer * sizer = new wxFlexGridSizer(20); sizer -> Add( button1, 1, wxGROW ); sizer -> Add( button2, 1, wxGROW ); - this->SetSizer( sizer ); this->SetAutoLayout( true ); this->Layout(); @@ -331,3 +293,7 @@ void interfTestPanel::onButton2Pressed(wxCommandEvent& event) { std::cout << "Button 2 has been pressed" << std::endl; } + + + +