IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
uip_peakdetector.m
Go to the documentation of this file.
1 %> @ingroup guigroup
2 %> @file
3 %> @brief Properties Window for @ref peakdetector
4 %> @image html Screenshot-uip_peakdetector.png
5 %> <p>Options:</p>
6 %> <p><b>Minimum peak altitude</b> - Minimum distance between the zero line and the peak top. See peakdetector::minaltitude</p>
7 %> <p><b>Minimum peak height</b> - Minimum distance between the highest mountain foot (left or right) and the peak top. See peakdetector::minheight</p>
8 %> <p><b>Altitude and height are given as fractions</b> - if checked, the two above options will be used to multiply the
9 %> maximum value of the curve to get the actual minima expressed in the same units as the curve; if not checked, it will
10 %> be assumed that the two parameters above are already expressed in the same units as the curve. See peakdetector::flag_perc</p>
11 %> <p><b>Minimum horizontal distance between two adjacent peaks (in points)</b>. Prevents detecting peaks that are too close to each other. See peakdetector::mindist</p>
12 %> <p><b>Maximum number of peaks</b> - if specified (i.e., if > 0), peaks will be sorted in descending order of altitude
13 %> and the highest peaks will be returned. See peakdetector::no_max</p>
14 %> <p><b>Use absolute value of curve</b> - if checked, the absolute value of the curve will be taken before peak
15 %> detection. If not checked, negative parts of the signal are made into "lakes", i.e., replaced by zeroes. See peakdetector::flag_abs</p>
16 %>
17 %> @sa peakdetector
18 %
19 %> @cond
20 function varargout = uip_peakdetector(varargin)
21 % Last Modified by GUIDE v2.5 12-Jul-2012 19:31:26
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_peakdetector_OpeningFcn, ...
28  'gui_OutputFcn', @uip_peakdetector_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_peakdetector is made visible.
44 function uip_peakdetector_OpeningFcn(hObject, eventdata, handles, varargin)
45 handles.output.flag_ok = 0;
46 guidata(hObject, handles);
47 gui_set_position(hObject);
48 
49 % --- Outputs from this function are returned to the command clae.
50 function varargout = uip_peakdetector_OutputFcn(hObject, eventdata, handles)
51 try
52  uiwait(handles.figure1);
53  handles = guidata(hObject);
54  varargout{1} = handles.output;
55  delete(gcf);
56 catch
57  output.flag_ok = 0;
58  output.params = {};
59  varargout{1} = output;
60 end;
61 
62 function editReg_Callback(hObject, eventdata, handles)
63 
64 % --- Executes during object creation, after setting all properties.
65 function editReg_CreateFcn(hObject, eventdata, handles)
66 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
67  set(hObject,'BackgroundColor','white');
68 end
69 
70 % --- Executes on button press in pushbuttonOk.
71 function pushbuttonOk_Callback(hObject, eventdata, handles) %#ok<*INUSL>
72 try
73  handles.output.params = {...
74  'flag_perc', int2str(get(handles.checkbox_flag_perc, 'Value')), ...
75  'flag_abs', int2str(get(handles.checkbox_flag_abs, 'Value')), ...
76  'minaltitude', num2str(eval(get(handles.edit_minaltitude, 'String'))), ...
77  'minheight', num2str(eval(get(handles.edit_minheight, 'String'))), ...
78  'mindist_units', num2str(eval(get(handles.edit_mindist_units, 'String'))), ...
79  'no_max', num2str(eval(get(handles.edit_no_max, 'String'))) ...
80  };
81  handles.output.flag_ok = 1;
82  guidata(hObject, handles);
83  uiresume();
84 catch ME
85  irerrordlg(ME.message, 'Cannot continue');
86 
87 end;
88 
89 % --- Executes on button press in checkbox_flag_group.
90 function checkbox_flag_group_Callback(hObject, eventdata, handles) %#ok<*INUSD,*DEFNU>
91 
92 % --- Executes on button press in checkbox_flag_perclass.
93 function checkbox_flag_perclass_Callback(hObject, eventdata, handles)
94 
95 function edit_randomseed_Callback(hObject, eventdata, handles)
96 
97 % --- Executes during object creation, after setting all properties.
98 function edit_randomseed_CreateFcn(hObject, eventdata, handles)
99 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
100  set(hObject,'BackgroundColor','white');
101 end
102 
103 % --- Executes on button press in checkbox_flag_perc.
104 function checkbox_flag_perc_Callback(hObject, eventdata, handles)
105 
106 function edit_no_reps_Callback(hObject, eventdata, handles)
107 
108 % --- Executes during object creation, after setting all properties.
109 function edit_no_reps_CreateFcn(hObject, eventdata, handles)
110 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
111  set(hObject,'BackgroundColor','white');
112 end
113 
114 function edit_minaltitude_Callback(hObject, eventdata, handles)
115 
116 % --- Executes during object creation, after setting all properties.
117 function edit_minaltitude_CreateFcn(hObject, eventdata, handles)
118 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
119  set(hObject,'BackgroundColor','white');
120 end
121 
122 function edit_minheight_Callback(hObject, eventdata, handles)
123 
124 % --- Executes during object creation, after setting all properties.
125 function edit_minheight_CreateFcn(hObject, eventdata, handles)
126 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
127  set(hObject,'BackgroundColor','white');
128 end
129 
130 
131 % --- Executes on button press in checkbox_flag_abs.
132 function checkbox_flag_abs_Callback(hObject, eventdata, handles)
133 
134 
135 function edit_mindist_units_Callback(hObject, eventdata, handles)
136 
137 % --- Executes during object creation, after setting all properties.
138 function edit_mindist_units_CreateFcn(hObject, eventdata, handles)
139 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
140  set(hObject,'BackgroundColor','white');
141 end
142 
143 
144 
145 function edit_no_max_Callback(hObject, eventdata, handles)
146 
147 % --- Executes during object creation, after setting all properties.
148 function edit_no_max_CreateFcn(hObject, eventdata, handles)
149 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
150  set(hObject,'BackgroundColor','white');
151 end
152 %> @endcond
Property mindist
Minimum distance between peaks, expressed in number of points.
Definition: peakdetector.m:18
Peak Detector.
Definition: peakdetector.m:6
Property minheight
=0. Minimum vertical distance between peak and closest trough
Definition: peakdetector.m:15
Property flag_abs
Definition: peakdetector.m:32
Property flag_perc
Definition: peakdetector.m:25
function gui_set_position(in hObject)
Property no_max
=Inf. Maximum number of peaks to be returned. If used, peak are returned in ranked order of height...
Definition: peakdetector.m:28
Analysis Session (AS) base class.
Definition: as.m:6
function irerrordlg(in errorstring, in dlgname)
Property minaltitude
=0. Minimum vertical distance between peak and zero
Definition: peakdetector.m:12