X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FInterface_Icons_NDimensions%2FinterfSegmentationPanels.cxx;h=04f8fd86e57980500516df105b5e49ed740bbaba;hb=11f6d82d938648eb1b5ee5321c8a0c797b20606e;hp=feea22133a9ef91dce437639b3b2a1b7b05b7321;hpb=ff6d06534aba33daee30bbacbcb73cbb35dcbb48;p=creaContours.git diff --git a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx index feea221..04f8fd8 100644 --- a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx +++ b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx @@ -5,14 +5,16 @@ interfSegmentationPanelVTK::interfSegmentationPanelVTK(wxWindow * parent) : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) { int sizeZ = interfMainPanel::getInstance()->GetImageDataSizeZ(); - //int sizeZ = _theViewPanel->getSceneManager()->GetImageDataSizeZ(); + double range[2]; - //_theViewPanel->getSceneManager()->GetImageDataRange(range); - interfMainPanel::getInstance()->GetImageDataRange(range); + 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 , (int)(range[0]), (int)(range[1]), wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); + _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); wxString lstOptions[3]; lstOptions[0]=_T("A"); @@ -22,7 +24,7 @@ interfSegmentationPanelVTK::interfSegmentationPanelVTK(wxWindow * parent) methodRadiobox->SetSelection(2); _staticTextSegmentation = new wxStaticText(this,-1,_T(" ")); - _mbarrange = new mBarRange(this,70, 65); + _mbarrange = new mBarRange(this,70, 65); _mbarrange->SetMin(0); _mbarrange->SetStart(0); @@ -126,20 +128,27 @@ void interfSegmentationPanelVTK::setLabel(wxString tmpString){ interfSegmentationPanelITK::interfSegmentationPanelITK(wxWindow * parent) : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) { - int sizeZ = interfMainPanel::getInstance()->GetImageDataSizeZ(); - //int sizeZ = _theViewPanel->getSceneManager()->GetImageDataSizeZ(); double range[2]; - //_theViewPanel->getSceneManager()->GetImageDataRange(range); - interfMainPanel::getInstance()->GetImageDataRange(range); + 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)); - wxStaticText * sigma = new wxStaticText(this, wxID_ANY, wxT("Sigma"), wxPoint(5, 30)); - wxStaticText * alfa = new wxStaticText(this, wxID_ANY, wxT("Sigmoid Alfa"), wxPoint(5, 55)); - wxStaticText * beta = new wxStaticText(this, wxID_ANY, wxT("Sigmoid Beta"), wxPoint(5, 80)); - wxStaticText * propagation = new wxStaticText(this, wxID_ANY, wxT("Propagation Scaling"),wxPoint(5, 105)); - wxStaticText * iterations = new wxStaticText(this, wxID_ANY, wxT("Iterations"), wxPoint(5, 130)); - wxStaticText * infStrength = new wxStaticText(this, wxID_ANY, wxT("Inflation Strength"), wxPoint(5, 155)); + //wxStaticText * distance = + new wxStaticText(this, wxID_ANY, wxT("Initial Distance"), wxPoint(5, 5)); + //wxStaticText * sigma = + new wxStaticText(this, wxID_ANY, wxT("Sigma"), wxPoint(5, 30)); + //wxStaticText * alfa = + new wxStaticText(this, wxID_ANY, wxT("Sigmoid Alfa"), wxPoint(5, 55)); + //wxStaticText * beta = + new wxStaticText(this, wxID_ANY, wxT("Sigmoid Beta"), wxPoint(5, 80)); + //wxStaticText * propagation = + new wxStaticText(this, wxID_ANY, wxT("Propagation Scaling"),wxPoint(5, 105)); + //wxStaticText * iterations = + 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 @@ -152,7 +161,8 @@ interfSegmentationPanelITK::interfSegmentationPanelITK(wxWindow * parent) _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")); + //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); @@ -190,5 +200,76 @@ void interfSegmentationPanelITK::onSegmentationAllSlice( wxCommandEvent& event ) interfMainPanel::getInstance()->onSegmentationAllSlice(minZ, maxZ, isovalue, sampling, method);*/ } + //------------------------------------------------------------------------------------------------------------ + +/** +** Begin of the mirror panel +**/ + +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); + 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(){ +} + +void interfMirrorPanel::onAxisShow(wxCommandEvent& event) +{ + + if (!_axisStatus) + { + interfMainPanel::getInstance()->onMirrorAxisShow(); + _axisStatus=true; + } + else + { + interfMainPanel::getInstance()->onMirrorAxisHide(); + _axisStatus=false; + } +} + +void interfMirrorPanel::onMirrorGo(wxCommandEvent& event) +{ + if (_axisStatus) + { + interfMainPanel::getInstance()->onMirror(); + } +} + +void interfMirrorPanel::onChangeWidth(wxScrollEvent& event) +{ + int width = _thickness->GetValue(); + interfMainPanel::getInstance()->onMirrorChangeWidth(width); +} + + + + + + + +BEGIN_EVENT_TABLE(interfMirrorPanel, wxPanel) +EVT_SCROLL(interfMirrorPanel :: onChangeWidth) +END_EVENT_TABLE()