IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
uip_blmisc_rowsout_kernel.m
Go to the documentation of this file.
1 %> @ingroup guigroup
2 %> @file uip_blmisc_rowsout_kernel.m
3 %> @brief Properties Window for Kernel-based Outlier Removal
4 %> @image html Screenshot-uip_blmisc_rowsout_kernel.png
5 %>
6 %> <b>Mark outliers only</b> -
7 %> @arg If not checked, the dataset will be split in two: the first one will contain the inliers, whereas the second one will contain the outliers.
8 %> @arg If checked, only one new dataset will be generated, where the outliers will be marked (outliers' class will be
9 %> -2). See blmisc_rowsout::flag_mark_only
10 %>
11 %> <b>Threshold</b> - See blmisc_rowsout_distr::threshold
12 %>
13 %> <b>Range filter</b> - See blmisc_rowsout_distr::quantile
14 %>
15 %> <b>Tail trimming mode</b> - See blmisc_rowsout_distr::flag_trim_tail
16 %>
17 %> <b>Number of bins</b> - See blmisc_rowsout_distr::no_bins
18 %>
19 %> <b>Kernel width</b> - See blmisc_rowsout_kernel::kernelwidth
20 %>
21 %> @sa blmisc_rowsout_kernel, blmisc_rowsout_hist
22 
23 %> @cond
24 function varargout = uip_blmisc_rowsout_kernel(varargin)
25 % Last Modified by GUIDE v2.5 07-Sep-2011 18:11:24
26 
27 % Begin initialization code - DO NOT EDIT
28 gui_Singleton = 1;
29 gui_State = struct('gui_Name', mfilename, ...
30  'gui_Singleton', gui_Singleton, ...
31  'gui_OpeningFcn', @uip_blmisc_rowsout_kernel_OpeningFcn, ...
32  'gui_OutputFcn', @uip_blmisc_rowsout_kernel_OutputFcn, ...
33  'gui_LayoutFcn', [] , ...
34  'gui_Callback', []);
35 if nargin && ischar(varargin{1})
36  gui_State.gui_Callback = str2func(varargin{1});
37 end
38 
39 if nargout
40  [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
41 else
42  gui_mainfcn(gui_State, varargin{:});
43 end
44 % End initialization code - DO NOT EDIT
45 
46 
47 % --- Executes just before uip_blmisc_rowsout_kernel is made visible.
48 function uip_blmisc_rowsout_kernel_OpeningFcn(hObject, eventdata, handles, varargin)
49 handles.input.block = varargin{1};
50 if nargin > 4
51  handles.input.data = varargin{2};
52 else
53  handles.input.data = [];
54 end;
55 handles.output.flag_ok = 0;
56 guidata(hObject, handles);
57 gui_set_position(hObject);
58 
59 
60 % --- Outputs from this function are returned to the command clae.
61 function varargout = uip_blmisc_rowsout_kernel_OutputFcn(hObject, eventdata, handles)
62 try
63  uiwait(handles.figure1);
64  handles = guidata(hObject);
65  varargout{1} = handles.output;
66  delete(gcf);
67 catch
68  output.flag_ok = 0;
69  output.params = {};
70  varargout{1} = output;
71 end;
72 
73 %############################################
74 
75 %#########
76 %#########
77 function preview(handles)
78 data = handles.input.data;
79 if isempty(data)
80  irerrordlg('Dataset not specified!', 'Cannot preview');
81 end;
82 blk = handles.input.block;
83 eval(['blk = blk.setbatch(', params2str(get_params(handles)), ');']);
84 blk = blk.train(data);
85 orhistgui_show(blk);
86 
87 
88 
89 %#########
90 function params = get_params(handles)
91 types = {'threshold', 'ranges'};
92 
93 params = {...
94 'flag_mark_only', int2str(get(handles.checkbox_flag_mark_only, 'Value')), ...
95 'idx_fea', int2str(eval(get(handles.edit_idx_fea, 'String'))), ...
96 'no_bins', int2str(eval(get(handles.edit_no_bins, 'String'))), ...
97 'threshold', get(handles.edit_threshold, 'String'), ...
98 'quantile', int2str(get(handles.popupmenu_quantile, 'Value')-1), ...
99 'flag_trim_tail', int2str(get(handles.checkbox_flag_trim_tail, 'value')), ...
100 'quantile', int2str(get(handles.popupmenu_quantile, 'Value')-1), ...
101 'kernelwidth', num2str(eval(get(handles.edit_kernelwidth, 'String'))) ...
102 };
103 
104 %############################################
105 %############################################
106 
107 
108 % --- Executes on button press in pushbuttonOk.
109 function pushbuttonOk_Callback(hObject, eventdata, handles)
110 try
111  handles.output.params = get_params(handles);
112  handles.output.flag_ok = 1;
113  guidata(hObject, handles);
114  uiresume();
115 catch ME
116  irerrordlg(ME.message, 'Cannot continue');
117 
118 end;
119 
120 function edit_no_bins_Callback(hObject, eventdata, handles)
121 
122 % --- Executes during object creation, after setting all properties.
123 function edit_no_bins_CreateFcn(hObject, eventdata, handles)
124 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
125  set(hObject,'BackgroundColor','white');
126 end
127 
128 function edit_threshold_Callback(hObject, eventdata, handles)
129 
130 % --- Executes during object creation, after setting all properties.
131 function edit_threshold_CreateFcn(hObject, eventdata, handles)
132 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
133  set(hObject,'BackgroundColor','white');
134 end
135 
136 % --- Executes on button press in pushbuttonPreview.
137 function pushbuttonPreview_Callback(hObject, eventdata, handles)
138 preview(handles);
139 
140 function edit_idx_fea_Callback(hObject, eventdata, handles)
141 
142 % --- Executes during object creation, after setting all properties.
143 function edit_idx_fea_CreateFcn(hObject, eventdata, handles)
144 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
145  set(hObject,'BackgroundColor','white');
146 end
147 
148 % --- Executes on selection change in popupmenu_quantile.
149 function popupmenu_quantile_Callback(hObject, eventdata, handles)
150 
151 % --- Executes during object creation, after setting all properties.
152 function popupmenu_quantile_CreateFcn(hObject, eventdata, handles)
153 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
154  set(hObject,'BackgroundColor','white');
155 end
156 
157 % --- Executes on button press in checkbox_flag_trim_tail.
158 function checkbox_flag_trim_tail_Callback(hObject, eventdata, handles)
159 
160 function edit_kernelwidth_Callback(hObject, eventdata, handles)
161 
162 % --- Executes during object creation, after setting all properties.
163 function edit_kernelwidth_CreateFcn(hObject, eventdata, handles)
164 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
165  set(hObject,'BackgroundColor','white');
166 end
167 
168 % --- Executes on button press in checkbox_flag_mark_only.
169 function checkbox_flag_mark_only_Callback(hObject, eventdata, handles)
170 %> @endcond