Home > functions > job > job_edit_area_dir > job_edit_area.m

job_edit_area

PURPOSE ^

---

SYNOPSIS ^

function job_edit_area(areafile,brainfile)

DESCRIPTION ^

---
 function job_edit_area(areafile,brainfile)

 Edit area data. 

 Input parameters
 - areafile   : Area file (.area.mat)
 - brainfile  : Cortex model file (.brain.mat)

 Example
 job_edit_area('./data/10000fb.area.mat',...
               './data/10000fb.brain.mat'); 

 2006-02-24 Taku Yoshioka
---

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function job_edit_area(areafile,brainfile)
0002 %---
0003 % function job_edit_area(areafile,brainfile)
0004 %
0005 % Edit area data.
0006 %
0007 % Input parameters
0008 % - areafile   : Area file (.area.mat)
0009 % - brainfile  : Cortex model file (.brain.mat)
0010 %
0011 % Example
0012 % job_edit_area('./data/10000fb.area.mat',...
0013 %               './data/10000fb.brain.mat');
0014 %
0015 % 2006-02-24 Taku Yoshioka
0016 %---
0017 %
0018 % Copyright (C) 2011, ATR All Rights Reserved.
0019 % License : New BSD License(see VBMEG_LICENSE.txt)
0020 
0021 inst_id = create_instance;
0022 if isempty(inst_id), return; end; 
0023 create_GUI(inst_id,areafile,brainfile);
0024 job_edit_area_update_spatialpattern(inst_id);
0025 
0026 %%%
0027 %%% Inner functions
0028 %%%
0029 
0030 %
0031 % Create instance of GUI
0032 % i: Instance ID of job_edit_area
0033 %
0034 function inst_id = create_instance
0035 
0036 global vbmeg_inst
0037 
0038 if isfield(vbmeg_inst,'editarea'),
0039   for inst_id=1:vbmeg_inst.const.EDITAREA_MAX
0040     if isempty(vbmeg_inst.editarea{inst_id}), return; end;
0041   end
0042   fprintf(['The number of instances of ''job_edit_area''' ...
0043        ' GUIs reaches the maximum number.\n']);
0044   inst_id = [];
0045 elseif isfield(vbmeg_inst,'const'), 
0046   vbmeg_inst.editarea = cell(vbmeg_inst.const.EDITAREA_MAX,1);
0047   inst_id = 1;
0048 else
0049   fprintf(['''vbmeg_inst'' was not correct. You have to invoke' ...
0050        '''vbmeg'' to create an instance of VBMEG.\n']); 
0051   inst_id = []; 
0052 end
0053 
0054 %
0055 % Create GUI
0056 %
0057 function create_GUI(inst_id,areafile,brainfile)
0058 
0059 global vbmeg_inst;
0060 
0061 % GUI open
0062 h_fig = open('job_edit_area.fig');
0063 set(h_fig,'HandleVisibility','on');
0064 drawnow; 
0065 set(h_fig,'Pointer','watch');
0066 
0067 % Load folded and inflated cortical models
0068 [V,F] = vb_load_cortex(brainfile); 
0069 editarea.V0 = V; 
0070 editarea.F0 = F;
0071 [V,F,xx,inf_C] = vb_load_cortex(brainfile,'Inflate');
0072 editarea.V = V;
0073 editarea.F = F;
0074 editarea.inf_C = inf_C;
0075 
0076 % Load neighbour data for morphological operations
0077 [nextDD,nextIX] = vb_load_cortex_neighbour(brainfile); 
0078 editarea.nextDD = nextDD;
0079 editarea.nextIX = nextIX;
0080 
0081 % Area file
0082 editarea.areafile = areafile;
0083 
0084 % Area data
0085 editarea.Iextract = cell(30,1); 
0086 
0087 % Handles of GUI components
0088 editarea.h_fig = h_fig;
0089 editarea.h_space = get_child_handle(h_fig,'plot_brain');
0090 editarea.ed1 = get_child_handle(h_fig,'dilation_radius');
0091 editarea.ed2 = get_child_handle(h_fig,'erosion_radius');
0092 editarea.ed3 = get_child_handle(h_fig,'vertex_number');
0093 editarea.ed4 = get_child_handle(h_fig,'area_file');
0094 editarea.lb1 = get_child_handle(h_fig,'area_list');
0095 editarea.pb1 = get_child_handle(h_fig,'dilation');
0096 editarea.pb2 = get_child_handle(h_fig,'erosion');
0097 editarea.pb3 = get_child_handle(h_fig,'rotation');
0098 editarea.pb4 = get_child_handle(h_fig,'clear');
0099 editarea.pb5 = get_child_handle(h_fig,'delete');
0100 editarea.pb6 = get_child_handle(h_fig,'overwrite');
0101 editarea.pb7 = get_child_handle(h_fig,'registration');
0102 editarea.pb8 = get_child_handle(h_fig,'undo');
0103 editarea.pb9 = get_child_handle(h_fig,'reverse');
0104 editarea.pb10 = get_child_handle(h_fig,'remove_corpus');
0105 
0106 % Set GUI value
0107 set(editarea.ed1,'String','6');
0108 set(editarea.ed2,'String','6');
0109 set(editarea.ed3,'String','0');
0110 set(editarea.ed4,'String',areafile);
0111 
0112 % Area list
0113 keyset = vb_get_keyset_area(areafile);
0114 set(editarea.lb1,'String',keyset); 
0115 set(editarea.lb1,'Value',1);
0116 
0117 % Cortex plot parameters
0118 editarea.plot_parm = vb_set_plot_parm;
0119 editarea.plot_parm.index = [];
0120 editarea.plot_parm.LRflag = 'LR';
0121 
0122 %
0123 % Set callback functions
0124 %
0125 inst_str = num2str(inst_id); 
0126 editarea_str = ['vbmeg_inst.editarea{' inst_str '}'];
0127 
0128 % Change filter radius
0129 command = ['job_edit_area_change_radius(' inst_str ');']; 
0130 set(editarea.ed1,'Callback',command);
0131 set(editarea.ed2,'Callback',command);
0132 
0133 % Dilation
0134 command = ['job_edit_area_dilation(' inst_str ');'];
0135 set(editarea.pb1,'Callback',command);
0136 
0137 % Erosion
0138 command = ['job_edit_area_erosion(' inst_str ');'];
0139 set(editarea.pb2,'Callback',command);
0140 
0141 % Rotation of cortex model
0142 command = ['global vbmeg_inst;' ...
0143        'h_space = ' editarea_str '.h_space;' ...
0144        'rotate3d(h_space);'];
0145 set(editarea.pb3,'Callback',command);
0146 
0147 % Clear current area
0148 command = ['job_edit_area_clear(' inst_str ');'];
0149 set(editarea.pb4,'Callback',command);
0150 
0151 % Delete area
0152 command = ['job_edit_area_delete(' inst_str ');'];
0153 set(editarea.pb5,'Callback',command);
0154 
0155 % Overwrite area
0156 command = ['job_edit_area_overwrite(' inst_str ');'];
0157 set(editarea.pb6,'Callback',command);
0158 
0159 % Area registration
0160 command = ['job_edit_area_registration(' inst_str ');'];
0161 set(editarea.pb7,'Callback',command);
0162 
0163 % Undo
0164 command = ['job_edit_area_undo(' inst_str ');'];
0165 set(editarea.pb8,'Callback',command);
0166 
0167 % Reverse
0168 command = ['job_edit_area_reverse(' inst_str ');'];
0169 set(editarea.pb9,'Callback',command);
0170 
0171 % Remove corpus
0172 command = ['job_edit_area_remove_corpus(' inst_str ');'];
0173 set(editarea.pb10,'Callback',command);
0174 
0175 % Close window
0176 command = ['global vbmeg_inst; '...
0177        'vbmeg_inst.editarea{' inst_str '}=[];'];
0178 set(h_fig,'DeleteFcn',command);
0179 
0180 %
0181 % Properties of axis for cortex plot
0182 set(h_fig,'Renderer','zbuffer');
0183 set(h_fig,'CurrentAxes',editarea.h_space);
0184 axis off;
0185 %axis tight; % 2006/11/24 hayashi delete
0186 %axis equal; % These commands causes axes LimMode change(auto-->manual)
0187              % after MATLAB 7.0.1. and brain model is not displayed.
0188 
0189 % Set instance
0190 vbmeg_inst.editarea{inst_id} = editarea; 
0191 
0192 % Set pointer to arrow
0193 set(h_fig,'Pointer','arrow');

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005