5 * \brief ClassThresholdImageViewPanel .
9 #include "ColorLayerImageViewPanel.h"
14 ** Begin of the threshold panel
16 ColorLayerImageViewPanel::ColorLayerImageViewPanel(wxWindow* parent, int min, int max, int type)
17 : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
19 _colorLayerImageView = new ColorLayerImageView();
21 _btn_ReadImage = new wxButton(this, wxID_ANY, _T("Read Image") );
25 _cb_ShowHide = new wxCheckBox(this, wxID_ANY, _T("Show/Hide layer") );
26 _cb_ShowHide->SetValue(_thresholdGo);
28 _interpolationCheckBox = new wxCheckBox(this, -1, _T("Image interpolation") );
29 _interpolationCheckBox->SetValue(true);
30 _opacity = new wxSlider(this, wxID_ANY, 6, 1, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
41 Connect( _btn_ReadImage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &ColorLayerImageViewPanel::onReadImage );
42 Connect( _cb_ShowHide->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &ColorLayerImageViewPanel::onThresholdShow );
43 Connect( _interpolationCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &ColorLayerImageViewPanel::onThresholdInterpolation );
44 Connect( _opacity->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &ColorLayerImageViewPanel::onChangeOpacity );
46 wxFlexGridSizer * sizer = new wxFlexGridSizer(1);
49 sizer -> Add( new wxStaticText(this,-1,_T("Color Image Layer")) , 1, wxGROW );
50 sizer -> Add( _btn_ReadImage, 1, wxGROW );
51 sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW );
53 sizer -> Add( new wxStaticText(this,-1,_T("Opacity Level")) , 1, wxGROW );
54 sizer -> Add( _opacity, 1, wxGROW );
55 sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW );
56 sizer -> Add( _cb_ShowHide, 1, wxGROW );
57 sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW );
58 sizer -> Add( _interpolationCheckBox, 1, wxGROW );
60 this->SetSizer( sizer );
61 this->SetAutoLayout( true );
65 //----------------------------------------------------------------------------
66 ColorLayerImageViewPanel::~ColorLayerImageViewPanel()
71 //----------------------------------------------------------------------------
72 void ColorLayerImageViewPanel::SetColorLayerImageView(ColorLayerImageView* colorLayerImageView)
74 _colorLayerImageView = colorLayerImageView;
77 //----------------------------------------------------------------------------
78 void ColorLayerImageViewPanel::onReadImage(wxCommandEvent& event)
80 printf("EED UPS.... ");
84 //----------------------------------------------------------------------------
85 void ColorLayerImageViewPanel::onThresholdChange(wxCommandEvent& event)
89 _colorLayerImageView->onThresholdChange();
90 _colorLayerImageView->GetwxVtkBaseView()->Refresh();
91 //std::cout<< "Valor Min: " << minVal << " & Valor Max: " << maxVal << std::endl;
95 //----------------------------------------------------------------------------
96 void ColorLayerImageViewPanel::onThresholdShow(wxCommandEvent& event)
98 _thresholdGo = _cb_ShowHide->GetValue();
101 _colorLayerImageView->onThreshold();
105 _colorLayerImageView->onThresholdRemove( );
107 _colorLayerImageView->GetwxVtkBaseView()->Refresh();
110 //----------------------------------------------------------------------------
111 void ColorLayerImageViewPanel::onThresholdStop()
115 _colorLayerImageView->onThresholdRemove( );
120 //----------------------------------------------------------------------------
121 void ColorLayerImageViewPanel::onThresholdInterpolation(wxCommandEvent& event)
123 _colorLayerImageView->onThresholdInterpolation(_interpolationCheckBox->GetValue());
124 _colorLayerImageView->GetwxVtkBaseView()->Refresh();
128 //----------------------------------------------------------------------------
129 void ColorLayerImageViewPanel::onChangeOpacity(wxScrollEvent& event)
131 int opacity = _opacity->GetValue();
132 _colorLayerImageView->onThresholdChangeOpacity(opacity);
133 _colorLayerImageView->GetwxVtkBaseView()->Refresh();
137 //----------------------------------------------------------------------------
138 bool ColorLayerImageViewPanel::IsVisible()