]> Creatis software - creaContours.git/blobdiff - lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx
*** empty log message ***
[creaContours.git] / lib / Interface_Icons_NDimensions / interfSegmentationPanels.cxx
index feea22133a9ef91dce437639b3b2a1b7b05b7321..9be4d4b98eb3c41d2eb3e1d4a32ae9f6bc0f725d 100644 (file)
@@ -190,5 +190,133 @@ 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)
+{
+       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);
+       
+       Connect( mirrorGoBtn->GetId(),          wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfMirrorPanel::onMirrorGo ); 
+
+       wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
+       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::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,-1,_T("Threshold Go"), wxDefaultPosition, wxSize(200,30) );
+
+       _thresholdGo = false;
+
+       double range[2];
+       interfMainPanel::getInstance()->getImageRange(range);
+       
+       _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( range[0] , range[1] );
+       _mBarThreshold-> setDeviceBlitStart(10,10); 
+       _mBarThreshold-> setIfWithActualDrawed( false );
+       _mBarThreshold-> SetStart( range[0] );
+       _mBarThreshold-> SetEnd( range[1] );  
+       
+       Connect( thresholdGoBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfThresholdPanel::onThresholdGo ); 
+
+       wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
+       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(" "))  , 1, wxGROW );
+       //sizer -> Add( new wxStaticText(this,-1,_T("Select the image's range to superpose a Fake Color"))  , 1, wxGROW );
+       
+
+       this->SetSizer( sizer );
+       this->SetAutoLayout( true );
+       this->Layout();
+}
+
+interfThresholdPanel::~interfThresholdPanel(){
+}
+
+
+
+void interfThresholdPanel::onThresholdChange(wxCommandEvent& event)
+{
+       if (_thresholdGo)
+       {
+               int minVal = _mBarThreshold->GetStart();
+               int maxVal = _mBarThreshold->GetEnd();
+
+               interfMainPanel::getInstance()->onThreshold(minVal, maxVal);
+
+               std::cout<< "Valor Min: " << minVal << " & Valor Max: " << maxVal  << std::endl;
+       }
+}
+
+void interfThresholdPanel::onThresholdGo(wxCommandEvent& event)
+{
+       if (!_thresholdGo)
+       {
+               int minVal = _mBarThreshold->GetStart();
+               int maxVal = _mBarThreshold->GetEnd();
+
+               interfMainPanel::getInstance()->onThreshold(minVal, maxVal);
+               _thresholdGo=true;
+       }
+}
+
+void interfThresholdPanel::onThresholdStop()
+{
+       _thresholdGo=false;
+}
+
+
+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)     
+END_EVENT_TABLE()
+
+