Mercurial > hg > ltpda
diff m-toolbox/m/gui/ltpdv/ltpdv.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/m/gui/ltpdv/ltpdv.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,235 @@ +function ltpdv(varargin) + % LTPDV dataviewer based on AOs and functions in LTPDA. + % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % + % DESCRIPTION: LTPDV dataviewer based on classes and methods in LTPDA. + % + % + % VERSION: $Id: ltpdv.m,v 1.7 2008/09/02 07:51:48 hewitson Exp $ + % + % + % HISTORY: 22-04-08 M Hewitson + % Creation + % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + %% Check if I exist already + id = findobj('Tag', 'LTPDVmainfig'); + if ~isempty(id) + figure(id) + return + end + + %% Some initial setup + + Gproperties.Gcol = [240 240 240]/255; + Gproperties.Gwidth = 1100; + Gproperties.Gheight = 700; + Gproperties.Gborder = 10; + Gproperties.fontsize = 12; + + Gproperties.Screen = get(0,'screensize'); + Gproperties.Gposition = [Gproperties.Screen(3)/2-Gproperties.Gwidth/2 ... + Gproperties.Screen(4)/2-Gproperties.Gheight/2 ... + Gproperties.Gwidth... + Gproperties.Gheight]; + + % Initialize and hide the GUI as it is being constructed. + mainfig = figure('Name', 'LTPDA Dataviewer',... + 'NumberTitle', 'off',... + 'Visible','off',... + 'Position',Gproperties.Gposition,... + 'Color', Gproperties.Gcol,... + 'Toolbar', 'none',... + 'MenuBar', 'none',... + 'Resize', 'on',... + 'Tag', 'LTPDVmainfig'); + + % Set mainfig callbacks + set(mainfig, 'CloseRequestFcn', {'ltpdv_cb_mainfigClose', mainfig}); + + % Set Application data + setappdata(mainfig, 'Gproperties', Gproperties); + + %% Setup GUI elements + + Hmargin = Gproperties.Gborder/Gproperties.Gwidth; + Vmargin = Gproperties.Gborder/Gproperties.Gheight; + BottomMargin = 0.2; + SplitPoint = 0.35; + + %----------- Object list + + % Panel + pleft = Hmargin; + phght = 1-2*Vmargin; + pbot = (1 - Vmargin - phght); + pwid = SplitPoint - 2*Hmargin; + ph = uipanel(mainfig, 'Title','Object List','FontSize', Gproperties.fontsize,... + 'BackgroundColor', [0.6 0.7 0.9],... + 'Position',[pleft pbot pwid phght], 'Units', 'normalized'); + + % Object list + pmarg = 0.025; + Lleft = pmarg; + Lbottom = 0.4+pmarg; + Lwidth = 1-2*pmarg; + Lheight = 1-Lbottom-pmarg; + th = uitable(ph, ... + 'Units', 'normalized',... + 'ColumnName', {'Name','Type'}, ... + 'ColumnWidth', {220, 100}, ... + 'ColumnEditable', [true false], ... + 'Position', [Lleft Lbottom Lwidth Lheight],... + 'Tag', 'LTPDVobjList', ... + 'CellSelectionCallback', {@ltpdv_objectList_select, mainfig}, ... + 'CellEditCallback', {@ltpdv_objectList_edit, mainfig}); + + % Set column widths + set(th, 'Units', 'pixel'); + pos = get(th, 'Position'); + set(th, 'Units', 'normalized'); + set(th, 'ColumnWidth', {0.7*pos(3), 0.2*pos(3)}); + + % Delete objects button + pleft = pmarg; + phght = 0.05; + pbott = Lbottom - phght - pmarg; + pwidt = 0.2; + pbh = uicontrol(ph,'Style','pushbutton',... + 'String','Delete',... + 'Callback', {@ltpdv_delete_objects, mainfig}, ... + 'Units', 'normalized', ... + 'Position',[pleft pbott pwidt phght]); + + % Clear objects button + pleft = pmarg + pwidt + pmarg; + phght = 0.05; + pbott = Lbottom - phght - pmarg; + pwidt = 0.2; + pbh = uicontrol(ph,'Style','pushbutton',... + 'String','Clear',... + 'Callback', {@ltpdv_delete_objects, mainfig, 'all'}, ... + 'Units', 'normalized', ... + 'Position',[pleft pbott pwidt phght]); + + % Save objects button + pleft = pleft + pwidt + pmarg; + phght = 0.05; + pbott = Lbottom - phght - pmarg; + pwidt = 0.2; + pbh = uicontrol(ph,'Style','pushbutton',... + 'String','Save',... + 'Callback', {@ltpdv_save_objects, mainfig}, ... + 'Units', 'normalized', ... + 'Position',[pleft pbott pwidt phght]); + + % Load objects button + pleft = pleft + pwidt + pmarg; + phght = 0.05; + pbott = Lbottom - phght - pmarg; + pwidt = 0.2; + pbh = uicontrol(ph,'Style','pushbutton',... + 'String','Load',... + 'Callback', {@ltpdv_load_objects, mainfig}, ... + 'Units', 'normalized', ... + 'Position',[pleft pbott pwidt phght]); + + % Export objects button + pleft = pmarg; + phght = 0.05; + pbott = pbott - phght - pmarg; + pwidt = 0.2; + pbh = uicontrol(ph,'Style','pushbutton',... + 'String','Export',... + 'Callback', {@ltpdv_export_objects, mainfig}, ... + 'Units', 'normalized', ... + 'Position',[pleft pbott pwidt phght]); + + % Explore objects button + pleft = pleft + pwidt + pmarg; + pbh = uicontrol(ph,'Style','pushbutton',... + 'String','Explore',... + 'Callback', {@ltpdv_explore_objects, mainfig}, ... + 'Units', 'normalized', ... + 'Position',[pleft pbott pwidt phght]); + + + %------- + % Plot button + bw = 0.2; + bl = pmarg; + bh = 0.05; + bb = pmarg; + + pbh = uicontrol(ph,'Style','pushbutton',... + 'String','Plot',... + 'Callback', {@ltpdv_plot, mainfig}, ... + 'Units', 'normalized', ... + 'Position',[bl bb bw bh]); + + % Plot history button + bw = 0.2; + bl = bl+bw+pmarg; + bh = 0.05; + bb = pmarg; + + pbh = uicontrol(ph,'Style','pushbutton',... + 'String','Plot History',... + 'Callback', {@ltpdv_hist_plot, mainfig}, ... + 'Units', 'normalized', ... + 'Position',[bl bb bw bh]); + + + %----------- TAB PANEL + PanLeft = SplitPoint; + Tleft = PanLeft + Hmargin; + Theight = 1-2*Vmargin ; + Tbottom = (1 - Vmargin - Theight); + Twidth = (1-PanLeft)-2*Hmargin; + + htab = uitabgroup('Parent', mainfig, ... + 'Units','normalized',... + 'Position',[Tleft Tbottom Twidth Theight], 'SelectionChangeFcn', {@ltpdv_tabChanged}); + t1 = uitab(htab, 'title', 'Import'); + t2 = uitab(htab, 'title', 'Math'); + t3 = uitab(htab, 'title', 'Preprocessing'); + t4 = uitab(htab, 'title', 'Filter'); + t5 = uitab(htab, 'title', 'Spectral'); + t6 = uitab(htab, 'title', 'Object Properties'); + t7 = uitab(htab, 'title', 'Plot'); + + % Set app data + setappdata(mainfig, 'LTPDAobjects', {}); + setappdata(mainfig, 'ImportWorkspaceSelectedRows', []); + setappdata(mainfig, 'ObjectListSelectedRows', []); + setappdata(mainfig, 'Filters', []); + setappdata(mainfig, 'FilterPoles', []); + setappdata(mainfig, 'FilterZeros', []); + setappdata(mainfig, 'TimesList', {}); + + + % Build panels + ltpdv_buildImportPanel(t1, mainfig); + ltpdv_buildMathPanel(t2, mainfig); + ltpdv_buildPreprocessPanel(t3, mainfig); + ltpdv_buildFilterPanel(t4, mainfig); + ltpdv_buildSpectralPanel(t5, mainfig); + ltpdv_buildPropertiesPanel(t6, mainfig); + ltpdv_buildPlotPanel(t7, mainfig); + + + %% Start the GUI + + % Make the GUI visible. + set(mainfig,'Visible','on') + + +end + + + + +