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

📄 struct_create_modify_ui.m

📁 绝对经典,老外制作的功能强大的matlab实现PLS_TOOBOX
💻 M
字号:
%STRUCT_CREATE_MODIFY_UI user interface for struct_create_datamat &
%	struct_modify_datamat
%
%  USAGE: struct_create_modify_ui(ismodify)
%

%   Called by struct_CREATE_DATAMAT, struct_MODIFY_DATAMAT
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function h01 = struct_create_modify_ui(ismodify)

   save_setting_status = 'on';
   struct_create_modify_pos = [];

   try
      load('pls_profile');
   catch
   end

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

      pos = struct_create_modify_pos;

   else

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

      pos = [x y w h];

   end

   h01 = figure('Units','normal', ...
   	'Position',pos, ...
        'Color',[0.8 0.8 0.8], ...
        'Name','Create Datamat', ...
        'MenuBar','none', ...
        'NumberTitle','off', ...
        'deletefcn','struct_modify_datamat(''delete_fig'');', ...
        'WindowStyle', 'normal', ...
   	'ToolBar','none');

   x = 0.05;
   y = 0.18;
   w = 1 - 2*x;
   h = 0.76;

   pos = [x y w h];

   %-------- for Brain Region Frame
   h1 = uicontrol('Parent',h01, ...		% Brain Region Frame
   	'Style','frame', ...
   	'Units','normal', ...
   	'BackgroundColor',[0.7 0.7 0.7], ...
   	'Position', pos, ...
        'Value',0, ...
   	'Tag','BrainRegionFrame');

   num_line = 12;
   factor_line = 1/(num_line+1);
   left_margin = 0.05;

   x = 0.05 + left_margin;
   y = 0.01 + (num_line-1) * factor_line;
   w = 1-2*x;
   h = 0.7 * factor_line;

   pos = [x y w h];

   h1 = uicontrol('Parent',h01, ...		% subj selection Label
        'Style','text', ...
        'Units','normal', ...
        'BackgroundColor',[0.7 0.7 0.7], ...
        'FontUnits','normal', ...
        'FontSize',0.6, ...
        'HorizontalAlignment','center', ...
        'String','Subjects', ...
        'Position',pos);

   y = 0.01 +  (num_line-6)*factor_line;
   h = 5 * factor_line;

   pos = [x y w h];

   subj_lst_hdl = uicontrol('parent',h01, ...	% subj listbox
        'unit','normal', ...
        'style','listbox', ...
        'fontunit','normal', ...
        'fontsize',0.08, ...
        'max',2, ...
        'string',' ', ...
        'Callback','struct_modify_datamat(''select_subjects'');', ...
        'position',pos);

   x = 0.05 + left_margin;
   y = 0.01 +  (num_line-7)*factor_line;
   w = 1-2*x;
   h = 0.7 * factor_line;

   pos = [x y w h];

   h1 = uicontrol('parent',h01, ... 		% select all subjects
        'unit','normal', ...
        'style','push', ...
        'fontunit','normal', ...
        'fontsize',0.6, ...
        'string','Select All Subjects', ...
        'callback', 'struct_modify_datamat(''select_all_subj'');', ...
        'position',pos);



   pos = [x y w h];

   c = uicontrol('Parent',h01, ...		% Mean Ratio Button
   	'Style','check', ...
   	'Units','normal', ...
   	'BackgroundColor',[0.7 0.7 0.7], ...
	'fontunit','normal', ...
   	'FontSize',0.6, ...
   	'HorizontalAlignment','left', ...
        'Value', 0, ...
   	'Position',pos, ...
   	'String','Normalize data with volume mean', ...
   	'Callback','struct_create_datamat(''EDIT_NORMAL_VOLUME'');', ...
	'visible', 'off', ...
   	'Tag','MeanRatioChkButton');



   if 0 % ~ismodify

      y = 0.01 +  (num_line-8)*factor_line;

      pos = [x y w h];

      h1 = uicontrol('parent',h01, ... 		% Merge Conditions
        'unit','normal', ...
        'style','push', ...
        'fontunit','normal', ...
        'fontsize',0.6, ...
        'string','Merge Conditions', ...
        'callback', 'struct_create_datamat(''MERGE_CONDITIONS'');', ...
        'position',pos);

   end

   x = 0.05 + left_margin;
   y = (num_line-9)*factor_line - 0.01;
   w = 0.2;
   h = 0.7 * factor_line - 0.01 * factor_line;

   pos = [x y w h];

   if ismodify

      set(h01, 'name', 'Modify Datamat');

      h1 = uicontrol('Parent',h01, ...		% Save As Lable
        'Style','text', ...
        'Units','normal', ...
        'BackgroundColor',[0.7 0.7 0.7], ...
        'FontUnits','normal', ...
        'FontSize',0.6, ...
        'HorizontalAlignment','left', ...
        'String','Save Datamat As:', ...
	'visible','on', ...
        'Position',pos);

      x = x+w+0.02;
      w = 0.58;
      h = 0.7 * factor_line;

      pos = [x y w h];

      filename_hdl = uicontrol('Parent',h01, ...	% Save As Edit
        'Style','edit', ...
        'Units','normal', ...
        'BackgroundColor',[1 1 1], ...
        'FontUnits','normal', ...
        'FontSize',0.6, ...
        'HorizontalAlignment','left', ...
        'String','', ...
        'Callback','struct_modify_datamat(''filename_edit'');', ...
		'visible','on', ...
        'Position',pos);

      x = 0.5;
      w = 0.2;
      y = 0.08;

      pos = [x y w h];

      h1 = uicontrol('Parent',h01, ...             % Modify
        'Units','normal', ...
        'FontUnits','normal', ...
        'FontSize',0.6, ...
        'ListboxTop',0, ...
        'String','Modify', ...
        'Callback','struct_modify_datamat(''click_modify'');', ...
        'Position',pos);

      x = x+w+0.05;

      pos = [x y w h];

      h1 = uicontrol('Parent',h01, ...             % Cancel
        'Units','normal', ...
        'FontUnits','normal', ...
        'FontSize',0.6, ...
        'ListboxTop',0, ...
        'String','Cancel', ...
        'Callback','close(gcf);', ...
        'Position',pos);

   else

      set(h01, 'name', 'Create Datamat');

      h1 = uicontrol('Parent',h01, ...		% Save As Lable
        'Style','text', ...
        'Units','normal', ...
        'BackgroundColor',[0.7 0.7 0.7], ...
        'FontUnits','normal', ...
        'FontSize',0.6, ...
        'HorizontalAlignment','left', ...
        'String','Save Datamat As:', ...
	'visible','off', ...
        'Position',pos);

      filename_hdl = uicontrol('Parent',h01, ...	% Save As Edit
        'Style','edit', ...
        'Units','normal', ...
        'BackgroundColor',[1 1 1], ...
        'FontUnits','normal', ...
        'FontSize',0.6, ...
        'HorizontalAlignment','left', ...
        'String','', ...
        'Callback','struct_create_datamat(''filename_edit'');', ...
	'visible','off', ...
        'Position',pos);

      h1 = uicontrol('Parent',h01, ...		% Predefine Region File Label
        'Style','text', ...
        'Units','normal', ...
        'BackgroundColor',[0.7 0.7 0.7], ...
        'FontUnits','normal', ...
        'FontSize',0.6, ...
        'HorizontalAlignment','left', ...
        'String','Brain Mask File:', ...
        'TooltipString','The IMG file that specifies the brain region.', ...
	'visible','on', ...
        'Position',pos);

      x = x+w+0.02;
      w = 0.42;
      h = 0.7 * factor_line;

      pos = [x y w h];

      h1 = uicontrol('Parent',h01, ...	% Predefine Region File Edit
        'Style','edit', ...
        'Units','normal', ...
        'BackgroundColor',[1 1 1], ...
        'FontUnits','normal', ...
        'FontSize',0.6, ...
        'HorizontalAlignment','left', ...
        'String','', ...
   	'Callback','struct_create_datamat(''EDIT_BRAIN_REGION_FILE'');',...
	'visible','on', ...
   	'Tag','PredefineRegionFileEdit', ...
        'Position',pos);

      x = 0.75;
      w = 0.15;
      h = 0.7 * factor_line;

      pos = [x y w h];

      h1 = uicontrol('Parent',h01, ...		% Predefine Region File Button
   	'Style','pushbutton', ...
        'Units','normal', ...
        'FontUnits','normal', ...
        'FontSize',0.6, ...
        'String','Browse', ...
   	'Callback', 'struct_create_datamat(''BRAIN_REGION_FILE_BUTTON'');', ...
   	'Tag','PredefineRegionFileButton', ...
        'Position',pos);

      x = 0.05;
      y = 0.08;
      w = 0.4;

      pos = [x y w h];

      h1 = uicontrol('Parent',h01, ...		% ORIENT Button
   	'Style','pushbutton', ...
   	'Units','normal', ...
	'fontunit','normal', ...
   	'FontSize',0.6, ...
   	'HorizontalAlignment','center', ...
   	'Position',pos, ...
   	'String','Check image orientation', ...
   	'Callback','struct_create_datamat(''ORIENT'');',...
   	'Tag','ORIENTButton');

      x = 0.5;
      w = 0.2;

      pos = [x y w h];

      h1 = uicontrol('Parent',h01, ...		% Create
	'Units','normal', ...
   	'FontUnits','normal', ...
   	'FontSize',0.6, ...
	'ListboxTop',0, ...
	'String','Create', ...
        'Callback','struct_create_datamat(''create_bn_pressed'');', ...
        'Position',pos);

      x = x+w+0.05;

      pos = [x y w h];

      h1 = uicontrol('Parent',h01, ...             % Cancel
        'Units','normal', ...
        'FontUnits','normal', ...
        'FontSize',0.6, ...
        'ListboxTop',0, ...
        'String','Cancel', ...
        'Callback','struct_create_datamat(''close_bn_pressed'');', ...
        'Position',pos);

   end

   w = 1;
   h = 0.7 * factor_line;
   x = 0.01;
   y = 0;

   pos = [x y w h];

   h1 = uicontrol('Parent',h01, ...		% Message Line Label
        'Style','text', ...
        'Units','normal', ...
        'BackgroundColor',[0.8 0.8 0.8], ...
        'ForegroundColor',[0.8 0.0 0.0], ...
        'FontUnits','normal', ...
        'FontSize',0.6, ...
        'HorizontalAlignment','left', ...
        'Position',pos, ...
        'String','', ...
        'Tag','MessageLine');

   setappdata(h01,'subj_lst_hdl', subj_lst_hdl);
   setappdata(h01,'filename_hdl', filename_hdl);

   return;

⌨️ 快捷键说明

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