⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 roi_select.m

📁 国外的一个PLStoolbox,主要用于处理图象,也可以用来回归,欢迎使用
💻 M
📖 第 1 页 / 共 2 页
字号:
function [new_chan_order_str] = roi_select(varargin)

   if nargin == 0
      new_chan_order_str = '';
      return;
   end

   if ischar(varargin{1}) 	% create figure

      new_chan_order_str = '';
      old_chan_order_str = '';
      tit_nam = 'Edit';

      chan_nam = varargin{1};
      if (nargin >= 2), old_chan_order_str = varargin{2}; end;
      if (nargin >= 3), tit_nam = varargin{3}; end;

      init(old_chan_order_str, chan_nam, tit_nam);
      uiwait;                           % wait for user finish

      new_chan_order_str = getappdata(gcf,'new_chan_order_str');

      close(gcf);
      return;
   end;

   %  clear the message line,
   %
   h = findobj(gcf,'Tag','MessageLine');
   set(h,'String','');

   action = upper(varargin{1}{1});

   if strcmp(action,'CREATE_EDIT_FILTER'),
      filter_pattern = getappdata(gcf,'FilterPattern');
      dir_name = pwd;
      if isempty(dir_name),
         dir_name = filesep;
      end;

      set(gcbo,'String',fullfile(dir_name,filter_pattern));
   elseif strcmp(action,'EDIT_FILTER'),
      EditFilter;
   elseif strcmp(action,'RESIZE_FIGURE'),
      SetObjectPositions;
   elseif strcmp(action,'ADD_SESSION_PROFILE'),
      AddSessionProfile;
   elseif strcmp(action,'REMOVE_SESSION_PROFILE'),
      RemoveSessionProfile;
   elseif strcmp(action,'MOVE_UP_PROFILE'),
      MoveUpSessionProfile;
   elseif strcmp(action,'MOVE_DOWN_PROFILE'),
      MoveDownSessionProfile;
   elseif strcmp(action,'TOGGLE_FULL_PATH'),
      SwitchFullPath;
   elseif strcmp(action,'DELETE_FIG')
      delete_fig;
   elseif strcmp(action,'LOAD_TXT')
      load_txt;
   elseif strcmp(action,'SAVE_TXT')
      save_txt;
   elseif strcmp(action,'CLASS_BUTTON_PRESSED'),
      select_class;
   elseif strcmp(action,'TYPE_BUTTON_PRESSED'),
      select_type;
   elseif strcmp(action,'DONE_BUTTON_PRESSED'),
      SelectedChannelList = get(findobj(gcf,'Tag','SelectedChannelList'),'Userdata');
      setappdata(gcf,'new_chan_order_str', num2str(SelectedChannelList));
      uiresume;
   elseif strcmp(action,'CANCEL_BUTTON_PRESSED'),
      setappdata(gcf,'new_chan_order_str',getappdata(gcf,'old_chan_order_str'));
      uiresume;
   end;

   return;


% --------------------------------------------------------------------
function init(old_chan_order_str, chan_nam, tit_nam)

   chan_num = size(chan_nam, 1);

   save_setting_status = 'on';
   roi_select_pos = [];

   try
      load('pls_profile');
   catch
   end

   if ~isempty(roi_select_pos) & strcmp(save_setting_status,'on')

      pos = roi_select_pos;

   else

      w = 0.7;
      h = 0.7;
      x = (1-w)/2;
      y = (1-h)/2;

      pos = [x y w h];

   end

   h0 = figure('Color',[0.8 0.8 0.8], ...
        'Units','normal', ...
        'Name',tit_nam, ...
        'NumberTitle','off', ...
        'MenuBar','none', ...
        'Position',pos, ...
        'DeleteFcn','roi_select({''DELETE_FIG''});', ...
        'WindowStyle', 'normal', ...
        'Tag','GetFilesFigure', ...
        'ToolBar','none');

   left_margin = .05;
   text_height = .05;

   x = left_margin;
   y = .9;
   w = .34;
   h = text_height;

   pos = [x y w h];

   fnt = 0.5;

   h1 = uicontrol('Parent',h0, ...            % Channel Label
        'Style','text', ...
        'Units','normal', ...
        'BackgroundColor',[0.8 0.8 0.8], ...
	'fontunit','normal', ...
   	'FontSize',fnt, ...
        'HorizontalAlignment','left', ...
        'ListboxTop',0, ...
        'Position',pos, ...
        'String',['ROIs: ', num2str(chan_num)], ...
        'Tag','ChannelLabel');

   x = left_margin+.44;

   pos = [x y w h];

   h1 = uicontrol('Parent',h0, ...            % Selected Channel Label
        'Style','text', ...
        'Units','normal', ...
        'BackgroundColor',[0.8 0.8 0.8], ...
	'fontunit','normal', ...
   	'FontSize',fnt, ...
        'HorizontalAlignment','left', ...
        'ListboxTop',0, ...
        'Position',pos, ...
        'String','Selected ROIs: 0', ...
        'Tag','SelectedChannelLabel');

   h = y - 0.18;
   x = left_margin;
   y = 0.18;

   pos = [x y w h];

   h1 = uicontrol('Parent',h0, ...            % Channel Listbox
        'Style','listbox', ...
        'Units','normal', ...
	'fontunit','normal', ...
   	'FontSize',0.04, ...
        'BackgroundColor',[1 1 1], ...
        'HorizontalAlignment','left', ...
        'Interruptible', 'off', ...
 	'Min',1, ...
 	'Max',10, ...
        'ListboxTop',1, ...
        'Position',pos, ...
        'String', '', ...
        'Tag','ChannelList');

   x = left_margin+.44;
   w = .34;

   pos = [x y w h];

   h1 = uicontrol('Parent',h0, ...            % Selected Channel Listbox
        'Style','listbox', ...
        'Units','normal', ...
	'fontunit','normal', ...
   	'FontSize',0.04, ...
        'BackgroundColor',[1 1 1], ...
        'HorizontalAlignment','left', ...
        'Interruptible', 'off', ...
 	'Min',1, ...
 	'Max',10, ...
        'ListboxTop',1, ...
        'Position',pos, ...
        'String', '', ...
        'Tag','SelectedChannelList');

   x = left_margin + .34 + .01;
   y = .5;
   w = .08;
   h = text_height;

   pos = [x y w h];

   h1 = uicontrol('Parent',h0, ...		% ">>" Button
        'Units','normal', ...
	'fontunit','normal', ...
   	'FontSize',fnt, ...
        'ListboxTop',0, ...
        'Position',pos, ...
        'HorizontalAlignment','center', ...
        'String','>>', ...
        'Callback','roi_select({''ADD_SESSION_PROFILE''});', ...
        'Tag','>>Button');

   x = left_margin + .78 + .01;
   y = .65;
   w = 1-left_margin-x;

   pos = [x y w h];

   h1 = uicontrol('Parent',h0, ...		% UP Button
        'Units','normal', ...
	'fontunit','normal', ...
   	'FontSize',fnt, ...
        'ListboxTop',0, ...
        'Position',pos, ...
        'HorizontalAlignment','center', ...
        'String','UP', ...
        'Callback','roi_select({''MOVE_UP_PROFILE''});', ...
        'Tag','UPButton');

   y = y - h;

   pos = [x y w h];

   h1 = uicontrol('Parent',h0, ...		% DOWN Button
        'Units','normal', ...
	'fontunit','normal', ...
   	'FontSize',fnt, ...
        'ListboxTop',0, ...
        'Position',pos, ...
        'HorizontalAlignment','center', ...
        'String','DOWN', ...
        'Callback','roi_select({''MOVE_DOWN_PROFILE''});', ...
        'Tag','DOWNButton');

   y = .3;

   pos = [x y w h];

   h1 = uicontrol('Parent',h0, ...		% REMOVE Button
        'Units','normal', ...
	'fontunit','normal', ...
   	'FontSize',fnt, ...
        'ListboxTop',0, ...
        'Position',pos, ...
        'HorizontalAlignment','center', ...
        'String','REMOVE', ...
        'Callback','roi_select({''REMOVE_SESSION_PROFILE''});', ...
        'Tag','REMOVEButton');

   x = left_margin;
   y = .08;
   w = .1;

   pos = [x y w h];


   w = .2;
   x = left_margin+.34-w;

   pos = [x y w h];


   x = left_margin+.44;
   y = .08;
   w = .12;

   pos = [x y w h];

   h1 = uicontrol('Parent',h0, ...                      % DONE
        'Units','normal', ...
	'fontunit','normal', ...
   	'FontSize',fnt, ...
        'ListboxTop',0, ...
        'Position',pos, ...
        'HorizontalAlignment','center', ...
        'String','DONE', ...
        'Callback','roi_select({''DONE_BUTTON_PRESSED''});', ...
        'Tag','DONEButton');

   x = left_margin+.44+.34-w;

   pos = [x y w h];

   h1 = uicontrol('Parent',h0, ...                      % CANCEL
        'Units','normal', ...
	'fontunit','normal', ...
   	'FontSize',fnt, ...

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -