#include <ThresholdImageViewPanel.h>
Public Member Functions | |
ThresholdImageViewPanel (wxWindow *parent, int min, int max, int type) | |
~ThresholdImageViewPanel () | |
void | onThresholdStop () |
void | SetThresholdImageView (ThresholdImageView *thresholdImageView) |
bool | IsVisible () |
Private Member Functions | |
void | onThresholdChange (wxCommandEvent &event) |
void | onThresholdShow (wxCommandEvent &event) |
void | onThresholdInterpolation (wxCommandEvent &event) |
void | onChangeOpacity (wxScrollEvent &event) |
Private Attributes | |
bool | _thresholdGo |
ThresholdImageView * | _thresholdImageView |
mBarRange * | _mBarThreshold |
wxSlider * | _opacity |
wxCheckBox * | _interpolationCheckBox |
wxCheckBox * | _cb_ShowHide |
Definition at line 22 of file ThresholdImageViewPanel.h.
ThresholdImageViewPanel::ThresholdImageViewPanel | ( | wxWindow * | parent, | |
int | min, | |||
int | max, | |||
int | type | |||
) |
Begin of the threshold panel
Definition at line 16 of file ThresholdImageViewPanel.cxx.
References _cb_ShowHide, _interpolationCheckBox, _mBarThreshold, _opacity, _thresholdGo, _thresholdImageView, onChangeOpacity(), onThresholdInterpolation(), and onThresholdShow().
00017 : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN) 00018 { 00019 _thresholdImageView = new ThresholdImageView(); 00020 00021 // wxButton *thresholdGoBtn = new wxButton(this,wxID_ANY,_T("Show/Hide Color"), wxDefaultPosition, wxSize(200,30) ); 00022 00023 _thresholdGo = true; 00024 _cb_ShowHide = new wxCheckBox(this, wxID_ANY, _T("Show/Hide layer") ); 00025 _cb_ShowHide->SetValue(_thresholdGo); 00026 00027 _interpolationCheckBox = new wxCheckBox(this, -1, _T("Image interpolation") ); 00028 _interpolationCheckBox->SetValue(true); 00029 _opacity = new wxSlider(this, wxID_ANY, 6, 1, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); 00030 00031 // double range[2]; 00032 // interfMainPanel::getInstance()->getImageRange(range); 00033 00034 // int min = (int)floor (range[0]); 00035 // int max = (int)ceil (range[1]); 00036 00037 if (type==0) 00038 { 00039 } 00040 00041 if (type==1) 00042 { 00043 _mBarThreshold = new mBarRange(this,70,65); 00044 _mBarThreshold-> SetMin(0); 00045 _mBarThreshold-> SetStart(0); 00046 _mBarThreshold-> SetOrientation( true ); 00047 _mBarThreshold-> setActiveStateTo(true); 00048 _mBarThreshold-> setVisibleLabels( true ); 00049 _mBarThreshold-> setDeviceEndMargin(10); 00050 _mBarThreshold-> setRepresentedValues( min , max ); 00051 _mBarThreshold-> setDeviceBlitStart(10,10); 00052 _mBarThreshold-> setIfWithActualDrawed( false ); 00053 _mBarThreshold-> SetStart( min ); 00054 _mBarThreshold-> SetEnd( max ); 00055 } 00056 00057 00058 Connect( _cb_ShowHide->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &ThresholdImageViewPanel::onThresholdShow ); 00059 Connect( _interpolationCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &ThresholdImageViewPanel::onThresholdInterpolation ); 00060 Connect( _opacity->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &ThresholdImageViewPanel::onChangeOpacity ); 00061 00062 wxFlexGridSizer * sizer = new wxFlexGridSizer(1); 00063 if (type==1) 00064 { 00065 sizer -> Add( new wxStaticText(this,-1,_T("Image Threshold")) , 1, wxGROW ); 00066 sizer -> Add( _mBarThreshold, 1, wxGROW ); 00067 sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW ); 00068 } 00069 sizer -> Add( new wxStaticText(this,-1,_T("Opacity Level")) , 1, wxGROW ); 00070 sizer -> Add( _opacity, 1, wxGROW ); 00071 sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW ); 00072 sizer -> Add( _cb_ShowHide, 1, wxGROW ); 00073 sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW ); 00074 sizer -> Add( _interpolationCheckBox, 1, wxGROW ); 00075 00076 this->SetSizer( sizer ); 00077 this->SetAutoLayout( true ); 00078 this->Layout(); 00079 }
ThresholdImageViewPanel::~ThresholdImageViewPanel | ( | ) |
Definition at line 82 of file ThresholdImageViewPanel.cxx.
bool ThresholdImageViewPanel::IsVisible | ( | ) |
Definition at line 149 of file ThresholdImageViewPanel.cxx.
References _thresholdGo.
00150 { 00151 return _thresholdGo; 00152 }
void ThresholdImageViewPanel::onChangeOpacity | ( | wxScrollEvent & | event | ) | [private] |
Definition at line 140 of file ThresholdImageViewPanel.cxx.
References _opacity, _thresholdImageView, LayerImageBase::GetwxVtkBaseView(), LayerImageBase::onThresholdChangeOpacity(), and wxVtkBaseView::Refresh().
Referenced by ThresholdImageViewPanel().
00141 { 00142 int opacity = _opacity->GetValue(); 00143 _thresholdImageView->onThresholdChangeOpacity(opacity); 00144 _thresholdImageView->GetwxVtkBaseView()->Refresh(); 00145 }
void ThresholdImageViewPanel::onThresholdChange | ( | wxCommandEvent & | event | ) | [private] |
Definition at line 95 of file ThresholdImageViewPanel.cxx.
References _mBarThreshold, _thresholdGo, _thresholdImageView, mBarRange::GetEnd(), mBarRange::GetStart(), LayerImageBase::GetwxVtkBaseView(), LayerImageBase::onThresholdChange(), wxVtkBaseView::Refresh(), and ThresholdImageView::SetminMaxValue().
00096 { 00097 if (_thresholdGo) 00098 { 00099 _thresholdImageView->SetminMaxValue( _mBarThreshold->GetStart(), _mBarThreshold->GetEnd() ); 00100 _thresholdImageView->onThresholdChange(); 00101 _thresholdImageView->GetwxVtkBaseView()->Refresh(); 00102 //std::cout<< "Valor Min: " << minVal << " & Valor Max: " << maxVal << std::endl; 00103 } 00104 }
void ThresholdImageViewPanel::onThresholdInterpolation | ( | wxCommandEvent & | event | ) | [private] |
Definition at line 132 of file ThresholdImageViewPanel.cxx.
References _interpolationCheckBox, _thresholdImageView, LayerImageBase::GetwxVtkBaseView(), LayerImageBase::onThresholdInterpolation(), and wxVtkBaseView::Refresh().
Referenced by ThresholdImageViewPanel().
00133 { 00134 _thresholdImageView->onThresholdInterpolation(_interpolationCheckBox->GetValue()); 00135 _thresholdImageView->GetwxVtkBaseView()->Refresh(); 00136 00137 }
void ThresholdImageViewPanel::onThresholdShow | ( | wxCommandEvent & | event | ) | [private] |
Definition at line 107 of file ThresholdImageViewPanel.cxx.
References _cb_ShowHide, _thresholdGo, _thresholdImageView, LayerImageBase::GetwxVtkBaseView(), LayerImageBase::onThreshold(), LayerImageBase::onThresholdRemove(), and wxVtkBaseView::Refresh().
Referenced by ThresholdImageViewPanel().
00108 { 00109 _thresholdGo = _cb_ShowHide->GetValue(); 00110 if (_thresholdGo) 00111 { 00112 _thresholdImageView->onThreshold(); 00113 } 00114 else 00115 { 00116 _thresholdImageView->onThresholdRemove( ); 00117 } 00118 _thresholdImageView->GetwxVtkBaseView()->Refresh(); 00119 }
void ThresholdImageViewPanel::onThresholdStop | ( | ) |
Definition at line 122 of file ThresholdImageViewPanel.cxx.
References _thresholdGo, _thresholdImageView, and LayerImageBase::onThresholdRemove().
00123 { 00124 if (_thresholdGo) 00125 { 00126 _thresholdImageView->onThresholdRemove( ); 00127 _thresholdGo=false; 00128 } 00129 }
void ThresholdImageViewPanel::SetThresholdImageView | ( | ThresholdImageView * | thresholdImageView | ) |
Definition at line 88 of file ThresholdImageViewPanel.cxx.
References _thresholdImageView.
00089 { 00090 _thresholdImageView = thresholdImageView; 00091 }
wxCheckBox* ThresholdImageViewPanel::_cb_ShowHide [private] |
Definition at line 39 of file ThresholdImageViewPanel.h.
Referenced by onThresholdShow(), and ThresholdImageViewPanel().
wxCheckBox* ThresholdImageViewPanel::_interpolationCheckBox [private] |
Definition at line 38 of file ThresholdImageViewPanel.h.
Referenced by onThresholdInterpolation(), and ThresholdImageViewPanel().
mBarRange* ThresholdImageViewPanel::_mBarThreshold [private] |
Definition at line 36 of file ThresholdImageViewPanel.h.
Referenced by onThresholdChange(), and ThresholdImageViewPanel().
wxSlider* ThresholdImageViewPanel::_opacity [private] |
Definition at line 37 of file ThresholdImageViewPanel.h.
Referenced by onChangeOpacity(), and ThresholdImageViewPanel().
bool ThresholdImageViewPanel::_thresholdGo [private] |
Definition at line 34 of file ThresholdImageViewPanel.h.
Referenced by IsVisible(), onThresholdChange(), onThresholdShow(), onThresholdStop(), and ThresholdImageViewPanel().
Definition at line 35 of file ThresholdImageViewPanel.h.
Referenced by onChangeOpacity(), onThresholdChange(), onThresholdInterpolation(), onThresholdShow(), onThresholdStop(), SetThresholdImageView(), and ThresholdImageViewPanel().