IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
uip_blmisc_rowsout_distr.m
Go to the documentation of this file.
1 %> @ingroup guigroup
2 %> @file
3 %> @brief Dialogbox for Distribution-based Outlier Removal
4 %> @image html Screenshot-uip_blmisc_rowsout_distr.png
5 %>
6 %> This window asks for properties common to all @ref blmisc_rowsout_distr descendants.
7 %>
8 %> <b>Mark outliers only</b> -
9 %> @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.
10 %> @arg If checked, only one new dataset will be generated, where the outliers will be marked (outliers' class will be
11 %> -2). See blmisc_rowsout::flag_mark_only
12 %>
13 %> <b>Threshold</b> - See blmisc_rowsout_distr::threshold
14 %>
15 %> <b>Range filter</b> - See blmisc_rowsout_distr::quantile
16 %>
17 %> <b>Tail trimming mode</b> - See blmisc_rowsout_distr::flag_trim_tail
18 %>
19 %> <b>Number of bins</b> - See blmisc_rowsout_distr::no_bins
20 %>
21 %> @sa blmisc_rowsout_distr
22 
23 %> @cond
24 function varargout = uip_blmisc_rowsout_distr(varargin)
25 % Last Modified by GUIDE v2.5 07-Sep-2011 18:23:40
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_distr_OpeningFcn, ...
32  'gui_OutputFcn', @uip_blmisc_rowsout_distr_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_distr is made visible.
48 function uip_blmisc_rowsout_distr_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_distr_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 function params = get_params(handles)
90 types = {'threshold', 'ranges'};
91 
92 params = {...
93 'flag_mark_only', int2str(get(handles.checkbox_flag_mark_only, 'Value')), ...
94 'idx_fea', int2str(eval(get(handles.edit_idx_fea, 'String'))), ...
95 'no_bins', int2str(eval(get(handles.edit_no_bins, 'String'))), ...
96 'threshold', get(handles.edit_threshold, 'String'), ...
97 'quantile', int2str(get(handles.popupmenu_quantile, 'Value')-1), ...
98 'flag_trim_tail', int2str(get(handles.checkbox_flag_trim_tail, 'value')), ...
99 };
100 
101 
102 %############################################
103 %############################################
104 
105 
106 % --- Executes on button press in pushbuttonOk.
107 function pushbuttonOk_Callback(hObject, eventdata, handles)
108 try
109  handles.output.params = get_params(handles);
110  handles.output.flag_ok = 1;
111  guidata(hObject, handles);
112  uiresume();
113 catch ME
114  irerrordlg(ME.message, 'Cannot continue');
115 
116 end;
117 
118 function edit_no_bins_Callback(hObject, eventdata, handles)
119 
120 % --- Executes during object creation, after setting all properties.
121 function edit_no_bins_CreateFcn(hObject, eventdata, handles)
122 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
123  set(hObject,'BackgroundColor','white');
124 end
125 
126 function edit_threshold_Callback(hObject, eventdata, handles)
127 
128 % --- Executes during object creation, after setting all properties.
129 function edit_threshold_CreateFcn(hObject, eventdata, handles)
130 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
131  set(hObject,'BackgroundColor','white');
132 end
133 
134 % --- Executes on button press in pushbuttonPreview.
135 function pushbuttonPreview_Callback(hObject, eventdata, handles)
136 preview(handles);
137 
138 function edit_idx_fea_Callback(hObject, eventdata, handles)
139 
140 % --- Executes during object creation, after setting all properties.
141 function edit_idx_fea_CreateFcn(hObject, eventdata, handles)
142 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
143  set(hObject,'BackgroundColor','white');
144 end
145 
146 % --- Executes on selection change in popupmenu_quantile.
147 function popupmenu_quantile_Callback(hObject, eventdata, handles)
148 
149 % --- Executes during object creation, after setting all properties.
150 function popupmenu_quantile_CreateFcn(hObject, eventdata, handles)
151 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
152  set(hObject,'BackgroundColor','white');
153 end
154 
155 % --- Executes on button press in checkbox_flag_trim_tail.
156 function checkbox_flag_trim_tail_Callback(hObject, eventdata, handles)
157 
158 
159 % --- Executes on button press in checkbox_flag_mark_only.
160 function checkbox_flag_mark_only_Callback(hObject, eventdata, handles)
161 %> @endcond
Distribution-Based Outlier Removal.