diff --git a/+folderBrowser/model.m b/+folderBrowser/model.m deleted file mode 100644 index d182390..0000000 --- a/+folderBrowser/model.m +++ /dev/null @@ -1,131 +0,0 @@ -classdef model < handle -% -% package FolderBrowser -% model -% -% GUI Widget for browsing a folder -% user loads a file or a folder -% uses Model-View-Controller design -% role: model -% -% requires: -% GUI Layout Toolbox -% https://de.mathworks.com/matlabcentral/fileexchange/47982-gui-layout-toolbox -% -% Georgi Tushev -% sciclist@brain.mpg.de -% Max-Planck Institute For Brain Research -% - properties - - path - extension - list - index - - end - - properties (SetObservable) - - file - - end - - properties (Dependent) - - listSize - - end - - methods - - function obj = model(varchar) - - obj.extension = varchar; - - end - - function obj = fileLoad(obj) - - [fileName, pathName] = uigetfile(regexp(obj.extension, ',', 'split')', 'Pick a file ...'); - if ischar(fileName) - - obj.path = pathName(1:end-1); % uigetfile retunrns pathName with filesep - obj.list = {[pathName, fileName]}; - obj.index = 1; - obj.file = obj.list{obj.index}; - - end - - end - - function obj = folderLoad(obj) - - pathName = uigetdir(pwd, 'Pick a directory ...'); - - % read folder information - tempExtension = regexp(obj.extension, ',', 'split'); - folderInfo = []; - for e = 1 : length(tempExtension) - - folderInfo = cat(1,folderInfo,dir([pathName, filesep, tempExtension{e}])); - - end - - % clean subdirectories and hidden files - idxRemove = cat(1, folderInfo.isdir) | strncmp('.', {folderInfo.name}', 1); - folderInfo(idxRemove) = []; - - if isempty(folderInfo) - - warndlg(sprintf('No files with the extension: %s found!', obj.extension)); - - else - - % update properties - obj.path = pathName; - obj.list = cellfun(@(x) {[pathName, filesep, x]},{folderInfo.name}'); - obj.index = 1; - obj.file = obj.list{obj.index}; - - end - - end - - function obj = fileUpdate(obj, varstep) - - % check varstep - if varstep > obj.listSize - - varstep = sign(varstep) * 1; - - end - - % update index - obj.index = obj.index + varstep; - - % constrain - if obj.index > obj.listSize - - obj.index = obj.index - obj.listSize; - - end - - if obj.index <= 0 - - obj.index = obj.listSize + obj.index; - - end - - % update filename - obj.file = obj.list{obj.index}; - - end - - function value = get.listSize(obj) - - value = length(obj.list); - - end - end -end \ No newline at end of file diff --git a/+folderBrowser/uirender.m b/+folderBrowser/uirender.m deleted file mode 100644 index 9a83ae1..0000000 --- a/+folderBrowser/uirender.m +++ /dev/null @@ -1,187 +0,0 @@ -classdef uirender < handle -% -% package FolderBrowser -% uirender -% -% GUI Widget for browsing a folder -% user loads a file or a folder -% uses Model-View-Controller design -% role: view -% -% requires: -% GUI Layout Toolbox -% https://de.mathworks.com/matlabcentral/fileexchange/47982-gui-layout-toolbox -% -% Georgi Tushev -% sciclist@brain.mpg.de -% Max-Planck Institute For Brain Research -% - - properties - - parent - panel - layout - - buttonGroup_Load - pushButton_LoadFile - pushButton_LoadFolder - - buttonGroup_Navigate - pushButton_PrevFile - pushButton_NextFile - - text_FileName - text_FileCounter - - end - - events (NotifyAccess = protected) - - event_fileLoad - event_fileNext - event_filePrevious - event_folderLoad - - end - - properties (Constant = true, Access = private, Hidden = true) - - UIWINDOW_SIZE = [1, 1, 256, 256]; - UIGRID_PADDING = 5; - UIGRID_SPACING = 5; - UIBUTTON_SIZE = [90, 26]; - UIFONT_SIZE = 10; - - end - - methods - - function obj = uirender(varhandle) - - - - % render parent - if isempty(varhandle) - - obj.parent = figure(... - 'Visible', 'on',... - 'Tag', 'hWidgetFolderBrowser',... - 'Name', 'FolderBrowser',... - 'MenuBar', 'none',... - 'ToolBar', 'none',... - 'NumberTitle', 'off',... - 'Position', obj.UIWINDOW_SIZE); - movegui(obj.parent, 'northwest'); - - elseif isgraphics(varhandle) - - obj.parent = parserObj.Results.Parent; - - else - - error('uirender::invalid input variable for file constructor'); - - end - - % render user interface - obj.render(); - - end - - function obj = render(obj) - - %%% --- create widget panel --- %%% - obj.panel = uiextras.Panel(... - 'Parent', obj.parent,... - 'Padding', obj.UIGRID_PADDING,... - 'Title', 'FolderBrowser'); - - obj.layout = uiextras.VBoxFlex(... - 'Parent', obj.panel,... - 'Padding', obj.UIGRID_PADDING); - - obj.text_FileName = uicontrol(... - 'Parent', obj.layout,... - 'Style', 'text',... - 'FontSize', obj.UIFONT_SIZE,... - 'String', 'load file or folder'); - - obj.text_FileCounter = uicontrol(... - 'Parent', obj.layout,... - 'Style', 'text',... - 'FontSize', obj.UIFONT_SIZE,... - 'String', '0 / 0'); - - obj.buttonGroup_Load = uiextras.HButtonBox(... - 'Parent', obj.layout,... - 'Padding', obj.UIGRID_PADDING,... - 'Spacing', obj.UIGRID_SPACING,... - 'ButtonSize', obj.UIBUTTON_SIZE); - - obj.pushButton_LoadFile = uicontrol(... - 'Parent', obj.buttonGroup_Load,... - 'Style', 'pushbutton',... - 'String', 'Load file',... - 'Enable', 'on',... - 'Callback', @obj.onClick_pushButton_LoadFile); - - obj.pushButton_LoadFolder = uicontrol(... - 'Parent', obj.buttonGroup_Load,... - 'Style', 'pushbutton',... - 'String', 'Load folder',... - 'Enable', 'on',... - 'Callback', @obj.onClick_pushButton_LoadFolder); - - obj.buttonGroup_Navigate = uiextras.HButtonBox(... - 'Parent', obj.layout,... - 'Padding', obj.UIGRID_PADDING,... - 'Spacing', obj.UIGRID_SPACING,... - 'ButtonSize', obj.UIBUTTON_SIZE); - - obj.pushButton_PrevFile = uicontrol(... - 'Parent', obj.buttonGroup_Navigate,... - 'Style', 'pushbutton',... - 'String', 'Previous',... - 'Enable', 'off',... - 'Callback', @obj.onClick_pushButton_PrevFile); - - obj.pushButton_NextFile = uicontrol(... - 'Parent', obj.buttonGroup_Navigate,... - 'Style', 'pushbutton',... - 'String', 'Next',... - 'Enable', 'off',... - 'Callback',@obj.onClick_pushButton_NextFile); - - end - - function obj = onClick_pushButton_LoadFile(obj, ~, ~) - - notify(obj, 'event_fileLoad'); - - end - - function obj = onClick_pushButton_LoadFolder(obj, ~, ~) - - notify(obj, 'event_folderLoad'); - - end - - - function obj = onClick_pushButton_PrevFile(obj, ~, ~) - - notify(obj, 'event_filePrevious'); - - end - - - function obj = onClick_pushButton_NextFile(obj, ~, ~) - - notify(obj, 'event_fileNext'); - - end - - - end - -end diff --git a/+folderBrowser/widget.m b/+folderBrowser/widget.m deleted file mode 100644 index e8d5983..0000000 --- a/+folderBrowser/widget.m +++ /dev/null @@ -1,120 +0,0 @@ -classdef widget < handle -% -% package FolderBrowser -% widget -% -% GUI Widget for browsing a folder -% user loads a file or a folder -% uses Model-View-Controller design -% role: controller -% -% requires: -% GUI Layout Toolbox -% https://de.mathworks.com/matlabcentral/fileexchange/47982-gui-layout-toolbox -% -% Georgi Tushev -% sciclist@brain.mpg.de -% Max-Planck Institute For Brain Research -% - properties - - ui - model - - end - - methods - - function obj = widget(varargin) - - % parse input - parserObj = inputParser; - addParameter(parserObj, 'Parent', [], @isparent); - addParameter(parserObj, 'Extension', '*.*', @ischar); - parse(parserObj, varargin{:}); - - - obj.ui = folderBrowser.uirender(parserObj.Results.Parent); - obj.model = folderBrowser.model(parserObj.Results.Extension); - - % link controler with view and model - if isa(obj.ui, 'folderBrowser.uirender') - - addlistener(obj.ui, 'event_fileLoad', @obj.fcnCallback_FileLoad); - addlistener(obj.ui, 'event_fileNext', @obj.fcnCallback_FileNext); - addlistener(obj.ui, 'event_filePrevious', @obj.fcnCallback_FilePrevious); - addlistener(obj.ui, 'event_folderLoad', @obj.fcnCallback_FolderLoad); - - end - - if isa(obj.model, 'folderBrowser.model') - - addlistener(obj.model, 'file', 'PostSet', @obj.fcnCallback_FileUpdated); - end - - end - end - - methods - - %%% --- callback functions --- %%% - - function obj = fcnCallback_FileLoad(obj, ~, ~) - - obj.model.fileLoad(); - - set(obj.ui.pushButton_PrevFile, 'Enable', 'off'); - set(obj.ui.pushButton_NextFile, 'Enable', 'off'); - - end - - function obj = fcnCallback_FileNext(obj, ~, ~) - - obj.model.fileUpdate(1); - - end - - function obj = fcnCallback_FilePrevious(obj, ~, ~) - - obj.model.fileUpdate(-1); - - end - - function obj = fcnCallback_FolderLoad(obj, ~, ~) - - obj.model.folderLoad(); - - set(obj.ui.pushButton_PrevFile, 'Enable', 'on'); - set(obj.ui.pushButton_NextFile, 'Enable', 'on'); - - end - - function obj = fcnCallback_FileUpdated(obj, ~, ~) - - % update status - [~, fileTag] = fileparts(obj.model.file); - fprintf('file: %s\n', obj.model.file); - - set(obj.ui.text_FileName, 'String', fileTag); - set(obj.ui.text_FileCounter, 'String', ... - sprintf('%d / %d', obj.model.index, obj.model.listSize)); - - - end - - end - -end - - - -function tf = isparent(varin) - - tf = false; - - if isempty(varin) || isgraphics(varin) - - tf = true; - - end -end diff --git a/+imageBrowser/@WidgetRender/WidgetRender.m b/+imageBrowser/@WidgetRender/WidgetRender.m deleted file mode 100644 index e7c3a9b..0000000 --- a/+imageBrowser/@WidgetRender/WidgetRender.m +++ /dev/null @@ -1,219 +0,0 @@ -classdef WidgetRender < handle - %UNTITLED Summary of this class goes here - % Detailed explanation goes here - - %% --- properties --- %% - properties (Access = public) - - text_status - - text_countChannel - text_countStack - pushButton_prevChannel - pushButton_prevStack - pushButton_nextChannel - pushButton_nextStack - - popup_pickProjection - pushButton_project - checkBox_keepProjection - - popup_pickClim - editBox_minClim - editBox_maxClim - - end - - properties (Access = private) - - parent - layoutWidget - panelWidget - panelStatus - panelTabs - - end - - properties (Constant = true, Access = protected, Hidden = true) - - UI_WINDOW_SIZE = [1, 1, 256, 256]; - UI_GRID_PADDING = 5; - UI_GRID_SPACING = 5; - UI_BUTTON_SIZE = [90, 26]; - UI_POPUP_CHOOSE_PROJECTION = {'max','sum','std'}; - UI_POPUP_CHOOSE_CLIM = {'auto', '8bit', '16bit'}; - - end - - %% --- events --- %% - events - - event_delete - event_navigate_prevChannel - event_navigate_prevStack - event_navigate_nextChannel - event_navigate_nextStack - event_request_project - event_request_editclim - - end - - - %% --- methods --- %% - methods - - function obj = WidgetRender(varhandle) - - %%% set widget parent - if isempty(varhandle) - - obj.parent = figure(... - 'Visible', 'on',... - 'Tag', 'hWidgetImageBrowserUI',... - 'Name', 'ImageBrowser',... - 'MenuBar', 'none',... - 'ToolBar', 'none',... - 'NumberTitle', 'off',... - 'Position', obj.UI_WINDOW_SIZE); - movegui(obj.parent, 'northwest'); - - elseif isgraphics(varhandle) - - obj.parent = varhandle; - - else - - error('ImageBrowser:uirender: invalid handle for parent'); - - end - - %%% set widget layout - obj.panelWidget = uix.Panel(... - 'Parent', obj.parent,... - 'Padding', obj.UI_GRID_PADDING,... - 'Title', 'ImageBrowser'); - - obj.layoutWidget = uix.VBoxFlex(... - 'Parent', obj.panelWidget,... - 'DividerMarkings', 'off',... - 'Spacing', obj.UI_GRID_SPACING); - - %%% create status panel - obj.panelStatus = uix.Panel(... - 'Parent', obj.layoutWidget,... - 'Padding', obj.UI_GRID_PADDING,... - 'Title', 'status'); - - %%% create tab panel - obj.panelTabs = uix.TabPanel(... - 'Parent', obj.layoutWidget,... - 'Padding', 0); - - %%% re-size panels - set(obj.layoutWidget, 'Heights', [obj.UI_BUTTON_SIZE(2)*2, -1]); - - %%% populate panels - obj.WidgetRenderStatus(); - obj.WidgetRenderNavigate(); - obj.WidgetRenderProject(); - obj.WidgetRenderViewLimit(); - - %%% assign callbacks - obj.WidgetCallbacks(); - - end - - function obj = delete(obj) - - notify(obj, 'event_delete'); - - end - - function obj = WidgetRenderStatus(obj) - - obj.text_status = uicontrol(... - 'Parent', obj.panelStatus,... - 'Style', 'text',... - 'String', 'choose image',... - 'HorizontalAlignment', 'center'); - - end - - - end - - - %% --- external methods --- %% - methods - - obj = WidgetRenderNavigate(obj); - obj = WidgetRenderProject(obj); - obj = WidgetRenderViewLimit(obj); - - end - - - %% --- callbacks --- %% - methods - - function obj = WidgetCallbacks(obj) - - set(obj.pushButton_prevChannel, 'Callback', @obj.onClick_pushButton_prevChannel); - set(obj.pushButton_nextChannel, 'Callback', @obj.onClick_pushButton_nextChannel); - set(obj.pushButton_prevStack, 'Callback', @obj.onClick_pushButton_prevStack); - set(obj.pushButton_nextStack, 'Callback', @obj.onClick_pushButton_nextStack); - set(obj.pushButton_project, 'Callback', @obj.onRequest_project); - set(obj.popup_pickProjection, 'Callback', @obj.onRequest_project); - set(obj.popup_pickClim, 'Callback', @obj.onRequest_editClim); - set(obj.editBox_minClim, 'Callback', @obj.onRequest_editClim); - set(obj.editBox_maxClim, 'Callback', @obj.onRequest_editClim); - - end - - function obj = onClick_pushButton_prevChannel(obj, ~, ~) - - notify(obj, 'event_navigate_prevChannel'); - disp('prevChannel'); - - end - - function obj = onClick_pushButton_nextChannel(obj, ~, ~) - - notify(obj, 'event_navigate_nextChannel'); - disp('nextChannel'); - - end - - function obj = onClick_pushButton_prevStack(obj, ~, ~) - - notify(obj, 'event_navigate_prevStack'); - disp('prevStack'); - - end - - function obj = onClick_pushButton_nextStack(obj, ~, ~) - - notify(obj, 'event_navigate_nextStack'); - disp('nextStack'); - - end - - function obj = onRequest_project(obj, ~, ~) - - notify(obj, 'event_request_project'); - disp('project'); - - end - - function obj = onRequest_editClim(obj, ~, ~) - - notify(obj, 'event_request_editclim'); - disp('editClim'); - - end - - end - - -end - diff --git a/+imageBrowser/@WidgetRender/WidgetRenderNavigate.m b/+imageBrowser/@WidgetRender/WidgetRenderNavigate.m deleted file mode 100644 index 492ba26..0000000 --- a/+imageBrowser/@WidgetRender/WidgetRenderNavigate.m +++ /dev/null @@ -1,58 +0,0 @@ -function obj = WidgetRenderNavigate(obj) - - %% --- add new tab to group --- %% - tabNavigate = uix.Panel('Parent', obj.panelTabs); - obj.panelTabs.TabTitles(end) = {'navigate'}; - - %% --- image navigation --- %% - layoutNavigate = uiextras.VBoxFlex(... - 'Parent', tabNavigate); - - buttonGroup_channel = uix.HButtonBox(... - 'Parent', layoutNavigate,... - 'Padding', obj.UI_GRID_PADDING,... - 'Spacing', obj.UI_GRID_SPACING,... - 'ButtonSize', obj.UI_BUTTON_SIZE); - - obj.text_countChannel = uicontrol(... - 'Parent', buttonGroup_channel,... - 'Style', 'text',... - 'String', 'channel 1 / 1'); - - obj.pushButton_prevChannel = uicontrol(... - 'Parent', buttonGroup_channel,... - 'Style', 'pushbutton',... - 'String', '<<',... - 'Enable', 'on'); - - obj.pushButton_nextChannel = uicontrol(... - 'Parent', buttonGroup_channel,... - 'Style', 'pushbutton',... - 'String', '>>',... - 'Enable', 'on'); - - buttonGroup_stack = uix.HButtonBox(... - 'Parent', layoutNavigate,... - 'Padding', obj.UI_GRID_PADDING,... - 'Spacing', obj.UI_GRID_SPACING,... - 'ButtonSize', obj.UI_BUTTON_SIZE); - - obj.text_countStack = uicontrol(... - 'Parent', buttonGroup_stack,... - 'Style', 'text',... - 'String', 'stack 1 / 1'); - - obj.pushButton_prevStack = uicontrol(... - 'Parent', buttonGroup_stack,... - 'Style', 'pushbutton',... - 'String', '<<',... - 'Enable', 'on'); - - obj.pushButton_nextStack = uicontrol(... - 'Parent', buttonGroup_stack,... - 'Style', 'pushbutton',... - 'String', '>>',... - 'Enable', 'on'); - - -end diff --git a/+imageBrowser/@WidgetRender/WidgetRenderProject.m b/+imageBrowser/@WidgetRender/WidgetRenderProject.m deleted file mode 100644 index c074f85..0000000 --- a/+imageBrowser/@WidgetRender/WidgetRenderProject.m +++ /dev/null @@ -1,40 +0,0 @@ -function obj = WidgetRenderProject(obj) - - %% --- add new tab to group --- %% - tabProject = uix.Panel('Parent', obj.panelTabs); - obj.panelTabs.TabTitles(end) = {'project'}; - - %% --- image projection --- %% - layoutProject = uix.VBoxFlex(... - 'Parent', tabProject); - - buttonGroup_popup = uix.HButtonBox(... - 'Parent', layoutProject,... - 'Padding', obj.UI_GRID_PADDING,... - 'Spacing', obj.UI_GRID_SPACING,... - 'ButtonSize', obj.UI_BUTTON_SIZE); - - obj.popup_pickProjection = uicontrol(... - 'Parent', buttonGroup_popup,... - 'Style', 'popup',... - 'String', obj.UI_POPUP_CHOOSE_PROJECTION); - - buttonGroup_click = uix.HButtonBox(... - 'Parent', layoutProject,... - 'Padding', obj.UI_GRID_PADDING,... - 'Spacing', obj.UI_GRID_SPACING,... - 'ButtonSize', obj.UI_BUTTON_SIZE); - - obj.pushButton_project = uicontrol(... - 'Parent', buttonGroup_click,... - 'Style', 'pushbutton',... - 'String', 'project'); - - obj.checkBox_keepProjection = uicontrol(... - 'Parent', buttonGroup_click,... - 'Style', 'checkbox',... - 'String', 'keep',... - 'Value', 0); - - -end diff --git a/+imageBrowser/@WidgetRender/WidgetRenderViewLimit.m b/+imageBrowser/@WidgetRender/WidgetRenderViewLimit.m deleted file mode 100644 index 5787192..0000000 --- a/+imageBrowser/@WidgetRender/WidgetRenderViewLimit.m +++ /dev/null @@ -1,48 +0,0 @@ -function obj = WidgetRenderViewLimit(obj) - - %% --- add new tab to group --- %% - tabViewLimit = uix.Panel('Parent', obj.panelTabs); - obj.panelTabs.TabTitles(end) = {'view'}; - - %% --- image navigation --- %% - layoutViewLimit = uix.VBoxFlex(... - 'Parent', tabViewLimit); - - buttonGroup_pickClim = uix.HButtonBox(... - 'Parent', layoutViewLimit,... - 'Padding', obj.UI_GRID_PADDING,... - 'Spacing', obj.UI_GRID_SPACING,... - 'ButtonSize', obj.UI_BUTTON_SIZE); - - obj.popup_pickClim = uicontrol(... - 'Parent', buttonGroup_pickClim,... - 'Style', 'popup',... - 'String', obj.UI_POPUP_CHOOSE_CLIM); - - buttonGroup_editClim = uix.HButtonBox(... - 'Parent', layoutViewLimit,... - 'Padding', obj.UI_GRID_PADDING,... - 'Spacing', obj.UI_GRID_SPACING,... - 'ButtonSize', obj.UI_BUTTON_SIZE); - - uicontrol(... - 'Parent', buttonGroup_editClim,... - 'Style', 'text', ... - 'String', 'min'); - - obj.editBox_minClim = uicontrol(... - 'Parent', buttonGroup_editClim,... - 'Style', 'edit',... - 'String', '0'); - - obj.editBox_maxClim = uicontrol(... - 'Parent', buttonGroup_editClim,... - 'Style', 'edit',... - 'String', '0'); - - uicontrol(... - 'Parent', buttonGroup_editClim,... - 'Style', 'text', ... - 'String', 'max'); - -end \ No newline at end of file diff --git a/+imageBrowser/WidgetEngine.m b/+imageBrowser/WidgetEngine.m deleted file mode 100644 index e69de29..0000000 diff --git a/+imageBrowser/WidgetModel.m b/+imageBrowser/WidgetModel.m deleted file mode 100644 index e69de29..0000000 diff --git a/+imageBrowser/WidgetViewer.m b/+imageBrowser/WidgetViewer.m deleted file mode 100644 index 73f4bbf..0000000 --- a/+imageBrowser/WidgetViewer.m +++ /dev/null @@ -1,63 +0,0 @@ -classdef iwrender < handle - %UNTITLED2 Summary of this class goes here - % Detailed explanation goes here - - properties - - parent - imaxes - - end - - properties - - UI_WINDOW_SIZE = [1, 1, 512, 512]; - UI_GRID_PADDING = 5; - - end - - methods - - function obj = iwrender() - - obj.parent = figure(... - 'Visible', 'on',... - 'Tag', 'hWidgetImageBrowserIW',... - 'Name', '',... - 'MenuBar', 'none',... - 'ToolBar', 'none',... - 'NumberTitle', 'off',... - 'Position', obj.UI_WINDOW_SIZE); - movegui(obj.parent, 'north'); - - obj.render(); - - end - - function obj = render(obj) - - layout = uiextras.HBoxFlex(... - 'Parent', obj.parent,... - 'Padding', obj.UI_GRID_PADDING); - - - obj.imaxes = axes(... - 'Parent', layout,... - 'ActivePositionProperty', 'position',... - 'XTick', [],... - 'YTick', [],... - 'XColor', 'none',... - 'YColor', 'none'); - - viewmenu = uimenu( obj.parent,... - 'Label', 'View'); - uimenu(viewmenu,... - 'Label','Auto',... - 'Checked', 'on'); - - end - - end - -end - diff --git a/.gitignore b/.gitignore index bd70a50..e2c3f84 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,16 @@ +## --- +## remove autosaves generate by the Matlab editor +## --- + +# windows default autosave extension +*.asv + +# OSX / *nix default autosave extension +*.m~ + +# Compiled MEX binaries (all platforms) +*.mex* + +# OSX index file .DS_Store -.m~ + diff --git a/NeuroBits.m b/NeuroBits.m index 1752e83..9949df4 100644 --- a/NeuroBits.m +++ b/NeuroBits.m @@ -1,7 +1,55 @@ -%function NeuroBits() +classdef NeuroBits < handle - %disp('Start!'); + properties (Access = private) + + ui_parent + + end - folderBrowser.widget('Extension','*.m'); + properties (Access = private, Constant = true) + + SCALE_HEIGHT = 0.9; + SCALE_WIDTH = 0.2; + PATH_WIDGETS = [pwd, filesep, 'widgets']; + + end -%end \ No newline at end of file + methods + + %% constructor + function obj = NeuroBits() + + %% detect screen resolution + figureSize = get(0, 'ScreenSize'); + figureSize(3) = figureSize(3) * obj.SCALE_WIDTH; + figureSize(4) = figureSize(4) * obj.SCALE_HEIGHT; + + %% create parent figure + obj.ui_parent = figure(... + 'Visible', 'on',... + 'Tag', 'hNeuroBits',... + 'Name', 'NeuroBits',... + 'MenuBar', 'none',... + 'ToolBar', 'none',... + 'Position', figureSize,... + 'NumberTitle', 'off'); + movegui(obj.ui_parent, 'northwest'); + + %% add widgets + addpath(genpath(obj.PATH_WIDGETS)); + + %% + + end + + %% destructor + function delete(obj) + + rmpath(genpath(obj.PATH_WIDGETS)); + + end + + end + + +end \ No newline at end of file diff --git a/NeuroBitsUI.m b/NeuroBitsUI.m deleted file mode 100644 index b678620..0000000 --- a/NeuroBitsUI.m +++ /dev/null @@ -1,43 +0,0 @@ -classdef NeuroBitsUI < handle - - properties (Access = public, Hidden = true) - - ui_parent - ui_layout - - end - - properties (Constant = true, Access = private, Hidden = true) - - UIWINDOW_SIZE = [1, 1, 280, 600]; - - end - - methods - - function obj = NeuroBitsUI() - - obj.renderUI(); - - end - - function obj = renderUI(obj) - - obj.ui_parent = figure(... - 'Visible', 'on',... - 'Tag', 'hNeuroBitsUI',... - 'Name', 'NeuroBits',... - 'MenuBar', 'none',... - 'ToolBar', 'none',... - 'Position', obj.UIWINDOW_SIZE,... - 'NumberTitle', 'off'); - movegui(obj.ui_parent, 'northwest'); - - obj.ui_layout = uiextras.VBoxFlex('Parent', obj.ui_parent, 'Spacing', 5, 'Padding', 5); - - end - - end - - -end \ No newline at end of file diff --git a/test.m b/test.m new file mode 100644 index 0000000..b30b9e3 --- /dev/null +++ b/test.m @@ -0,0 +1,7 @@ +% test NeuroBits +clc +clear variables +close all + + +obj = NeuroBits();