25 #include <Gui/FilterDialogMean.hh>
29 template <
class InputST,
class OutputST>
34 const wxString& title,
37 MeanFilter(
Mean<InputST, OutputST>()),
40 this->SizeLabel =
new wxStaticText(
this,
46 this->SizeSpinCtrl =
new wxSpinCtrl(
this,
47 this->ID_SPINCTRL_MEAN,
55 this->SizeSlider =
new wxSlider(
this,
62 wxSL_HORIZONTAL | wxSL_AUTOTICKS);
65 wxBoxSizer* paramSizer = this->GetParamSizer();
66 paramSizer->Add(this->SizeLabel, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
67 paramSizer->Add(this->SizeSpinCtrl, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
68 paramSizer->Add(this->SizeSlider, 1, wxALIGN_CENTER_VERTICAL | wxALL | wxGROW, 5);
71 wxEVT_COMMAND_BUTTON_CLICKED,
74 this->Connect(this->ID_SLIDER_MEAN,
76 wxScrollEventHandler(FilterDialogMean::OnSlider));
78 this->Connect(this->ID_SPINCTRL_MEAN,
79 wxEVT_COMMAND_SPINCTRL_UPDATED,
80 wxSpinEventHandler(FilterDialogMean::OnSpinCtrl));
82 this->GetParent()->Disable();
83 this->CreateStatusBar(1);
84 this->GetSizer()->Fit(
this);
89 template <
class InputST,
class OutputST>
92 if (!this->GetParent()->IsEnabled()) {
93 this->GetParent()->Enable();
102 template <
class InputST,
class OutputST>
108 this->EnableSaveButton(
false);
109 this->EnableFilterButton(
false);
110 this->EnablePreviewButton(
false);
111 this->EnableResetButton(
false);
112 this->EnableCancelButton(
false);
114 unsigned int size = this->SizeSpinCtrl->GetValue();
116 if ((size != this->OldParamVal) && (size > 1)) {
118 this->MeanFilter.SetSize(size);
121 if (0 != this->MeanFilter.Filter(this->GetOriginalImage(), dstImg)) {
123 BIASERR(
"FilterDialogMean::OnFilterButton: Filter Error");
124 this->SetImageIsFiltered(
false);
125 this->SetStatusText(wxT(
"ERROR during FILTER"));
129 this->SetFilteredImage(dstImg);
130 this->SetImageIsFiltered(
true);
131 this->OldParamVal = size;
133 msg.Printf(wxT(
"Image Successfully Filtered With Size: %i"), size);
134 this->SetStatusText(msg);
138 }
else if ((size == 1) && (this->GetImageIsFiltered())) {
140 this->CopyOriginalImage();
141 this->SetImageIsFiltered(
false);
142 this->OldParamVal = 1;
143 this->SetStatusText(wxT(
"Reseted To Original Image Values"));
147 this->SetStatusText(wxT(
"Nothing Done To The Filtered Image"));
151 this->EnableSaveButton();
152 this->EnableFilterButton();
153 this->EnablePreviewButton();
154 this->EnableResetButton();
155 this->EnableCancelButton();
159 template <
class InputST,
class OutputST>
165 this->SetImageIsFiltered(
false);
166 this->SetStatusText(wxT(
"Filtered Image Reseted"));
174 template <
class InputST,
class OutputST>
178 this->SizeSlider->SetValue(this->SizeSpinCtrl->GetValue());
182 template <
class InputST,
class OutputST>
186 this->SizeSpinCtrl->SetValue(this->SizeSlider->GetValue());
void OnFilterButton(wxCommandEvent &WXUNUSED(event))
concrete Implementation of the pure OnFilterButton() from the base class.
FilterDialogMean(const Image< InputST > &origImage, wxWindow *parent, wxWindowID id=BIAS::ID_WIN_MEAN, const wxString &title=wxT("Mean Filter Dialog"), const wxString &name=wxT("FilterDialogMean"))
void OnResetButton(wxCommandEvent &event)
Implementation of a Mean filter dialog.
Base class for all filter dialogs.
virtual ~FilterDialogMean()
virtual void OnResetButton(wxCommandEvent &WXUNUSED(event))
Reset the original image but it does not reset the given parameter(s)