IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
uip_blmisc_rowsout_ranges.m
Go to the documentation of this file.
1 %> @ingroup guigroup
2 %> @file uip_blmisc_rowsout_ranges.m
3 %> @brief Properties Window for Range-based Outlier Removal
4 %> @image html Screenshot-uip_blmisc_rowsout_ranges.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>Index of feature</b> - see blmisc_rowsout_uni::idx_fea
12 %>
13 %> <b>Ranges</b> - see blmisc_rowsout_uni::ranges
14 %>
15 %> <b>Number of bins</b> - see blmisc_rowsout_uni::no_bins. For range-based outlier removal, this has no effect in the calculation, only if the user wants to draw a histogram (blmisc_rowsout_uni::draw_histogram())
16 %>
17 %> @sa blmisc_rowsout_ranges, blmisc_rowsout_uni
18 
19 %> @cond
20 function varargout = uip_blmisc_rowsout_ranges(varargin)
21 % Last Modified by GUIDE v2.5 07-Sep-2011 18:20:22
22 
23 % Begin initialization code - DO NOT EDIT
24 gui_Singleton = 1;
25 gui_State = struct('gui_Name', mfilename, ...
26  'gui_Singleton', gui_Singleton, ...
27  'gui_OpeningFcn', @uip_blmisc_rowsout_ranges_OpeningFcn, ...
28  'gui_OutputFcn', @uip_blmisc_rowsout_ranges_OutputFcn, ...
29  'gui_LayoutFcn', [] , ...
30  'gui_Callback', []);
31 if nargin && ischar(varargin{1})
32  gui_State.gui_Callback = str2func(varargin{1});
33 end
34 
35 if nargout
36  [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
37 else
38  gui_mainfcn(gui_State, varargin{:});
39 end
40 % End initialization code - DO NOT EDIT
41 
42 
43 % --- Executes just before uip_blmisc_rowsout_ranges is made visible.
44 function uip_blmisc_rowsout_ranges_OpeningFcn(hObject, eventdata, handles, varargin)
45 handles.input.block = varargin{1};
46 if nargin > 4
47  handles.input.data = varargin{2};
48 else
49  handles.input.data = [];
50 end;
51 handles.output.flag_ok = 0;
52 guidata(hObject, handles);
53 gui_set_position(hObject);
54 
55 
56 
57 % --- Outputs from this function are returned to the command clae.
58 function varargout = uip_blmisc_rowsout_ranges_OutputFcn(hObject, eventdata, handles)
59 try
60  uiwait(handles.figure1);
61  handles = guidata(hObject);
62  varargout{1} = handles.output;
63  delete(gcf);
64 catch %#ok<*CTCH>
65  output.flag_ok = 0;
66  output.params = {};
67  varargout{1} = output;
68 end;
69 
70 %############################################
71 
72 %#########
73 function preview(handles)
74 data = handles.input.data;
75 if isempty(data)
76  irerrordlg('Dataset not specified!', 'Cannot preview');
77 end;
78 try
79  blk = handles.input.block;
80  eval(['blk = blk.setbatch(', params2str(get_params(handles)), ');']);
81  blk = blk.train(data);
82  orhistgui_show(blk);
83 catch ME
84  irerrordlg(sprintf('Couldn''t preview: "%s"', ME.message), 'Sorry, mate');
85  send_error(ME);
86 end;
87 
88 %#########
89 function params = get_params(handles)
90 temp = fel(get(handles.edit_ranges, 'String'));
91 s = sprintf('%s', temp');
92 s_ranges = mat2str(eval(s));
93 
94 params = {...
95 'idx_fea', int2str(eval(get(handles.edit_idx_fea, 'String'))), ...
96 'no_bins', int2str(eval(get(handles.edit_no_bins, 'String'))), ...
97 'ranges', s_ranges, ...
98 'flag_mark_only', int2str(get(handles.checkbox_flag_mark_only, '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 editVariables_Callback(hObject, eventdata, handles)
119 
120 % --- Executes during object creation, after setting all properties.
121 function editVariables_CreateFcn(hObject, eventdata, handles)
122 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
123  set(hObject,'BackgroundColor','white');
124 end
125 
126 
127 % --- Executes on selection change in popupmenuType.
128 function popupmenuType_Callback(hObject, eventdata, handles)
129 
130 % --- Executes during object creation, after setting all properties.
131 function popupmenuType_CreateFcn(hObject, eventdata, handles)
132 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
133  set(hObject,'BackgroundColor','white');
134 end
135 
136 function edit_no_bins_Callback(hObject, eventdata, handles)
137 
138 % --- Executes during object creation, after setting all properties.
139 function edit_no_bins_CreateFcn(hObject, eventdata, handles)
140 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
141  set(hObject,'BackgroundColor','white');
142 end
143 
144 function edit_threshold_Callback(hObject, eventdata, handles)
145 
146 % --- Executes during object creation, after setting all properties.
147 function edit_threshold_CreateFcn(hObject, eventdata, handles)
148 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
149  set(hObject,'BackgroundColor','white');
150 end
151 
152 % --- Executes on selection change in popupmenuFsg.
153 function popupmenuFsg_Callback(hObject, eventdata, handles)
154 
155 
156 % --- Executes during object creation, after setting all properties.
157 function popupmenuFsg_CreateFcn(hObject, eventdata, handles)
158 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
159  set(hObject,'BackgroundColor','white');
160 end
161 
162 function edit_ranges_Callback(hObject, eventdata, handles)
163 
164 % --- Executes during object creation, after setting all properties.
165 function edit_ranges_CreateFcn(hObject, eventdata, handles)
166 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
167  set(hObject,'BackgroundColor','white');
168 end
169 
170 
171 % --- Executes on button press in pushbuttonPreview.
172 function pushbuttonPreview_Callback(hObject, eventdata, handles)
173 preview(handles);
174 
175 function edit_idx_fea_Callback(hObject, eventdata, handles)
176 
177 % --- Executes during object creation, after setting all properties.
178 function edit_idx_fea_CreateFcn(hObject, eventdata, handles)
179 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
180  set(hObject,'BackgroundColor','white');
181 end
182 
183 
184 % --- Executes on button press in checkbox_flag_mark_only.
185 function checkbox_flag_mark_only_Callback(hObject, eventdata, handles)
186 
187 %> @endcond
function irerrordlg(in errorstring, in dlgname)