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=a71b57fdb362964a09c2a6bf982ba0104c96f636;hpb=4869f867cf8247c1c3432efa8d483899991eae30;p=creaContours.git diff --git a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx index a71b57f..04f8fd8 100644 --- a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx +++ b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx @@ -131,8 +131,8 @@ interfSegmentationPanelITK::interfSegmentationPanelITK(wxWindow * parent) double range[2]; interfMainPanel::getInstance()->getImageRange(range); - int min = (int)floor (range[0]); - int max = (int)ceil (range[1]); +// int min = (int)floor (range[0]); +// int max = (int)ceil (range[1]); //The labels //wxStaticText * distance = @@ -211,18 +211,17 @@ void interfSegmentationPanelITK::onSegmentationAllSlice( wxCommandEvent& event ) interfMirrorPanel::interfMirrorPanel(wxWindow* parent) : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) { - wxButton *axisShowBtn = new wxButton(this,wxID_ANY,_T("Show Axis"), wxDefaultPosition, wxSize(200,35) ); - wxButton *axisHideBtn = new wxButton(this,wxID_ANY,_T("Hide Axis"), wxDefaultPosition, wxSize(200,35) ); + _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( axisHideBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfMirrorPanel::onAxisHide ); Connect( mirrorGoBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfMirrorPanel::onMirrorGo ); wxFlexGridSizer * sizer = new wxFlexGridSizer(1); sizer -> Add( axisShowBtn, 1, wxGROW ); - sizer -> Add( axisHideBtn, 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 ); @@ -238,142 +237,39 @@ interfMirrorPanel::~interfMirrorPanel(){ void interfMirrorPanel::onAxisShow(wxCommandEvent& event) { - interfMainPanel::getInstance()->onMirrorAxisShow(); -} - -void interfMirrorPanel::onAxisHide(wxCommandEvent& event) -{ - interfMainPanel::getInstance()->onMirrorAxisHide(); -} - -void interfMirrorPanel::onMirrorGo(wxCommandEvent& event) -{ - interfMainPanel::getInstance()->onMirror(); -} - -void interfMirrorPanel::onChangeWidth(wxScrollEvent& event) -{ - int width = _thickness->GetValue(); - interfMainPanel::getInstance()->onMirrorChangeWidth(width); -} - - - -/** -** Begin of the threshold panel -**/ -interfThresholdPanel::interfThresholdPanel(wxWindow* parent) -: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) -{ - wxButton *thresholdGoBtn = new wxButton(this,wxID_ANY,_T("Show/Hide Color"), wxDefaultPosition, wxSize(200,30) ); - _interpolationCheckBox = new wxCheckBox(this, -1, _T("Image interpolation") ); - _interpolationCheckBox->SetValue(true); - _opacity = new wxSlider(this, wxID_ANY, 6, 1, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); - _thresholdGo = false; - - double range[2]; - interfMainPanel::getInstance()->getImageRange(range); - - int min = (int)floor (range[0]); - int max = (int)ceil (range[1]); - - _mBarThreshold = new mBarRange(this,70,65); - _mBarThreshold->SetMin(0); - _mBarThreshold->SetStart(0); - _mBarThreshold-> SetOrientation( true ); - _mBarThreshold-> setActiveStateTo(true); - _mBarThreshold-> setVisibleLabels( true ); - _mBarThreshold-> setDeviceEndMargin(10); - _mBarThreshold-> setRepresentedValues( min , max ); - _mBarThreshold-> setDeviceBlitStart(10,10); - _mBarThreshold-> setIfWithActualDrawed( false ); - _mBarThreshold-> SetStart( min ); - _mBarThreshold-> SetEnd( max ); - Connect( thresholdGoBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfThresholdPanel::onThresholdGo ); - Connect( _interpolationCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &interfThresholdPanel::onThresholdInterpolation ); - - wxFlexGridSizer * sizer = new wxFlexGridSizer(1); - sizer -> Add( new wxStaticText(this,-1,_T("Image Threshold")) , 1, wxGROW ); - sizer -> Add( _mBarThreshold, 1, wxGROW ); - sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW ); - sizer -> Add( new wxStaticText(this,-1,_T("Opacity Level")) , 1, wxGROW ); - sizer -> Add( _opacity, 1, wxGROW ); - sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW ); - sizer -> Add( thresholdGoBtn, 1, wxGROW ); - sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW ); - sizer -> Add( _interpolationCheckBox, 1, wxGROW ); - - this->SetSizer( sizer ); - this->SetAutoLayout( true ); - this->Layout(); -} - -interfThresholdPanel::~interfThresholdPanel(){ -} - - - -void interfThresholdPanel::onThresholdChange(wxCommandEvent& event) -{ - if (_thresholdGo) - { - interfMainPanel::getInstance()->onThresholdChange(); - - //std::cout<< "Valor Min: " << minVal << " & Valor Max: " << maxVal << std::endl; - } -} - -void interfThresholdPanel::onThresholdGo(wxCommandEvent& event) -{ - if (!_thresholdGo) + if (!_axisStatus) { - interfMainPanel::getInstance()->onThreshold(); - _thresholdGo=true; + interfMainPanel::getInstance()->onMirrorAxisShow(); + _axisStatus=true; } else { - interfMainPanel::getInstance()->onThresholdRemove( ); - _thresholdGo=false; + interfMainPanel::getInstance()->onMirrorAxisHide(); + _axisStatus=false; } } -void interfThresholdPanel::onThresholdStop() +void interfMirrorPanel::onMirrorGo(wxCommandEvent& event) { - if (_thresholdGo) - { - interfMainPanel::getInstance()->onThresholdRemove( ); - _thresholdGo=false; + if (_axisStatus) + { + interfMainPanel::getInstance()->onMirror(); } } -void interfThresholdPanel::onThresholdInstantChange(double range[]) +void interfMirrorPanel::onChangeWidth(wxScrollEvent& event) { - range[0] = _mBarThreshold->GetStart(); - range[1] = _mBarThreshold->GetEnd(); + int width = _thickness->GetValue(); + interfMainPanel::getInstance()->onMirrorChangeWidth(width); } -void interfThresholdPanel::onThresholdInterpolation(wxCommandEvent& event) -{ - interfMainPanel::getInstance()->onThresholdInterpolation(_interpolationCheckBox->GetValue()); -} -void interfThresholdPanel::onChangeOpacity(wxScrollEvent& event) -{ - int opacity = _opacity->GetValue(); - interfMainPanel::getInstance()->onThresholdChangeOpacity(opacity); -} -BEGIN_EVENT_TABLE(interfMirrorPanel, wxPanel) - EVT_SCROLL(interfMirrorPanel :: onChangeWidth) -END_EVENT_TABLE() -BEGIN_EVENT_TABLE(interfThresholdPanel, wxPanel) - EVT_COMMAND(wxID_ANY, wxEVT_TSBAR_START, interfThresholdPanel :: onThresholdChange) - EVT_COMMAND(wxID_ANY, wxEVT_TSBAR_END, interfThresholdPanel :: onThresholdChange) - EVT_COMMAND(wxID_ANY, wxEVT_TSBAR_MOVED, interfThresholdPanel :: onThresholdChange) - EVT_SCROLL(interfThresholdPanel :: onChangeOpacity) -END_EVENT_TABLE() +BEGIN_EVENT_TABLE(interfMirrorPanel, wxPanel) +EVT_SCROLL(interfMirrorPanel :: onChangeWidth) +END_EVENT_TABLE()