Home > SuperSegger > gate > gateToolGui.m

gateToolGui

PURPOSE ^

GATETOOLGUI MATLAB code for gateToolGui.fig

SYNOPSIS ^

function varargout = gateToolGui(varargin)

DESCRIPTION ^

 GATETOOLGUI MATLAB code for gateToolGui.fig
      GATETOOLGUI, by itself, creates a new GATETOOLGUI or raises the existing
      singleton*.

      H = GATETOOLGUI returns the handle to a new GATETOOLGUI or the handle to
      the existing singleton*.

      GATETOOLGUI('CALLBACK',hObject,eventData,handles,...) calls the local
      function named CALLBACK in GATETOOLGUI.M with the given input arguments.

      GATETOOLGUI('Property','Value',...) creates a new GATETOOLGUI or raises the
      existing singleton*.  Starting from the left, property value pairs are
      applied to the GUI before gateToolGui_OpeningFcn gets called.  An
      unrecognized property name or invalid value makes property application
      stop.  All inputs are passed to gateToolGui_OpeningFcn via varargin.

      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
      instance to run (singleton)".

 See also: GUIDE, GUIDATA, GUIHANDLES

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function varargout = gateToolGui(varargin)
0002 % GATETOOLGUI MATLAB code for gateToolGui.fig
0003 %      GATETOOLGUI, by itself, creates a new GATETOOLGUI or raises the existing
0004 %      singleton*.
0005 %
0006 %      H = GATETOOLGUI returns the handle to a new GATETOOLGUI or the handle to
0007 %      the existing singleton*.
0008 %
0009 %      GATETOOLGUI('CALLBACK',hObject,eventData,handles,...) calls the local
0010 %      function named CALLBACK in GATETOOLGUI.M with the given input arguments.
0011 %
0012 %      GATETOOLGUI('Property','Value',...) creates a new GATETOOLGUI or raises the
0013 %      existing singleton*.  Starting from the left, property value pairs are
0014 %      applied to the GUI before gateToolGui_OpeningFcn gets called.  An
0015 %      unrecognized property name or invalid value makes property application
0016 %      stop.  All inputs are passed to gateToolGui_OpeningFcn via varargin.
0017 %
0018 %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
0019 %      instance to run (singleton)".
0020 %
0021 % See also: GUIDE, GUIDATA, GUIHANDLES
0022 
0023 % Edit the above text to modify the response to help gateToolGui
0024 
0025 % Last Modified by GUIDE v2.5 17-Aug-2016 15:27:36
0026 
0027 % Begin initialization code - DO NOT EDIT
0028 gui_Singleton = 1;
0029 gui_State = struct('gui_Name',       mfilename, ...
0030     'gui_Singleton',  gui_Singleton, ...
0031     'gui_OpeningFcn', @gateToolGui_OpeningFcn, ...
0032     'gui_OutputFcn',  @gateToolGui_OutputFcn, ...
0033     'gui_LayoutFcn',  [] , ...
0034     'gui_Callback',   []);
0035 if nargin && ischar(varargin{1})
0036     gui_State.gui_Callback = str2func(varargin{1});
0037 end
0038 
0039 if nargout
0040     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
0041 else
0042     gui_mainfcn(gui_State, varargin{:});
0043 end
0044 % End initialization code - DO NOT EDIT
0045 
0046 
0047 % --- Executes just before gateToolGui is made visible.
0048 function gateToolGui_OpeningFcn(hObject, eventdata, handles, varargin)
0049 % This function has no output args, see OutputFcn.
0050 % hObject    handle to figure
0051 % eventdata  reserved - to be defined in a future version of MATLAB
0052 % handles    structure with handles and user data (see GUIDATA)
0053 % varargin   command line arguments to gateToolGui (see VARARGIN)
0054 
0055 % Choose default command line output for gateToolGui
0056 handles.output = hObject;
0057 handles.dirname.String = pwd;
0058 handles.time_flag = 0;
0059 handles.clist_found = 0;
0060 handles.multi_clist = [];
0061 handles.replace_flag = 0;
0062 updateGui(hObject,handles)
0063 
0064 set(handles.figure1, 'units', 'normalized', 'position', [0.2 0.1 0.35 0.75]);
0065 % Update handles structure
0066 guidata(hObject, handles);
0067 
0068 % UIWAIT makes gateToolGui wait for user response (see UIRESUME)
0069 % uiwait(handles.figure1);
0070 
0071 
0072 
0073 
0074 
0075 % --- Outputs from this function are returned to the command line.
0076 function varargout = gateToolGui_OutputFcn(hObject, eventdata, handles)
0077 % varargout  cell array for returning output args (see VARARGOUT);
0078 % hObject    handle to figure
0079 % eventdata  reserved - to be defined in a future version of MATLAB
0080 % handles    structure with handles and user data (see GUIDATA)
0081 
0082 % Get default command line output from handles structure
0083 varargout{1} = handles.multi_clist;
0084 
0085 
0086 function updateGui(hObject,handles)
0087 
0088 if isfield(handles,'multi_clist') && ~isempty(handles.multi_clist)
0089     handles.clist_found = 1;
0090 else
0091     handles.clist_found = 0;
0092     handles.msgbox.String = ['Clists : 0'];
0093 end
0094 
0095 
0096 
0097 if handles.clist_found
0098     % get def of clist
0099     
0100     which_clist = getClist(handles);
0101     
0102     if iscell(which_clist)
0103         which_clist = which_clist{1};
0104     end
0105     
0106     
0107     if handles.time_flag
0108         if isfield( which_clist(1), 'def3D' )
0109             handles.def1.String = ['None';which_clist(1).def3D'];
0110             handles.def2.String = ['None';which_clist(1).def3D'];
0111             
0112         elseif isfield( which_clist(1), 'def3d' )
0113             handles.def1.String = ['None';which_clist(1).def3d'];
0114             handles.def2.String = ['None';which_clist(1).def3d'];
0115             
0116         end
0117     else
0118         handles.def1.String = ['None';which_clist(1).def'];
0119         handles.def2.String = ['None';which_clist(1).def'];
0120     end
0121     
0122     num_clist = numel(handles.multi_clist);
0123     names = {};
0124     for i = 1 : num_clist
0125         if iscell (handles.multi_clist)
0126             if ~isfield(handles.multi_clist{i},'name')
0127                 handles.multi_clist{i}.name = ['data',num2str(i)];
0128             end
0129             names {end+1} = handles.multi_clist{i}.name;
0130             
0131         elseif isstruct (handles.multi_clist)
0132             if ~isfield(handles.multi_clist(i),'name')
0133                 handles.multi_clist(i).name = ['data',num2str(i)];
0134             end
0135             names {end+1} = handles.multi_clist(i).name;
0136         end
0137     end
0138     handles.clist_choice.String = ['All';names'];
0139     size1 = num2str(size(handles.multi_clist,1));
0140     size2 = num2str(size(handles.multi_clist,2));
0141     handles.msgbox.String = ['Clists : ', size1, ' x ', size2 ];
0142     set(findall(handles.action_panel, '-property', 'enable'), 'enable', 'on');
0143     set(findall(handles.show_panel, '-property', 'enable'), 'enable', 'on');
0144     set(findall(handles.save_panel, '-property', 'enable'), 'enable', 'on');
0145     set(findall(handles.def_panel, '-property', 'enable'), 'enable', 'on');
0146 else
0147     set(findall(handles.action_panel, '-property', 'enable'), 'enable', 'off');
0148     set(findall(handles.show_panel, '-property', 'enable'), 'enable', 'off');
0149     set(findall(handles.save_panel, '-property', 'enable'), 'enable', 'off');
0150     set(findall(handles.def_panel, '-property', 'enable'), 'enable', 'off');
0151     
0152 end
0153 
0154 
0155 guidata(hObject,handles);
0156 
0157 function which_clist = getClist(handles)
0158 if handles.clist_choice.Value == 1
0159     which_clist = handles.multi_clist;
0160 elseif isstruct(handles.multi_clist)
0161     which_clist = handles.multi_clist(handles.clist_choice.Value-1);
0162 else
0163     which_clist = handles.multi_clist{handles.clist_choice.Value-1};
0164 end
0165 
0166 
0167 % --- Executes on button press in xls.
0168 function xls_Callback(hObject, eventdata, handles)
0169 % hObject    handle to xls (see GCBO)
0170 % eventdata  reserved - to be defined in a future version of MATLAB
0171 % handles    structure with handles and user data (see GUIDATA)
0172 [filename, pathName] = uiputfile('data.csv', 'Save xls file',  handles.dirname.String);
0173 which_clist = getClist(handles);
0174 gateTool(which_clist,'xls',[pathName,filesep,filename]);
0175 
0176 
0177 % --- Executes on button press in csv.
0178 function csv_Callback(hObject, eventdata, handles)
0179 % hObject    handle to csv (see GCBO)
0180 % eventdata  reserved - to be defined in a future version of MATLAB
0181 % handles    structure with handles and user data (see GUIDATA)
0182 [filename, pathName] = uiputfile('data.csv', 'Save csv file',  handles.dirname.String);
0183 which_clist = getClist(handles);
0184 gateTool(which_clist,'csv',[pathName,filesep,filename]);
0185 
0186 % --- Executes on button press in save_mat_file.
0187 function save_mat_file_Callback(hObject, eventdata, handles)
0188 % hObject    handle to save_mat_file (see GCBO)
0189 % eventdata  reserved - to be defined in a future version of MATLAB
0190 % handles    structure with handles and user data (see GUIDATA)
0191 [filename, pathName] = uiputfile('clist.mat', 'Save clist file',  handles.dirname.String);
0192 which_clist = getClist(handles);
0193 gateTool(which_clist,'save',[pathName,filesep,filename]);
0194 
0195 function [tmp_clist] = loadClistFromDir()
0196 folderOrClist = uigetdir;
0197 if folderOrClist~=0
0198     tmp_clist = gateTool(folderOrClist);
0199 else 
0200     tmp_clist = [];
0201 end
0202 
0203 % --- Executes on button press in load_clist.
0204 function load_clist_Callback(hObject, eventdata, handles)
0205 % hObject    handle to load_clist (see GCBO)
0206 % eventdata  reserved - to be defined in a future version of MATLAB
0207 % handles    structure with handles and user data (see GUIDATA)
0208 [tmp_clist] = loadClistFromDir();
0209 updateGui(hObject,handles)
0210 
0211 
0212 % --- Executes on button press in pushbutton2.
0213 function pushbutton2_Callback(hObject, eventdata, handles)
0214 % hObject    handle to pushbutton2 (see GCBO)
0215 % eventdata  reserved - to be defined in a future version of MATLAB
0216 % handles    structure with handles and user data (see GUIDATA)
0217 
0218 
0219 
0220 
0221 % --- Executes on button press in drill.
0222 function drill_Callback(hObject, eventdata, handles)
0223 % hObject    handle to drill (see GCBO)
0224 % eventdata  reserved - to be defined in a future version of MATLAB
0225 % handles    structure with handles and user data (see GUIDATA)
0226 handles.multi_clist = gateTool(handles.dirname,'drill' );
0227 guidata(hObject,handles);
0228 
0229 % --- Executes on button press in merge.
0230 function merge_Callback(hObject, eventdata, handles)
0231 % hObject    handle to merge (see GCBO)
0232 % eventdata  reserved - to be defined in a future version of MATLAB
0233 % handles    structure with handles and user data (see GUIDATA)
0234 
0235 % Hint: get(hObject,'Value') returns toggle state of merge
0236 
0237 
0238 
0239 % --- Executes on button press in dash.
0240 function dash_Callback(hObject, eventdata, handles)
0241 % hObject    handle to dash (see GCBO)
0242 % eventdata  reserved - to be defined in a future version of MATLAB
0243 % handles    structure with handles and user data (see GUIDATA)
0244 
0245 % Hint: get(hObject,'Value') returns toggle state of dash
0246 handles.multi_clist = handles.multi_clist';
0247 guidata(hObject,handles);
0248 
0249 % --- Executes on button press in strip.
0250 function strip_Callback(hObject, eventdata, handles)
0251 % hObject    handle to strip (see GCBO)
0252 % eventdata  reserved - to be defined in a future version of MATLAB
0253 % handles    structure with handles and user data (see GUIDATA)
0254 
0255 
0256 if handles.clist_choice.Value == 1
0257     if handles.replace_flag
0258         handles.multi_clist = gateTool(handles.multi_clist,'strip');
0259     else
0260        tmp_clist = gateTool(handles.multi_clist,'strip','merge');
0261        tmp_clist.name = 'all_strip';
0262        handles.multi_clist{end+1} = tmp_clist;
0263     end
0264 elseif isstruct(handles.multi_clist)
0265     if handles.replace_flag
0266         handles.multi_clist(handles.clist_choice.Value-1) =  gateTool(handles.multi_clist(handles.clist_choice.Value-1),'strip');
0267     else
0268         clist_bef = handles.multi_clist(handles.clist_choice.Value-1);
0269         name_bef = clist_bef.name;
0270         tmp_striped =  gateTool(clist_bef,'strip');
0271         tmp_striped.name = [name_bef,'stripped'];
0272         handles.multi_clist = {};
0273         handles.multi_clist{1} = clist_bef;
0274         handles.multi_clist{2} = tmp_striped;
0275     end
0276 else
0277     if handles.replace_flag
0278         handles.multi_clist{handles.clist_choice.Value-1} =  gateTool(handles.multi_clist{handles.clist_choice.Value-1},'strip');
0279     else
0280         clist_bef = handles.multi_clist{handles.clist_choice.Value-1};
0281         name_bef = clist_bef.name;
0282         tmp_striped =  gateTool(clist_bef,'strip');
0283         tmp_striped.name = [name_bef,'stripped'];
0284         handles.multi_clist{end+1} = tmp_striped;
0285     end
0286 end
0287 
0288 updateGui(hObject,handles);
0289 guidata(hObject,handles);
0290 
0291 
0292 % --- Executes on button press in squeeze.
0293 function squeeze_Callback(hObject, eventdata, handles)
0294 % hObject    handle to squeeze (see GCBO)
0295 % eventdata  reserved - to be defined in a future version of MATLAB
0296 % handles    structure with handles and user data (see GUIDATA)
0297 
0298 handles.multi_clist = gateTool(handles.multi_clist,'squeeze');
0299 guidata(hObject,handles);
0300 updateGui(hObject,handles)
0301 
0302 % --- Executes on button press in expand.
0303 function expand_Callback(hObject, eventdata, handles)
0304 % hObject    handle to expand (see GCBO)
0305 % eventdata  reserved - to be defined in a future version of MATLAB
0306 % handles    structure with handles and user data (see GUIDATA)
0307 handles.multi_clist = gateTool(handles.multi_clist,'expand');
0308 guidata(hObject,handles);
0309 updateGui(hObject,handles)
0310 
0311 % --- Executes on button press in kde.
0312 function kde_Callback(hObject, eventdata, handles)
0313 % hObject    handle to kde (see GCBO)
0314 % eventdata  reserved - to be defined in a future version of MATLAB
0315 % handles    structure with handles and user data (see GUIDATA)
0316 
0317 % Hint: get(hObject,'Value') returns toggle state of kde
0318 
0319 if get(hObject,'Value')
0320     if get(handles.dot,'Value')
0321         handles.dot.Value = 0;
0322     end
0323     if get(handles.hist,'Value')
0324         handles.hist.Value = 0;
0325     end
0326 end
0327 
0328 
0329 % --- Executes on button press in stats.
0330 function stats_Callback(hObject, eventdata, handles)
0331 % hObject    handle to stats (see GCBO)
0332 % eventdata  reserved - to be defined in a future version of MATLAB
0333 % handles    structure with handles and user data (see GUIDATA)
0334 
0335 % Hint: get(hObject,'Value') returns toggle state of stats
0336 
0337 
0338 % --- Executes on button press in time.
0339 function time_Callback(hObject, eventdata, handles)
0340 % hObject    handle to time (see GCBO)
0341 % eventdata  reserved - to be defined in a future version of MATLAB
0342 % handles    structure with handles and user data (see GUIDATA)
0343 
0344 % Hint: get(hObject,'Value') returns toggle state of time
0345 if get(hObject,'Value')
0346     handles.time_flag = 1;
0347 else
0348     handles.time_flag = 0;
0349 end
0350 
0351 updateGui(hObject,handles)
0352 % --- Executes on selection change in def1.
0353 function def1_Callback(hObject, eventdata, handles)
0354 % hObject    handle to def1 (see GCBO)
0355 % eventdata  reserved - to be defined in a future version of MATLAB
0356 % handles    structure with handles and user data (see GUIDATA)
0357 
0358 % Hints: contents = cellstr(get(hObject,'String')) returns def1 contents as cell array
0359 %        contents{get(hObject,'Value')} returns selected item from def1
0360 
0361 
0362 % --- Executes during object creation, after setting all properties.
0363 function def1_CreateFcn(hObject, eventdata, handles)
0364 % hObject    handle to def1 (see GCBO)
0365 % eventdata  reserved - to be defined in a future version of MATLAB
0366 % handles    empty - handles not created until after all CreateFcns called
0367 
0368 % Hint: popupmenu controls usually have a white background on Windows.
0369 %       See ISPC and COMPUTER.
0370 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0371     set(hObject,'BackgroundColor','white');
0372 end
0373 
0374 
0375 % --- Executes on selection change in def2.
0376 function def2_Callback(hObject, eventdata, handles)
0377 % hObject    handle to def2 (see GCBO)
0378 % eventdata  reserved - to be defined in a future version of MATLAB
0379 % handles    structure with handles and user data (see GUIDATA)
0380 
0381 % Hints: contents = cellstr(get(hObject,'String')) returns def2 contents as cell array
0382 %        contents{get(hObject,'Value')} returns selected item from def2
0383 
0384 
0385 % --- Executes during object creation, after setting all properties.
0386 function def2_CreateFcn(hObject, eventdata, handles)
0387 % hObject    handle to def2 (see GCBO)
0388 % eventdata  reserved - to be defined in a future version of MATLAB
0389 % handles    empty - handles not created until after all CreateFcns called
0390 
0391 % Hint: popupmenu controls usually have a white background on Windows.
0392 %       See ISPC and COMPUTER.
0393 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0394     set(hObject,'BackgroundColor','white');
0395 end
0396 
0397 
0398 % --- Executes on button press in hist_tool.
0399 function hist_Callback(hObject, eventdata, handles)
0400 % hObject    handle to hist_tool (see GCBO)
0401 % eventdata  reserved - to be defined in a future version of MATLAB
0402 % handles    structure with handles and user data (see GUIDATA)
0403 
0404 % Hint: get(hObject,'Value') returns toggle state of hist_tool
0405 
0406 if get(hObject,'Value')
0407     if get(handles.dot,'Value')
0408         handles.dot.Value = 0;
0409     end
0410     if get(handles.kde,'Value')
0411         handles.kde.Value = 0;
0412     end
0413 end
0414 
0415 % --- Executes on button press in dot.
0416 function dot_Callback(hObject, eventdata, handles)
0417 % hObject    handle to dot (see GCBO)
0418 % eventdata  reserved - to be defined in a future version of MATLAB
0419 % handles    structure with handles and user data (see GUIDATA)
0420 
0421 % Hint: get(hObject,'Value') returns toggle state of dot
0422 if get(hObject,'Value')
0423     if get(handles.hist,'Value')
0424         handles.hist.Value = 0;
0425     end
0426     if get(handles.kde,'Value')
0427         handles.kde.Value = 0;
0428     end
0429     
0430 end
0431 
0432 % --- Executes on button press in log.
0433 function log_Callback(hObject, eventdata, handles)
0434 % hObject    handle to log (see GCBO)
0435 % eventdata  reserved - to be defined in a future version of MATLAB
0436 % handles    structure with handles and user data (see GUIDATA)
0437 
0438 % Hint: get(hObject,'Value') returns toggle state of log
0439 
0440 
0441 % --- Executes on button press in cond.
0442 function cond_Callback(hObject, eventdata, handles)
0443 % hObject    handle to cond (see GCBO)
0444 % eventdata  reserved - to be defined in a future version of MATLAB
0445 % handles    structure with handles and user data (see GUIDATA)
0446 
0447 % Hint: get(hObject,'Value') returns toggle state of cond
0448 if get(hObject,'Value')
0449     handles.density.Value = 0;
0450 end
0451 
0452 % --- Executes on button press in show_gates.
0453 function show_gates_Callback(hObject, eventdata, handles)
0454 % hObject    handle to show_gates (see GCBO)
0455 % eventdata  reserved - to be defined in a future version of MATLAB
0456 % handles    structure with handles and user data (see GUIDATA)
0457 
0458 index1 = handles.def1.Value - 1;
0459 index2 = handles.def2.Value - 1;
0460 
0461 varg = {'show'};
0462 
0463 
0464 if ~index1 && ~index2
0465     %nothing
0466 elseif index1~=0 && index2 == 0
0467     varg{end+1} = index1;
0468 elseif index1==0 && index2 ~= 0
0469     varg{end+1} = index2;
0470 elseif index1~=0 && index2 ~= 0
0471     varg{end+1} = [index1, index2];
0472 end
0473 
0474 if handles.time.Value
0475     varg{end+1} = 'time';
0476 end
0477 
0478 
0479 if handles.stats.Value
0480     varg{end+1} = 'stat';
0481 end
0482 
0483 if handles.kde.Value
0484     varg{end+1} = 'kde';
0485 end
0486 
0487 if handles.hist.Value
0488     varg{end+1} = 'hist';
0489 end
0490 if handles.dot.Value
0491     varg{end+1} = 'dot';
0492     if handles.line.Value
0493         varg{end+1} = 'line';
0494     end
0495 end
0496 
0497 if handles.log.Value
0498     varg{end+1} = 'log';
0499     log_axis = [];
0500     if handles.x_box.Value
0501         log_axis = [log_axis;1];
0502     end
0503     if handles.y_box.Value
0504         log_axis = [log_axis;2];
0505     end
0506     if handles.z_box.Value
0507         log_axis = [log_axis;3];
0508     end
0509     if  ~isempty(log_axis)
0510         varg{end+1} =  log_axis';
0511     end
0512     
0513 end
0514 if handles.cond.Value
0515     varg{end+1} = 'cond';
0516 end
0517 
0518 if handles.density.Value
0519     varg{end+1} = 'den';
0520 end
0521 
0522 if handles.err.Value
0523     varg{end+1} = 'err';
0524 end
0525 
0526 if handles.merge.Value
0527     varg{end+1} = 'merge';
0528 end
0529 
0530 
0531 which_clist = getClist(handles)
0532 figure;
0533 gateTool(which_clist,varg{:},'no clear');
0534 
0535 % --- Executes on button press in err.
0536 function err_Callback(hObject, eventdata, handles)
0537 % hObject    handle to err (see GCBO)
0538 % eventdata  reserved - to be defined in a future version of MATLAB
0539 % handles    structure with handles and user data (see GUIDATA)
0540 
0541 % Hint: get(hObject,'Value') returns toggle state of err
0542 
0543 
0544 % --- Executes on button press in load.
0545 function load_Callback(hObject, eventdata, handles)
0546 % hObject    handle to load (see GCBO)
0547 % eventdata  reserved - to be defined in a future version of MATLAB
0548 % handles    structure with handles and user data (see GUIDATA)
0549 
0550 if ~isempty(handles.dirname.String)
0551     handles.multi_clist = gateTool(handles.dirname.String);
0552     updateGui(hObject,handles)
0553 end
0554 
0555 % --- Executes on button press in add.
0556 function add_Callback(hObject, eventdata, handles)
0557 % hObject    handle to add (see GCBO)
0558 % eventdata  reserved - to be defined in a future version of MATLAB
0559 % handles    structure with handles and user data (see GUIDATA)
0560 [loaded_clist] = loadClistFromDir();
0561 if iscell(loaded_clist) && size(loaded_clist,2) ==1
0562     loaded_clist = loaded_clist{1};
0563 end
0564 
0565 if isstruct(handles.multi_clist)
0566     tmp_before = handles.multi_clist;
0567     handles.multi_clist = {};
0568     handles.multi_clist{1} = tmp_before;
0569 end
0570 
0571 handles.multi_clist{end+1} = loaded_clist;
0572 updateGui(hObject,handles)
0573 
0574 % --- Executes on button press in delete.
0575 function delete_Callback(hObject, eventdata, handles)
0576 % hObject    handle to delete (see GCBO)
0577 % eventdata  reserved - to be defined in a future version of MATLAB
0578 % handles    structure with handles and user data (see GUIDATA)
0579 
0580 if handles.clist_choice.Value == 1
0581     handles.multi_clist = [];
0582 elseif isstruct(handles.multi_clist)
0583     handles.multi_clist(handles.clist_choice.Value-1) =[];
0584 else
0585     handles.multi_clist{handles.clist_choice.Value-1} =[];
0586     handles.multi_clist =  handles.multi_clist(~cellfun('isempty', handles.multi_clist))
0587 end
0588 
0589 handles.clist_choice.Value = 1;
0590 updateGui(hObject,handles);
0591 
0592 % --- Executes on selection change in def3d.
0593 function def3d_Callback(hObject, eventdata, handles)
0594 % hObject    handle to def3d (see GCBO)
0595 % eventdata  reserved - to be defined in a future version of MATLAB
0596 % handles    structure with handles and user data (see GUIDATA)
0597 
0598 % Hints: contents = cellstr(get(hObject,'String')) returns def3d contents as cell array
0599 %        contents{get(hObject,'Value')} returns selected item from def3d
0600 
0601 
0602 % --- Executes during object creation, after setting all properties.
0603 function def3d_CreateFcn(hObject, eventdata, handles)
0604 % hObject    handle to def3d (see GCBO)
0605 % eventdata  reserved - to be defined in a future version of MATLAB
0606 % handles    empty - handles not created until after all CreateFcns called
0607 
0608 % Hint: popupmenu controls usually have a white background on Windows.
0609 %       See ISPC and COMPUTER.
0610 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0611     set(hObject,'BackgroundColor','white');
0612 end
0613 
0614 
0615 % --- Executes on button press in make_gate.
0616 function make_gate_Callback(hObject, eventdata, handles)
0617 % hObject    handle to make_gate (see GCBO)
0618 % eventdata  reserved - to be defined in a future version of MATLAB
0619 % handles    structure with handles and user data (see GUIDATA)
0620 
0621 index1 = handles.def1.Value - 1;
0622 index2 = handles.def2.Value - 1;
0623 
0624 
0625 varg = {'make'};
0626 
0627 if ~index1 && ~index2
0628     msgbox ('choose an index')
0629 elseif index1~=0 && index2 == 0
0630     varg{end+1} = index1;
0631 elseif index1==0 && index2 ~= 0
0632     varg{end+1} = index2;
0633 elseif index1~=0 && index2 ~= 0
0634     varg{end+1} = [index1, index2];
0635 end
0636 
0637 % merges them permanently.. careful!
0638 if handles.merge.Value
0639     varg{end+1} = 'merge';
0640 end
0641 
0642 if index1 || index2
0643     if handles.clist_choice.Value == 1
0644         if handles.replace_flag        
0645             handles.multi_clist = gateTool(handles.multi_clist,varg{:},'no clear','newfig');
0646         else
0647             tmp_clist = gateTool(handles.multi_clist,varg{:},'merge','no clear','newfig');
0648             tmp_clist.name = 'all_gated';
0649             handles.multi_clist{end+1} = tmp_clist;
0650         end
0651     elseif isstruct(handles.multi_clist)
0652         if handles.replace_flag
0653             handles.multi_clist(handles.clist_choice.Value-1) = gateTool(handles.multi_clist(handles.clist_choice.Value-1),varg{:},'no clear','newfig');
0654         else
0655             tmp = handles.multi_clist;
0656             handles.multi_clist = {};
0657             handles.multi_clist{1} = tmp;
0658             name_bef = tmp.name;
0659             handles.multi_clist{2} = gateTool(tmp,varg{:},'no clear','newfig');
0660             handles.clist_choice.Value = numel(handles.multi_clist)+1;
0661             handles  = naming_func (handles,[name_bef,'gated']);
0662         end
0663     else
0664         if handles.replace_flag
0665             handles.multi_clist{handles.clist_choice.Value-1} = gateTool(handles.multi_clist{handles.clist_choice.Value-1},varg{:},'no clear','newfig');
0666         else
0667             name_bef = handles.multi_clist{handles.clist_choice.Value-1}.name;
0668             handles.multi_clist{end+1} = gateTool(handles.multi_clist{handles.clist_choice.Value-1},varg{:},'no clear','newfig');
0669             handles.clist_choice.Value = numel(handles.multi_clist)+1;
0670             handles = naming_func (handles,[name_bef,'gated']);
0671         end
0672     end
0673 end
0674 updateGui(hObject,handles);
0675 guidata(hObject,handles);
0676 
0677 
0678 
0679 function dirname_Callback(hObject, eventdata, handles)
0680 % hObject    handle to dirname (see GCBO)
0681 % eventdata  reserved - to be defined in a future version of MATLAB
0682 % handles    structure with handles and user data (see GUIDATA)
0683 
0684 % Hints: get(hObject,'String') returns contents of dirname as text
0685 %        str2double(get(hObject,'String')) returns contents of dirname as a double
0686 
0687 
0688 % --- Executes during object creation, after setting all properties.
0689 function dirname_CreateFcn(hObject, eventdata, handles)
0690 % hObject    handle to dirname (see GCBO)
0691 % eventdata  reserved - to be defined in a future version of MATLAB
0692 % handles    empty - handles not created until after all CreateFcns called
0693 
0694 % Hint: edit controls usually have a white background on Windows.
0695 %       See ISPC and COMPUTER.
0696 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0697     set(hObject,'BackgroundColor','white');
0698 end
0699 
0700 
0701 % --------------------------------------------------------------------
0702 function uipushtool1_ClickedCallback(hObject, eventdata, handles)
0703 % hObject    handle to uipushtool1 (see GCBO)
0704 % eventdata  reserved - to be defined in a future version of MATLAB
0705 % handles    structure with handles and user data (see GUIDATA)
0706 handles.dirname.String = uigetdir;
0707 guidata(hObject,handles);
0708 
0709 % --------------------------------------------------------------------
0710 function hist_tool_ClickedCallback(hObject, eventdata, handles)
0711 % hObject    handle to hist_tool (see GCBO)
0712 % eventdata  reserved - to be defined in a future version of MATLAB
0713 % handles    structure with handles and user data (see GUIDATA)
0714 handles.hist.Value = 1;
0715 show_gates_Callback(hObject, eventdata, handles);
0716 handles.hist.Value = 0;
0717 
0718 % --------------------------------------------------------------------
0719 function contour_tool_ClickedCallback(hObject, eventdata, handles)
0720 % hObject    handle to contour_tool (see GCBO)
0721 % eventdata  reserved - to be defined in a future version of MATLAB
0722 % handles    structure with handles and user data (see GUIDATA)
0723 handles.kde.Value = 1;
0724 show_gates_Callback(hObject, eventdata, handles);
0725 handles.kde.Value = 0;
0726 
0727 
0728 % --------------------------------------------------------------------
0729 function scatter_tool_ClickedCallback(hObject, eventdata, handles)
0730 % hObject    handle to scatter_tool (see GCBO)
0731 % eventdata  reserved - to be defined in a future version of MATLAB
0732 % handles    structure with handles and user data (see GUIDATA)
0733 handles.dot.Value = 1;
0734 show_gates_Callback(hObject, eventdata, handles);
0735 handles.dot.Value = 0;
0736 
0737 % --------------------------------------------------------------------
0738 function debug_ClickedCallback(hObject, eventdata, handles)
0739 % hObject    handle to debug (see GCBO)
0740 % eventdata  reserved - to be defined in a future version of MATLAB
0741 % handles    structure with handles and user data (see GUIDATA)
0742 keyboard;
0743 
0744 
0745 % --- Executes on button press in close_figs.
0746 function close_figs_Callback(hObject, eventdata, handles)
0747 % hObject    handle to close_figs (see GCBO)
0748 % eventdata  reserved - to be defined in a future version of MATLAB
0749 % handles    structure with handles and user data (see GUIDATA)
0750 
0751 fh=findall(0,'Type','Figure');
0752 for i = 1 : numel(fh)
0753     if ~strcmp(fh(i).Name,'gateToolGui')
0754         close(fh(i));
0755     end
0756 end
0757 
0758 % --- Executes on button press in clear_gate.
0759 function clear_gate_Callback(hObject, eventdata, handles)
0760 % hObject    handle to clear_gate (see GCBO)
0761 % eventdata  reserved - to be defined in a future version of MATLAB
0762 % handles    structure with handles and user data (see GUIDATA)
0763 
0764 if handles.clist_choice.Value == 1
0765    handles.multi_clist = gateTool(handles.multi_clist,'clear');
0766 elseif isstruct(handles.multi_clist)
0767    handles.multi_clist(handles.clist_choice.Value-1) = gateTool(handles.multi_clist(handles.clist_choice.Value-1),'clear');
0768 else
0769    handles.multi_clist{handles.clist_choice.Value-1} = gateTool(handles.multi_clist{handles.clist_choice.Value-1},'clear');
0770 end
0771 
0772 updateGui(hObject,handles);
0773 guidata(hObject,handles);
0774 
0775 function handles = naming_func (handles,name)
0776 if handles.clist_choice.Value == 1
0777     handles.multi_clist = gateTool(handles.multi_clist,'name',name);
0778 elseif isstruct(handles.multi_clist)
0779     handles.multi_clist(handles.clist_choice.Value-1) = gateTool(handles.multi_clist(handles.clist_choice.Value-1),'name',name);
0780 else
0781     handles.multi_clist{handles.clist_choice.Value-1} = gateTool(handles.multi_clist{handles.clist_choice.Value-1},'name',name);
0782 end
0783 
0784 
0785 % --- Executes on button press in name.
0786 function name_Callback(hObject, eventdata, handles)
0787 % hObject    handle to name (see GCBO)
0788 % eventdata  reserved - to be defined in a future version of MATLAB
0789 % handles    structure with handles and user data (see GUIDATA)
0790 
0791 
0792 name = getString ('Clist name', 'Type clist name');
0793 handles = naming_func (handles,name);
0794 updateGui(hObject,handles)
0795 
0796 function num_return = getNumber (dlg_title, prompt)
0797 
0798 num_lines = 1;
0799 a = inputdlg(prompt,dlg_title,num_lines);
0800 
0801 if ~isempty(a) % did not press cancel
0802     num_return = str2double(a(1));
0803 else
0804     num_return = [];
0805 end
0806 
0807 
0808 function str_return = getString (dlg_title, prompt)
0809 
0810 num_lines = 1;
0811 a = inputdlg(prompt,dlg_title,num_lines);
0812 if ~isempty(a) % did not press cancel
0813     str_return = a{1};
0814 else
0815     str_return = [];
0816 end
0817 
0818 
0819 % --- Executes on selection change in clist_choice.
0820 function clist_choice_Callback(hObject, eventdata, handles)
0821 % hObject    handle to clist_choice (see GCBO)
0822 % eventdata  reserved - to be defined in a future version of MATLAB
0823 % handles    structure with handles and user data (see GUIDATA)
0824 
0825 % Hints: contents = cellstr(get(hObject,'String')) returns clist_choice contents as cell array
0826 %        contents{get(hObject,'Value')} returns selected item from clist_choice
0827 
0828 
0829 % --- Executes during object creation, after setting all properties.
0830 function clist_choice_CreateFcn(hObject, eventdata, handles)
0831 % hObject    handle to clist_choice (see GCBO)
0832 % eventdata  reserved - to be defined in a future version of MATLAB
0833 % handles    empty - handles not created until after all CreateFcns called
0834 
0835 % Hint: popupmenu controls usually have a white background on Windows.
0836 %       See ISPC and COMPUTER.
0837 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0838     set(hObject,'BackgroundColor','white');
0839 end
0840 
0841 
0842 % --- Executes on button press in replace.
0843 function replace_Callback(hObject, eventdata, handles)
0844 % hObject    handle to replace (see GCBO)
0845 % eventdata  reserved - to be defined in a future version of MATLAB
0846 % handles    structure with handles and user data (see GUIDATA)
0847 
0848 % Hint: get(hObject,'Value') returns toggle state of replace
0849 if get(hObject,'Value')
0850     handles.replace_flag = 1;
0851 else
0852     handles.replace_flag = 0;
0853 end
0854 guidata(hObject,handles);
0855 
0856 % --- Executes on button press in x_box.
0857 function x_box_Callback(hObject, eventdata, handles)
0858 % hObject    handle to x_box (see GCBO)
0859 % eventdata  reserved - to be defined in a future version of MATLAB
0860 % handles    structure with handles and user data (see GUIDATA)
0861 
0862 % Hint: get(hObject,'Value') returns toggle state of x_box
0863 
0864 
0865 % --- Executes on button press in y_box.
0866 function y_box_Callback(hObject, eventdata, handles)
0867 % hObject    handle to y_box (see GCBO)
0868 % eventdata  reserved - to be defined in a future version of MATLAB
0869 % handles    structure with handles and user data (see GUIDATA)
0870 
0871 % Hint: get(hObject,'Value') returns toggle state of y_box
0872 
0873 
0874 % --- Executes on button press in z_box.
0875 function z_box_Callback(hObject, eventdata, handles)
0876 % hObject    handle to z_box (see GCBO)
0877 % eventdata  reserved - to be defined in a future version of MATLAB
0878 % handles    structure with handles and user data (see GUIDATA)
0879 
0880 % Hint: get(hObject,'Value') returns toggle state of z_box
0881 
0882 
0883 % --- Executes on button press in density.
0884 function density_Callback(hObject, eventdata, handles)
0885 % hObject    handle to density (see GCBO)
0886 % eventdata  reserved - to be defined in a future version of MATLAB
0887 % handles    structure with handles and user data (see GUIDATA)
0888 
0889 % Hint: get(hObject,'Value') returns toggle state of density
0890 if get(hObject,'Value')
0891     handles.cond.Value = 0
0892 end
0893 
0894 
0895 % --- Executes on button press in line.
0896 function line_Callback(hObject, eventdata, handles)
0897 % hObject    handle to line (see GCBO)
0898 % eventdata  reserved - to be defined in a future version of MATLAB
0899 % handles    structure with handles and user data (see GUIDATA)
0900 
0901 % Hint: get(hObject,'Value') returns toggle state of line

Generated on Thu 19-Jan-2017 13:55:21 by m2html © 2005