X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FInterface_Icons_NDimensions%2FinterfSegmentationPanels.cxx;h=e7bb971e5ca0a122979b7f46e89fd189a6127648;hb=HEAD;hp=0fa3d18196d39987746a8a9253cfa81f4c3bb349;hpb=8f2bd3952065a2028ae345188c3493f82eda2b27;p=creaContours.git diff --git a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx index 0fa3d18..e7bb971 100644 --- a/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx +++ b/lib/Interface_Icons_NDimensions/interfSegmentationPanels.cxx @@ -1,3 +1,28 @@ +/*# --------------------------------------------------------------------- +# +# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image +# pour la Sant�) +# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton +# Previous Authors : Laurent Guigues, Jean-Pierre Roux +# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil +# +# This software is governed by the CeCILL-B license under French law and +# abiding by the rules of distribution of free software. You can use, +# modify and/ or redistribute the software under the terms of the CeCILL-B +# license as circulated by CEA, CNRS and INRIA at the following URL +# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +# or in the file LICENSE.txt. +# +# As a counterpart to the access to the source code and rights to copy, +# modify and redistribute granted by the license, users are provided only +# with a limited warranty and the software's author, the holder of the +# economic rights, and the successive licensors have only limited +# liability. +# +# The fact that you are presently reading this means that you have had +# knowledge of the CeCILL-B license and that you accept its terms. +# ------------------------------------------------------------------------ */ + #include "interfSegmentationPanels.h" #include "interfMainPanel.h" @@ -131,8 +156,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 = @@ -265,122 +290,44 @@ void interfMirrorPanel::onChangeWidth(wxScrollEvent& event) } +BEGIN_EVENT_TABLE(interfMirrorPanel, wxPanel) +EVT_SCROLL(interfMirrorPanel :: onChangeWidth) +END_EVENT_TABLE() -/** -** Begin of the threshold panel -**/ -interfThresholdPanel::interfThresholdPanel(wxWindow* parent) + +////////////////////////////////////////////////////////////// + +interfTestPanel::interfTestPanel(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); + wxButton *button1 = new wxButton(this,wxID_ANY,_T("Button 1"), wxDefaultPosition, wxSize(200,35) ); + wxButton *button2 = new wxButton(this,wxID_ANY,_T("Button 2"), wxDefaultPosition, wxSize(200,35) ); - 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( button1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfTestPanel::onButton1Pressed ); + Connect( button2->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &interfTestPanel::onButton2Pressed ); - 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 ); + sizer -> Add( button1, 1, wxGROW ); + sizer -> Add( button2, 1, wxGROW ); this->SetSizer( sizer ); this->SetAutoLayout( true ); this->Layout(); } -interfThresholdPanel::~interfThresholdPanel(){ +interfTestPanel::~interfTestPanel(){ } - - -void interfThresholdPanel::onThresholdChange(wxCommandEvent& event) +void interfTestPanel::onButton1Pressed(wxCommandEvent& event) { - if (_thresholdGo) - { - interfMainPanel::getInstance()->onThresholdChange(); - - //std::cout<< "Valor Min: " << minVal << " & Valor Max: " << maxVal << std::endl; - } + std::cout << "Button 1 has been pressed" << std::endl; } -void interfThresholdPanel::onThresholdGo(wxCommandEvent& event) +void interfTestPanel::onButton2Pressed(wxCommandEvent& event) { - if (!_thresholdGo) - { - interfMainPanel::getInstance()->onThreshold(); - _thresholdGo=true; - } - else - { - interfMainPanel::getInstance()->onThresholdRemove( ); - _thresholdGo=false; - } -} - -void interfThresholdPanel::onThresholdStop() -{ - if (_thresholdGo) - { - interfMainPanel::getInstance()->onThresholdRemove( ); - _thresholdGo=false; - } + std::cout << "Button 2 has been pressed" << std::endl; } -void interfThresholdPanel::onThresholdInstantChange(double 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) -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()