X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FInterface_Icons_NDimensions%2FinterfSegmentationPanels.cxx;h=0fa3d18196d39987746a8a9253cfa81f4c3bb349;hb=8f2bd3952065a2028ae345188c3493f82eda2b27;hp=615f852eabaf99152b6523a98d1cb1dff91fe57e;hpb=022ea4ddf8cd8a991cc9060f3c13e51af6bc226e;p=creaContours.git diff --git a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx index 615f852..0fa3d18 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"); @@ -126,11 +128,11 @@ 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 = @@ -209,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 ); @@ -236,17 +237,25 @@ interfMirrorPanel::~interfMirrorPanel(){ void interfMirrorPanel::onAxisShow(wxCommandEvent& event) { - interfMainPanel::getInstance()->onMirrorAxisShow(); -} - -void interfMirrorPanel::onAxisHide(wxCommandEvent& event) -{ - interfMainPanel::getInstance()->onMirrorAxisHide(); + + if (!_axisStatus) + { + interfMainPanel::getInstance()->onMirrorAxisShow(); + _axisStatus=true; + } + else + { + interfMainPanel::getInstance()->onMirrorAxisHide(); + _axisStatus=false; + } } void interfMirrorPanel::onMirrorGo(wxCommandEvent& event) { - interfMainPanel::getInstance()->onMirror(); + if (_axisStatus) + { + interfMainPanel::getInstance()->onMirror(); + } } void interfMirrorPanel::onChangeWidth(wxScrollEvent& event) @@ -263,8 +272,7 @@ void interfMirrorPanel::onChangeWidth(wxScrollEvent& event) interfThresholdPanel::interfThresholdPanel(wxWindow* parent) : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) { - wxButton *thresholdGoBtn = new wxButton(this,wxID_ANY,_T("Add Fake Color"), wxDefaultPosition, wxSize(200,30) ); - wxButton *thresholdRemoveBtn = new wxButton(this,wxID_ANY,_T("Remove Fake Color"), wxDefaultPosition, wxSize(200,30) ); + 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); @@ -290,7 +298,6 @@ interfThresholdPanel::interfThresholdPanel(wxWindow* parent) _mBarThreshold-> SetEnd( max ); Connect( thresholdGoBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfThresholdPanel::onThresholdGo ); - Connect( thresholdRemoveBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfThresholdPanel::onThresholdRemove ); Connect( _interpolationCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &interfThresholdPanel::onThresholdInterpolation ); wxFlexGridSizer * sizer = new wxFlexGridSizer(1); @@ -301,7 +308,6 @@ interfThresholdPanel::interfThresholdPanel(wxWindow* parent) sizer -> Add( _opacity, 1, wxGROW ); sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW ); sizer -> Add( thresholdGoBtn, 1, wxGROW ); - sizer -> Add( thresholdRemoveBtn, 1, wxGROW ); sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW ); sizer -> Add( _interpolationCheckBox, 1, wxGROW ); @@ -332,11 +338,7 @@ void interfThresholdPanel::onThresholdGo(wxCommandEvent& event) interfMainPanel::getInstance()->onThreshold(); _thresholdGo=true; } -} - -void interfThresholdPanel::onThresholdRemove(wxCommandEvent& event) -{ - if (_thresholdGo) + else { interfMainPanel::getInstance()->onThresholdRemove( ); _thresholdGo=false;