X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FInterface_Icons_NDimensions%2FinterfSegmentationPanels.cxx;h=b4e169642ec5c8c7ed80fdad89aed8dc525a3e34;hb=e56ac34f5b20cd6544371afcce7c06d63581c743;hp=9be4d4b98eb3c41d2eb3e1d4a32ae9f6bc0f725d;hpb=a609787b177c3ba7652e6e4f91cf348f9d7b036c;p=creaContours.git diff --git a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx index 9be4d4b..b4e1696 100644 --- a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx +++ b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx @@ -22,7 +22,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 +126,27 @@ void interfSegmentationPanelVTK::setLabel(wxString tmpString){ interfSegmentationPanelITK::interfSegmentationPanelITK(wxWindow * parent) : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) { - int sizeZ = interfMainPanel::getInstance()->GetImageDataSizeZ(); +// int sizeZ = interfMainPanel::getInstance()->GetImageDataSizeZ(); //int sizeZ = _theViewPanel->getSceneManager()->GetImageDataSizeZ(); double range[2]; //_theViewPanel->getSceneManager()->GetImageDataRange(range); interfMainPanel::getInstance()->GetImageDataRange(range); //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 +159,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); @@ -201,12 +209,19 @@ void interfSegmentationPanelITK::onSegmentationAllSlice( wxCommandEvent& event ) interfMirrorPanel::interfMirrorPanel(wxWindow* parent) : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) { - wxButton *mirrorGoBtn = new wxButton(this,-1,_T("Go"), wxDefaultPosition, wxSize(200,35) ); - _thickness = new wxSlider(this, -1, 4, 1, 10, wxDefaultPosition, wxSize(200,35), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); + 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) ); + 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( mirrorGoBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfMirrorPanel::onMirrorGo ); + 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 ); sizer -> Add( mirrorGoBtn, 1, wxGROW ); @@ -219,6 +234,16 @@ interfMirrorPanel::interfMirrorPanel(wxWindow* parent) 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(); @@ -238,13 +263,19 @@ void interfMirrorPanel::onChangeWidth(wxScrollEvent& event) interfThresholdPanel::interfThresholdPanel(wxWindow* parent) : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) { - wxButton *thresholdGoBtn = new wxButton(this,-1,_T("Threshold Go"), wxDefaultPosition, wxSize(200,30) ); - + 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) ); + _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); @@ -252,21 +283,27 @@ interfThresholdPanel::interfThresholdPanel(wxWindow* parent) _mBarThreshold-> setActiveStateTo(true); _mBarThreshold-> setVisibleLabels( true ); _mBarThreshold-> setDeviceEndMargin(10); - _mBarThreshold-> setRepresentedValues( range[0] , range[1] ); + _mBarThreshold-> setRepresentedValues( min , max ); _mBarThreshold-> setDeviceBlitStart(10,10); _mBarThreshold-> setIfWithActualDrawed( false ); - _mBarThreshold-> SetStart( range[0] ); - _mBarThreshold-> SetEnd( range[1] ); + _mBarThreshold-> SetStart( min ); + _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); + sizer -> Add( new wxStaticText(this,-1,_T("Image Threshold")) , 1, wxGROW ); sizer -> Add( _mBarThreshold, 1, wxGROW ); - sizer -> Add( thresholdGoBtn, 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( new wxStaticText(this,-1,_T("Select the image's range to superpose a Fake Color")) , 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 ); this->SetSizer( sizer ); this->SetAutoLayout( true ); @@ -285,9 +322,9 @@ void interfThresholdPanel::onThresholdChange(wxCommandEvent& event) int minVal = _mBarThreshold->GetStart(); int maxVal = _mBarThreshold->GetEnd(); - interfMainPanel::getInstance()->onThreshold(minVal, maxVal); + interfMainPanel::getInstance()->onThresholdChange(minVal, maxVal); - std::cout<< "Valor Min: " << minVal << " & Valor Max: " << maxVal << std::endl; + //std::cout<< "Valor Min: " << minVal << " & Valor Max: " << maxVal << std::endl; } } @@ -303,11 +340,35 @@ void interfThresholdPanel::onThresholdGo(wxCommandEvent& event) } } +void interfThresholdPanel::onThresholdRemove(wxCommandEvent& event) +{ + interfMainPanel::getInstance()->onThresholdRemove( ); + _thresholdGo=false; +} + void interfThresholdPanel::onThresholdStop() { + interfMainPanel::getInstance()->onThresholdRemove( ); _thresholdGo=false; } +void interfThresholdPanel::onThresholdInstantChange(int range[]) +{ + range[0] = _mBarThreshold->GetStart(); + range[1] = _mBarThreshold->GetEnd(); +} + +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) @@ -317,6 +378,7 @@ 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()