--- a
+++ b/preprocessOfApneaECG/BioSigKit/@BioSigKit/BioSigKitPanel.m
@@ -0,0 +1,159 @@
+function BioSigKitPanel(obj)
+%% ================= Sets up BioSigKit GUI ====================== %%
+%% ============== Licensce ========================================== %%
+% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+% "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+% LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+% FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+% OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
+% SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+% TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
+% PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
+% LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
+% NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
+% SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+% Author :
+% Hooman Sedghamiz, Feb, 2018
+% MSc. Biomedical Engineering, Linkoping University
+% Email : Hooman.sedghamiz@gmail.com
+ %% ============= Main P ======================= %%
+  screensize = get(0,'ScreenSize');
+  obj.panel = figure('pos',[screensize(1)*0.8,screensize(2)*0.8,...
+                          screensize(3)*0.8,screensize(4)*0.8],...
+                         'Resize','off',...
+                         'numbertitle', 'off',...
+                         'name','BioSigKit V1.0',...
+                         'MenuBar','none',...
+                         'renderer','zbuffer',...
+                         'tag','SteadyStateWin',...
+                         'CreateFcn','movegui(''center'')',...
+                         'color',[0 0.3 0.6],...
+                         'toolbar','figure',...
+                         'resize','on',...
+                         'busyaction','queue',...
+                         'doublebuffer','on',...
+                         'handlevisibility', 'callback', ...
+                         'interruptible', 'on', ...
+                         'visible', 'off', ...
+                         'defaultaxesunits', 'pixels', ...
+                         'defaulttextfontunits', 'pixels', ...
+                         'defaulttextfontname', 'Verdana', ...
+                         'defaulttextfontsize', 12, ...
+                         'defaultuicontrolfontunits', 'pixels', ...
+                         'defaultuicontrolfontsize' , 10, ...
+                         'Resize','off',...
+                         'defaultuicontrolfontname', 'Verdana', ...
+                         'defaultuicontrolinterruptible', 'off');
+%------------------------ Customize Toolbar --------------------%
+ToolBarS = {'Insert Legend','Insert Colorbar',...
+    'Data Cursor','Rotate 3D','Edit Plot','Show Plot Tools',...
+    'Hide Plot Tools','Print Figure','Save Figure','Open File',...
+    'New Figure','Brush/Select Data','Link Plot',...
+    'Show Plot Tools and Dock Figure'};
+for i =1: length(ToolBarS) 
+     ttmp = findall(obj.panel,'ToolTipString', ToolBarS{i});
+     if ~isempty(ttmp)
+         set(ttmp,'Visible','off');
+     end
+end
+% ------------------------ Main Panel --------------------- %                     
+updateOpt = uix.BoxPanel('Parent',obj.panel,'BorderType','etchedin','title',...
+      'Main Panel','BorderWidth',3,'FontWeight','bold');
+SetupPanel = uix.VBox('Parent', updateOpt, 'Spacing', 15 );
+% ------------------------ Import Sig ----------------------- %
+ImportP = uix.Panel('Parent',SetupPanel,'BorderType','etchedin','title',...
+      'Import','BorderWidth',3,'FontWeight','bold');
+SpliterImportB = uix.HBox( 'Parent', ImportP, 'Spacing', 15 );
+obj.LoadedSig = uicontrol('Style','edit', 'String',pwd,...
+     'parent',SpliterImportB,'tag','Loader','HorizontalAlignment','left');
+uicontrol('Style','pushbutton','callback',@(varargin)ImportSig(obj),...
+     'Parent', SpliterImportB, 'String', 'Import', 'tag','Importsig'); 
+  
+% ------------------------ Axis Panel ---------------------- %
+SigViewPanel1 = uix.Panel('Parent',SetupPanel,'BorderType','etchedin','title',...
+      'Signal','BorderWidth',3,'FontWeight','bold');
+  %-------- Sig Axis ------------%
+obj.SigView = axes('parent', SigViewPanel1,'XGrid','on',...
+    'YGrid','on','XMinorGrid','on','YMinorGrid','on','Color',[0,0,0],...
+    'YColor',[1,1,1],'XColor',[1,1,1]);
+obj.SigView.Position(1:2) = [1 1];
+% --------------------------- Control Panel -----------------------------%
+SigViewPanel2 = uix.Panel('Parent',SetupPanel,'BorderType',...
+    'etchedin','title',...
+    'Control','BorderWidth',3,'FontWeight','bold'); 
+
+DividStatControl = uix.HBox( 'Parent', SigViewPanel2, 'Spacing', 15 );
+AlgFreq = uix.VBox( 'Parent', DividStatControl, 'Spacing', 15 );
+%------------ Type of Algorithm --------------%
+Run_Fs = uix.HBox( 'Parent', AlgFreq, 'Spacing', 15 );
+AlgType = uix.BoxPanel('Parent',Run_Fs,'BorderType','etchedin','title',...
+      'Algorithm','BorderWidth',3,'FontWeight','bold');
+obj.Alg = uicontrol('Style', 'popup','tag','solverType',...
+                      'String', {'QRS Pan-Tompkins','QRS PhaseSpace',...
+                      'RST State-Machine','QRS Filter-Bank','QRST MTEO',...
+                      'AMPD PeakDetector'},...
+                      'parent', AlgType);
+% ------------------------------ Sample Freq ---------------------------- %                 
+FreqP = uix.BoxPanel('Parent',Run_Fs,'BorderType','etchedin','title',...
+      'Sample Freq(Hz)','BorderWidth',3,'FontWeight','bold');
+obj.FreqValHolder = uicontrol('Style','edit', 'String','250',...
+     'parent',FreqP,'tag','SampleFreq');
+%---------------------- Run and load Button ----------------------------- %
+uicontrol('Style','pushbutton','callback',@(varargin)RunAlg(obj),...
+     'Parent', AlgFreq, 'String', 'Run', 'tag','RUN_Agg'); % Run Button
+%------------------------------- Loading bar -----------------------------%
+ iconsClassName = 'com.mathworks.widgets.BusyAffordance$AffordanceSize';
+ iconsSizeEnums = javaMethod('values',iconsClassName);
+ SIZE_32x32 = iconsSizeEnums(2);  
+ obj.Status = com.mathworks.widgets.BusyAffordance(SIZE_32x32, 'running...');  
+ javacomponent( obj.Status.getComponent, [10,10,80,80], AlgFreq);
+%% ------------- Add summerizing panel for stats --------------------- %%
+  StatP = uix.BoxPanel('Parent',DividStatControl,'BorderType','etchedin','title',...
+      'Stats','BorderWidth',3,'FontWeight','bold');
+  obj.statsC = axes('parent', StatP,...
+        'YColor',[1 1 1],'YTickLabel',{},...
+        'XColor',[1 1 1],'XTickLabel',{});
+  obj.statsC.Position(1:2) = [1 1];
+  FS = 16;
+  % -------------------- Horizontal Lines ----------------------- %
+  line([0 1],[.95 .95],'Parent',obj.statsC,'Color','black');
+  line([0 1],[.85 .85],'Parent',obj.statsC,'Color','black');
+  line([0 1],[0.01 0.01],'Parent',obj.statsC,'Color','black');
+  % -------------------- Col Headers ---------------------------- %
+  text(0.01,0.90,'\bf WaveType','Parent',obj.statsC, ...
+            'Units','normalized', 'fontweight','bold','FontSize',FS,...
+            'Interpreter','latex');
+  text(0.2,0.90,'\bf Nr','Parent',obj.statsC, ...
+            'Units','normalized', 'fontweight','bold','FontSize',FS,...
+            'Interpreter','latex');
+  text(0.4,0.90,'\bf Mean Interval(S)','Parent',obj.statsC, ...
+            'Units','normalized', 'fontweight','bold','FontSize',FS,...
+            'Interpreter','latex');
+  text(0.7,0.90,'\bf Max Interval(S)','Parent',obj.statsC, ...
+            'Units','normalized', 'fontweight','bold','FontSize',FS,...
+            'Interpreter','latex');
+  % -------------------- Row Headers ---------------------------- %
+  y = linspace(0.8,0.05,5);
+  x = [0.01,0.2,0.4,0.7];
+  R_labels = {'$$ \bf R $$','$$ \bf P $$',...
+      '$$ \bf Q $$','$$ \bf S $$','$$ \bf T $$'};
+  for j = 1: 4
+   for i = 1: 5
+      if j == 1
+          text(x(j),y(i),R_labels{i},'Parent',obj.statsC, ...
+            'Units','normalized', 'fontweight','bold','FontSize',FS,...
+            'Interpreter','latex');
+      else
+          text(x(j),y(i),'\bf --','Parent',obj.statsC, ...
+            'Units','normalized', 'fontweight','bold','FontSize',FS-2,...
+            'Interpreter','latex');
+      end
+   end
+  end
+%% ===================== Setup sizes =================== %%
+set(AlgFreq, 'Heights',[-1 30 150]);
+set(SpliterImportB,'Widths',[-1 120]);
+set(SetupPanel,'Heights',[-1 400 280]);
+set(obj.panel,'Visible','on');
+
+end
\ No newline at end of file