[1001] | 1 |
|
---|
| 2 |
|
---|
| 3 |
|
---|
[867] | 4 | %'series': master function associated to the GUI series.m for analysis field series
|
---|
| 5 | %------------------------------------------------------------------------
|
---|
| 6 | % function varargout = series(varargin)
|
---|
| 7 | % associated with the GUI series.fig
|
---|
| 8 | %
|
---|
| 9 | %INPUT
|
---|
| 10 | % param: structure with input parameters (link with the GUI uvmat)
|
---|
| 11 | % .menu_coord_str: string for the TransformName (menu for coordinate transforms)
|
---|
| 12 | % .menu_coord_val: value for TransformName (menu for coordinate transforms)
|
---|
| 13 | % .FileName: input file name
|
---|
| 14 | % .FileName_1: second input file name
|
---|
| 15 | % .list_field: menu of input fields
|
---|
| 16 | % .index_fields: chosen index
|
---|
| 17 | % .civ1=0 or 1, .interp1, ... : input civ field type
|
---|
| 18 | %
|
---|
[924] | 19 |
|
---|
| 20 | %=======================================================================
|
---|
[977] | 21 | % Copyright 2008-2017, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
|
---|
[924] | 22 | % http://www.legi.grenoble-inp.fr
|
---|
| 23 | % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
|
---|
| 24 | %
|
---|
[867] | 25 | % This file is part of the toolbox UVMAT.
|
---|
[924] | 26 | %
|
---|
[867] | 27 | % UVMAT is free software; you can redistribute it and/or modify
|
---|
[924] | 28 | % it under the terms of the GNU General Public License as published
|
---|
| 29 | % by the Free Software Foundation; either version 2 of the license,
|
---|
| 30 | % or (at your option) any later version.
|
---|
| 31 | %
|
---|
[867] | 32 | % UVMAT is distributed in the hope that it will be useful,
|
---|
| 33 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 34 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
[924] | 35 | % GNU General Public License (see LICENSE.txt) for more details.
|
---|
| 36 | %=======================================================================
|
---|
[867] | 37 |
|
---|
| 38 | %------------------------------------------------------------------------
|
---|
| 39 | %------------------------------------------------------------------------
|
---|
| 40 | % I - MAIN FUNCTION series
|
---|
| 41 | %------------------------------------------------------------------------
|
---|
| 42 | %------------------------------------------------------------------------
|
---|
| 43 | function varargout = series(varargin)
|
---|
| 44 |
|
---|
| 45 | % Begin initialization code - DO NOT EDIT
|
---|
| 46 | gui_Singleton = 1;
|
---|
| 47 | gui_State = struct('gui_Name', mfilename, ...
|
---|
| 48 | 'gui_Singleton', gui_Singleton, ...
|
---|
| 49 | 'gui_OpeningFcn', @series_OpeningFcn, ...
|
---|
| 50 | 'gui_OutputFcn', @series_OutputFcn, ...
|
---|
| 51 | 'gui_LayoutFcn', [] , ...
|
---|
| 52 | 'gui_Callback', []);
|
---|
| 53 | if nargin && ischar(varargin{1})
|
---|
| 54 | gui_State.gui_Callback = str2func(varargin{1});
|
---|
| 55 | end
|
---|
| 56 |
|
---|
| 57 | if nargout
|
---|
| 58 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
|
---|
| 59 | else
|
---|
| 60 | gui_mainfcn(gui_State, varargin{:});
|
---|
| 61 | end
|
---|
| 62 | % End initialization code - DO NOT EDIT
|
---|
| 63 |
|
---|
| 64 | %--------------------------------------------------------------------------
|
---|
| 65 | % --- Executes just before series is made visible.
|
---|
| 66 | %--------------------------------------------------------------------------
|
---|
| 67 | function series_OpeningFcn(hObject, eventdata, handles,Param)
|
---|
| 68 |
|
---|
| 69 | % Choose default command line output for series
|
---|
| 70 | handles.output = hObject;
|
---|
| 71 | % Update handles structure
|
---|
| 72 | guidata(hObject, handles);
|
---|
| 73 |
|
---|
| 74 | %% initial settings
|
---|
| 75 | % position and size of the GUI at opening
|
---|
| 76 | set(0,'Unit','points')
|
---|
[992] | 77 | ScreenSize=get(0,'ScreenSize'); % size of the current screen, in points (1/72 inch)
|
---|
| 78 | Width=900; % prefered width of the GUI in points (1/72 inch)
|
---|
| 79 | Height=624; % prefered height of the GUI in points (1/72 inch)
|
---|
[867] | 80 | %adjust to screen size (reduced by a min margin)
|
---|
| 81 | RescaleFactor=min((ScreenSize(3)-80)/Width,(ScreenSize(4)-80)/Height);
|
---|
| 82 | if RescaleFactor>1
|
---|
| 83 | RescaleFactor=min(RescaleFactor,1);
|
---|
| 84 | end
|
---|
| 85 | Width=Width*RescaleFactor;
|
---|
| 86 | Height=Height*RescaleFactor;
|
---|
[992] | 87 | LeftX=80*RescaleFactor; % position of the left fig side, in pixels (put to the left side, with some margin)
|
---|
[867] | 88 | LowY=round(ScreenSize(4)/2-Height/2); % put at the middle height on the screen
|
---|
| 89 | set(hObject,'Units','points')
|
---|
| 90 | set(hObject,'Position',[LeftX LowY Width Height])% position and size of the GUI at opening
|
---|
| 91 |
|
---|
| 92 | % settings of table MinIndex_j
|
---|
| 93 | set(handles.MinIndex_i,'ColumnFormat',{'numeric'})
|
---|
| 94 | set(handles.MinIndex_i,'ColumnEditable',false)
|
---|
| 95 | set(handles.MinIndex_i,'ColumnName',{'i min'})
|
---|
| 96 | set(handles.MinIndex_i,'Data',[])% initiate Data to double (not cell)
|
---|
| 97 |
|
---|
| 98 | % settings of table MinIndex_j
|
---|
| 99 | set(handles.MinIndex_j,'ColumnFormat',{'numeric'})
|
---|
| 100 | set(handles.MinIndex_j,'ColumnEditable',false)
|
---|
| 101 | set(handles.MinIndex_j,'ColumnName',{'j min'})
|
---|
| 102 | set(handles.MinIndex_j,'Data',[])% initiate Data to double (not cell)
|
---|
| 103 |
|
---|
| 104 | % settings of table MaxIndex_i
|
---|
| 105 | set(handles.MaxIndex_i,'ColumnFormat',{'numeric'})
|
---|
| 106 | set(handles.MaxIndex_i,'ColumnEditable',false)
|
---|
| 107 | set(handles.MaxIndex_i,'ColumnName',{'i max'})
|
---|
| 108 | set(handles.MaxIndex_i,'Data',[])% initiate Data to double (not cell)
|
---|
| 109 |
|
---|
| 110 | % settings of table MaxIndex_j
|
---|
| 111 | set(handles.MaxIndex_j,'ColumnFormat',{'numeric'})
|
---|
| 112 | set(handles.MaxIndex_j,'ColumnEditable',false)
|
---|
| 113 | set(handles.MaxIndex_j,'ColumnName',{'j max'})
|
---|
| 114 | set(handles.MaxIndex_j,'Data',[])% initiate Data to double (not cell)
|
---|
| 115 |
|
---|
| 116 | % settings of table PairString
|
---|
| 117 | set(handles.PairString,'ColumnName',{'pairs'})
|
---|
| 118 | set(handles.PairString,'ColumnEditable',false)
|
---|
| 119 | set(handles.PairString,'ColumnFormat',{'char'})
|
---|
| 120 | set(handles.PairString,'Data',{''})
|
---|
| 121 |
|
---|
| 122 | % settings of table MaskTable
|
---|
| 123 | set(handles.MaskTable,'ColumnName',{'mask name'})
|
---|
| 124 | set(handles.PairString,'ColumnEditable',false)
|
---|
| 125 | set(handles.PairString,'ColumnFormat',{'char'})
|
---|
| 126 | set(handles.PairString,'Data',{''})
|
---|
| 127 |
|
---|
| 128 | series_ResizeFcn(hObject, eventdata, handles)%resize table according to series GUI size
|
---|
| 129 | set(hObject,'WindowButtonDownFcn',{'mouse_down'})%allows mouse action with right button (zoom for uicontrol display)
|
---|
| 130 | set(hObject,'DeleteFcn',{@closefcn})%
|
---|
| 131 |
|
---|
| 132 | % check default input data
|
---|
| 133 | if ~exist('Param','var')
|
---|
[992] | 134 | Param=[]; % default
|
---|
[867] | 135 | end
|
---|
| 136 |
|
---|
[994] | 137 | %% Read the parameter file series.xml, or created from series.xml.default if it does not exist
|
---|
[996] | 138 | SeriesData=[];
|
---|
[994] | 139 | [path_series,name,ext]=fileparts(which('series'));% path to the GUI series
|
---|
| 140 | xmlfile=fullfile(path_series,'series.xml');
|
---|
| 141 | if ~exist(xmlfile,'file')
|
---|
| 142 | [success,message]=copyfile(fullfile(path_series,'series.xml.default'),xmlfile);
|
---|
| 143 | end
|
---|
| 144 | if exist(xmlfile,'file')
|
---|
| 145 | SeriesData.SeriesParam=xml2struct(xmlfile);
|
---|
| 146 | end
|
---|
| 147 |
|
---|
| 148 | %% list of builtin functions in the menu ActionName
|
---|
[992] | 149 | ActionList={'check_data_files';'aver_stat';'time_series';'civ_series';'merge_proj'}; % WARNING: fits with nb_builtin_ACTION=4 in ActionName_callback
|
---|
[867] | 150 | NbBuiltinAction=numel(ActionList);
|
---|
| 151 | set(handles.Action,'UserData',NbBuiltinAction)
|
---|
[994] | 152 | path_series_fct=fullfile(path_series,'series');%path of the functions in subdirectroy 'series'
|
---|
[992] | 153 | [path_series,name,ext]=fileparts(which('series')); % path to the GUI series
|
---|
| 154 | path_series_fct=fullfile(path_series,'series'); % path of the functions in subdirectroy 'series'
|
---|
[1003] | 155 | command = ['LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | pyp "l = x.split('':''); l = [s for s in l if ''matlab'' not in s]; print('':''.join(l))") ' ...
|
---|
[1004] | 156 | 'python -c "import fluidimage"'];
|
---|
[1003] | 157 | [code, ~] = system(command);
|
---|
[872] | 158 | if code==0
|
---|
[992] | 159 | ActionExtList={'.m';'.sh';'.py (in dev.)'}; % default choice of extensions (Matlab fct .m or compiled version .sh
|
---|
[872] | 160 | else
|
---|
[880] | 161 | ActionExtList={'.m';'.sh'}; % python options not installed
|
---|
[872] | 162 | end
|
---|
[992] | 163 | ActionPathList=cell(NbBuiltinAction,1); % initiate the cell matrix of Action fct paths
|
---|
| 164 | ActionPathList(:)={path_series_fct}; % set the default path to series fcts to all list members
|
---|
| 165 | RunModeList={'local';'background'}; % default choice of extensions (Matlab fct .m or compiled version .sh)
|
---|
| 166 | [s,w]=system('oarstat'); % look for cluster system 'oar'
|
---|
[867] | 167 | if isequal(s,0)
|
---|
| 168 | RunModeList=[RunModeList;{'cluster_oar'}];
|
---|
[880] | 169 | set(handles.MonitorCluster,'Visible','on'); % make visible button for access to Monika
|
---|
[914] | 170 | set(handles.num_CPUTime,'Visible','on'); % make visible button for access to Monika
|
---|
| 171 | set(handles.CPUTime_txt,'Visible','on'); % make visible button for access to Monika
|
---|
[867] | 172 | end
|
---|
[992] | 173 | [s,w]=system('qstat -help'); % look for cluster system 'sge'
|
---|
[867] | 174 | if isequal(s,0)
|
---|
[882] | 175 | if regexp(w,'^pbs')
|
---|
| 176 | RunModeList=[RunModeList;{'cluster_pbs'}];
|
---|
[984] | 177 | elseif regexp(w,'^SGE')
|
---|
| 178 | RunModeList=[RunModeList;{'cluster_sge'}];
|
---|
[882] | 179 | else
|
---|
[984] | 180 | RunModeList=[RunModeList;{'cluster_qstat_unknown'}];
|
---|
[882] | 181 | end
|
---|
[867] | 182 | end
|
---|
[984] | 183 | set(handles.RunMode,'String',RunModeList)% display the menu of available run modes, local, background or cluster manager
|
---|
[867] | 184 |
|
---|
| 185 | %% list of builtin transform functions in the menu TransformName
|
---|
[992] | 186 | TransformList={'';'sub_field';'phys';'phys_polar'}; % WARNING: must fit with the corresponding menu in uvmat and nb_builtin_transform=4 in TransformName_callback
|
---|
[867] | 187 | NbBuiltinTransform=numel(TransformList);
|
---|
| 188 | path_transform_fct=fullfile(path_series,'transform_field');
|
---|
[992] | 189 | TransformPathList=cell(NbBuiltinTransform,1); % initiate the cell matrix of Action fct paths
|
---|
| 190 | TransformPathList(:)={path_transform_fct}; % set the default path to series fcts to all list members
|
---|
[1001] | 191 | SeriesData.TransformPath=path_transform_fct;% store the standard path for trqnsform functions (needed for compilation)
|
---|
[867] | 192 |
|
---|
| 193 | %% get the user defined functions stored in the personal file uvmat_perso.mat
|
---|
| 194 | dir_perso=prefdir;
|
---|
| 195 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
|
---|
| 196 | if exist(profil_perso,'file')
|
---|
| 197 | h=load (profil_perso);
|
---|
| 198 | %get the list of previous input files in the upper bar menu Open
|
---|
| 199 | if isfield(h,'MenuFile')
|
---|
| 200 | for ifile=1:min(length(h.MenuFile),5)
|
---|
| 201 | set(handles.(['MenuFile_' num2str(ifile)]),'Label',h.MenuFile{ifile});
|
---|
| 202 | set(handles.(['MenuFile_' num2str(ifile+5)]),'Label',h.MenuFile{ifile});
|
---|
| 203 | end
|
---|
| 204 | end
|
---|
| 205 | %get the list of previous campaigns in the upper bar menu Open campaign
|
---|
| 206 | if isfield(h,'MenuCampaign')
|
---|
| 207 | for ifile=1:min(length(h.MenuCampaign),5)
|
---|
| 208 | set(handles.(['MenuCampaign_' num2str(ifile)]),'Label',h.MenuCampaign{ifile});
|
---|
| 209 | end
|
---|
| 210 | end
|
---|
| 211 | %get the menu of actions
|
---|
[872] | 212 | % if isfield(h,'ActionExtListUser') && iscell(h.ActionExtListUser)
|
---|
| 213 | % ActionExtList=[ActionExtList; h.ActionExtListUser];
|
---|
| 214 | % end
|
---|
[867] | 215 | if isfield(h,'ActionListUser') && iscell(h.ActionListUser) && isfield(h,'ActionPathListUser') && iscell(h.ActionPathListUser)
|
---|
| 216 | ActionList=[ActionList;h.ActionListUser];
|
---|
| 217 | ActionPathList=[ActionPathList;h.ActionPathListUser(:,1)];
|
---|
| 218 | end
|
---|
| 219 | %get the menu of transform fct
|
---|
| 220 | if isfield(h,'TransformListUser') && iscell(h.TransformListUser) && isfield(h,'TransformPathListUser') && iscell(h.TransformPathListUser)
|
---|
| 221 | TransformList=[TransformList;h.TransformListUser];
|
---|
| 222 | TransformPathList=[TransformPathList;h.TransformPathListUser];
|
---|
| 223 | end
|
---|
| 224 | end
|
---|
| 225 |
|
---|
| 226 | %% selection of the input Action fct
|
---|
[992] | 227 | ActionCheckExist=true(size(ActionList)); % initiate the check of the path to the listed action fct
|
---|
[867] | 228 | for ilist=NbBuiltinAction+1:numel(ActionList)%check the validity of the path of the user defined Action fct
|
---|
| 229 | ActionCheckExist(ilist)=exist(fullfile(ActionPathList{ilist},[ActionList{ilist} '.m']),'file');
|
---|
| 230 | end
|
---|
[992] | 231 | ActionPathList=ActionPathList(ActionCheckExist,:); % suppress the menu options which are not valid anymore
|
---|
[867] | 232 | ActionList=ActionList(ActionCheckExist);
|
---|
| 233 | set(handles.ActionName,'String',[ActionList;{'more...'}])
|
---|
| 234 | set(handles.ActionName,'UserData',ActionPathList)
|
---|
| 235 | ActionIndex=[];
|
---|
| 236 | if isfield(Param,'ActionName')% copy the selected menu index transferred in Param from uvmat
|
---|
| 237 | ActionIndex=find(strcmp(Param.ActionName,ActionList),1);
|
---|
| 238 | end
|
---|
| 239 | if isempty(ActionIndex)
|
---|
| 240 | ActionIndex=1;
|
---|
| 241 | end
|
---|
| 242 | set(handles.ActionName,'Value',ActionIndex)
|
---|
| 243 | set(handles.ActionPath,'String',ActionPathList{ActionIndex})
|
---|
| 244 | set(handles.ActionExt,'Value',1)
|
---|
| 245 | set(handles.ActionExt,'String',ActionExtList)
|
---|
| 246 |
|
---|
| 247 | %% selection of the input transform fct
|
---|
| 248 | TransformCheckExist=true(size(TransformList));
|
---|
| 249 | for ilist=NbBuiltinTransform+1:numel(TransformList)
|
---|
| 250 | TransformCheckExist(ilist)=exist(fullfile(TransformPathList{ilist},[TransformList{ilist} '.m']),'file');
|
---|
| 251 | end
|
---|
| 252 | TransformPathList=TransformPathList(TransformCheckExist);
|
---|
| 253 | TransformList=TransformList(TransformCheckExist);
|
---|
| 254 | set(handles.TransformName,'String',[TransformList;{'more...'}])
|
---|
| 255 | set(handles.TransformName,'UserData',TransformPathList)
|
---|
| 256 | TransformIndex=[];
|
---|
| 257 | if isfield(Param,'TransformName')% copy the selected menu index transferred in Param from uvmat
|
---|
| 258 | TransformIndex=find(strcmp(Param.TransformName,TransformList),1);
|
---|
| 259 | end
|
---|
| 260 | if isempty(TransformIndex)
|
---|
| 261 | TransformIndex=1;
|
---|
| 262 | end
|
---|
| 263 | set(handles.TransformName,'Value',TransformIndex)
|
---|
| 264 | set(handles.TransformPath,'String',TransformPathList{TransformIndex})
|
---|
| 265 |
|
---|
| 266 | %% fields input initialisation
|
---|
| 267 | if isfield(Param,'list_fields')&& isfield(Param,'index_fields') &&~isempty(Param.list_fields) &&~isempty(Param.index_fields)
|
---|
[992] | 268 | set(handles.FieldName,'String',Param.list_fields); % list menu fields
|
---|
| 269 | set(handles.FieldName,'Value',Param.index_fields); % selected string index
|
---|
[867] | 270 | end
|
---|
[869] | 271 | if isfield(Param,'Coordinates')
|
---|
| 272 | if isfield(Param.Coordinates,'Coord_x')
|
---|
| 273 | set(handles.Coord_x,'String',Param.Coordinates.Coord_x)
|
---|
| 274 | end
|
---|
| 275 | if isfield(Param.Coordinates,'Coord_y')
|
---|
| 276 | set(handles.Coord_y,'String',Param.Coordinates.Coord_y)
|
---|
| 277 | end
|
---|
| 278 | if isfield(Param.Coordinates,'Coord_z')
|
---|
| 279 | set(handles.Coord_z,'String',Param.Coordinates.Coord_z)
|
---|
| 280 | end
|
---|
[867] | 281 | end
|
---|
[869] | 282 | % if isfield(Param,'Coord_x_str') && ischar(Param.Coord_x_str)
|
---|
[992] | 283 | % set(handles.Coord_x,'String',Param.Coord_x_str); % list menu fields
|
---|
[869] | 284 | % end
|
---|
| 285 | % if isfield(Param,'Coord_y_str')&& ischar(Param.Coord_y_str)
|
---|
[992] | 286 | % set(handles.Coord_y,'String',Param.Coord_y_str); % list menu fields
|
---|
[869] | 287 | % end
|
---|
[867] | 288 |
|
---|
| 289 | %% introduce the input file name(s) if defined from input Param,
|
---|
[996] | 290 | set(handles.series,'UserData',SeriesData)% initiate Userdata
|
---|
[867] | 291 | if isfield(Param,'InputFile')
|
---|
| 292 |
|
---|
| 293 | %% fill the list of file series
|
---|
| 294 | InputTable=[{Param.InputFile.RootPath},{Param.InputFile.SubDir},{Param.InputFile.RootFile},{Param.InputFile.NomType},{Param.InputFile.FileExt}];
|
---|
[992] | 295 | if isempty(find(cellfun('isempty',InputTable)==0)); % if there is no input file, do not introduce input info
|
---|
[909] | 296 | set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color to indicate that input refresh is needed
|
---|
| 297 | return
|
---|
| 298 | end
|
---|
[867] | 299 | TimeTable=[{Param.InputFile.TimeName},{[]},{[]},{[]},{[]}];
|
---|
| 300 | if isfield(Param.InputFile,'RootPath_1')
|
---|
| 301 | InputTable=[InputTable;[{Param.InputFile.RootPath_1},{Param.InputFile.SubDir_1},{Param.InputFile.RootFile_1},{Param.InputFile.NomType_1},{Param.InputFile.FileExt_1}]];
|
---|
| 302 | TimeTable=[TimeTable; [{Param.InputFile.TimeName_1},{[]},{[]},{[]},{[]}]];
|
---|
| 303 | end
|
---|
| 304 | set(handles.InputTable,'Data',InputTable)
|
---|
| 305 | %% determine the selected reference field indices for pair display
|
---|
| 306 |
|
---|
| 307 | [tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(Param.InputFile.FileIndex);
|
---|
| 308 | if isempty(i1)
|
---|
| 309 | i1=1;
|
---|
| 310 | end
|
---|
| 311 | if isempty(i2)
|
---|
| 312 | i2=i1;
|
---|
| 313 | end
|
---|
[992] | 314 | ref_i=floor((i1+i2)/2); % reference image number corresponding to the file
|
---|
[867] | 315 | % set(handles.num_ref_i,'String',num2str(ref_i));
|
---|
| 316 | if isempty(j1)
|
---|
| 317 | j1=1;
|
---|
| 318 | end
|
---|
| 319 | if isempty(j2)
|
---|
| 320 | j2=j1;
|
---|
| 321 | end
|
---|
[992] | 322 | ref_j=floor((j1+j2)/2); % reference image number corresponding to the file
|
---|
[867] | 323 | SeriesData.ref_i=ref_i;
|
---|
| 324 | SeriesData.ref_j=ref_j;
|
---|
| 325 | set(handles.series,'UserData',SeriesData)
|
---|
| 326 | update_rootinfo(handles,Param.HiddenData.i1_series{1},Param.HiddenData.i2_series{1},Param.HiddenData.j1_series{1},Param.HiddenData.j2_series{1},...
|
---|
| 327 | Param.HiddenData.FileInfo{1},Param.HiddenData.MovieObject{1},1)
|
---|
[869] | 328 | if isfield(Param,'FileName_1')
|
---|
[867] | 329 | % display_file_name(handles,Param,2)
|
---|
| 330 | update_rootinfo(handles,Param.HiddenData.i1_series{2},Param.HiddenData.i2_series{2},Param.HiddenData.j1_series{2},Param.HiddenData.j2_series{2},...
|
---|
| 331 | Param.HiddenData.FileInfo{2},Param.HiddenData.MovieObject{2},2)
|
---|
| 332 | end
|
---|
| 333 | %% enable field and veltype menus, in accordance with the current action
|
---|
[869] | 334 | ActionName_Callback([],[], handles)
|
---|
| 335 |
|
---|
| 336 | %% set length of waitbar
|
---|
| 337 | displ_time(handles)
|
---|
| 338 |
|
---|
[867] | 339 | else
|
---|
| 340 | set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color to indicate that input refresh is needed
|
---|
| 341 | end
|
---|
| 342 | if isfield(Param,'incr_i')
|
---|
| 343 | set(handles.num_incr_i,'String',num2str(Param.incr_i))
|
---|
| 344 | else
|
---|
| 345 | set(handles.num_incr_i,'String','1')
|
---|
| 346 | end
|
---|
| 347 | if isfield(Param,'incr_j')
|
---|
| 348 | set(handles.num_incr_j,'String',num2str(Param.incr_j))
|
---|
| 349 | else
|
---|
| 350 | set(handles.num_incr_j,'String','1')
|
---|
| 351 | end
|
---|
| 352 |
|
---|
| 353 | %------------------------------------------------------------------------
|
---|
| 354 | % --- Outputs from this function are returned to the command line.
|
---|
| 355 | function varargout = series_OutputFcn(hObject, eventdata, handles)
|
---|
| 356 | %------------------------------------------------------------------------
|
---|
| 357 | varargout{1} = handles.output;
|
---|
| 358 |
|
---|
| 359 | %------------------------------------------------------------------------
|
---|
| 360 | % --- executed when closing uvmat: delete or desactivate the associated figures if exist
|
---|
| 361 | function closefcn(gcbo,eventdata)
|
---|
| 362 | %------------------------------------------------------------------------
|
---|
| 363 |
|
---|
| 364 | % delete set_object_series if detected
|
---|
| 365 | hh=findobj(allchild(0),'name','view_object_series');
|
---|
| 366 | if ~isempty(hh)
|
---|
| 367 | delete(hh)
|
---|
| 368 | end
|
---|
| 369 | hh=findobj(allchild(0),'name','edit_object_series');
|
---|
| 370 | if ~isempty(hh)
|
---|
| 371 | delete(hh)
|
---|
| 372 | end
|
---|
| 373 |
|
---|
| 374 | %delete the bowser if detected
|
---|
| 375 | hh=findobj(allchild(0),'tag','browser');
|
---|
| 376 | if ~isempty(hh)
|
---|
| 377 | delete(hh)
|
---|
| 378 | end
|
---|
| 379 |
|
---|
| 380 |
|
---|
| 381 | %------------------------------------------------------------------------
|
---|
| 382 | %------------------------------------------------------------------------
|
---|
| 383 | % II - FUNCTIONS FOR INTRODUCING THE INPUT FILES
|
---|
| 384 | % automatically sets the global properties when the rootfile name is introduced
|
---|
| 385 | % then activate the view-field actionname if selected
|
---|
| 386 | % it is activated either by clicking on the RootPath window or by the
|
---|
| 387 | % browser
|
---|
| 388 | %------------------------------------------------------------------------
|
---|
| 389 | %------------------------------------------------------------------------
|
---|
| 390 | % --- fct activated by the browser under 'Open'
|
---|
| 391 | %------------------------------------------------------------------------
|
---|
| 392 | function MenuBrowse_Callback(hObject, eventdata, handles)
|
---|
| 393 | %% look for the previously opened file 'oldfile'
|
---|
| 394 | InputTable=get(handles.InputTable,'Data');
|
---|
| 395 | oldfile=InputTable{1,1};
|
---|
| 396 | if isempty(oldfile)
|
---|
| 397 | % use a file name stored in prefdir
|
---|
| 398 | dir_perso=prefdir;
|
---|
| 399 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
|
---|
| 400 | if exist(profil_perso,'file')
|
---|
| 401 | h=load (profil_perso);
|
---|
| 402 | if isfield(h,'RootPath') && ischar(h.RootPath)
|
---|
| 403 | oldfile=h.RootPath;
|
---|
| 404 | end
|
---|
| 405 | end
|
---|
| 406 | end
|
---|
| 407 | %% launch the browser
|
---|
| 408 | fileinput=uigetfile_uvmat('pick an input file in the series',oldfile);
|
---|
| 409 | hh=dir(fileinput);
|
---|
| 410 | if numel(hh)>1
|
---|
| 411 | msgbox_uvmat('ERROR','invalid input, probably a broken link');
|
---|
| 412 | else
|
---|
| 413 | if ~isempty(fileinput)
|
---|
| 414 | display_file_name(handles,fileinput,'one')
|
---|
| 415 | end
|
---|
| 416 | end
|
---|
| 417 |
|
---|
| 418 | % --------------------------------------------------------------------
|
---|
| 419 | function MenuBrowseAppend_Callback(hObject, eventdata, handles)
|
---|
| 420 |
|
---|
| 421 | %% look for the previously opened file 'oldfile'
|
---|
| 422 | InputTable=get(handles.InputTable,'Data');
|
---|
| 423 | RootPathCell=InputTable(:,1);
|
---|
| 424 | if isempty(RootPathCell{1})% no input file in the table
|
---|
| 425 | MenuBrowse_Callback(hObject, eventdata, handles)%refresh the input table, not append
|
---|
| 426 | return
|
---|
| 427 | end
|
---|
| 428 | SubDirCell=InputTable(:,2);
|
---|
| 429 | oldfile=fullfile(RootPathCell{1},SubDirCell{1});
|
---|
| 430 |
|
---|
| 431 | %% use a file name stored in prefdir
|
---|
| 432 | dir_perso=prefdir;
|
---|
| 433 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
|
---|
| 434 | if exist(profil_perso,'file')
|
---|
| 435 | h=load (profil_perso);
|
---|
| 436 | if isfield(h,'RootPath') && ischar(h.RootPath)
|
---|
| 437 | oldfile=h.RootPath;
|
---|
| 438 | end
|
---|
| 439 | end
|
---|
| 440 |
|
---|
| 441 | %% launch the browser
|
---|
| 442 | fileinput=uigetfile_uvmat('pick a file to append in the input table',oldfile);
|
---|
| 443 | hh=dir(fileinput);
|
---|
| 444 | if numel(hh)>1
|
---|
| 445 | msgbox_uvmat('ERROR','invalid input, probably a broken link');
|
---|
| 446 | else
|
---|
| 447 | if ~isempty(fileinput)
|
---|
| 448 | display_file_name(handles,fileinput,'append')
|
---|
| 449 | end
|
---|
| 450 | end
|
---|
| 451 |
|
---|
| 452 | %------------------------------------------------------------------------
|
---|
| 453 | % --- fct activated by selecting a previous file under the menu Open
|
---|
| 454 | %------------------------------------------------------------------------
|
---|
| 455 | function MenuFile_Callback(hObject, eventdata, handles)
|
---|
| 456 |
|
---|
| 457 | errormsg=display_file_name(handles,get(hObject,'Label'),'one');
|
---|
| 458 | if ~isempty(errormsg)
|
---|
| 459 | set(hObject,'Label','')
|
---|
| 460 | MenuFile=[{get(handles.MenuFile_1,'Label')};{get(handles.MenuFile_2,'Label')};...
|
---|
| 461 | {get(handles.MenuFile_3,'Label')};{get(handles.MenuFile_4,'Label')};{get(handles.MenuFile_5,'Label')}];
|
---|
| 462 | str_find=strcmp(get(hObject,'Label'),MenuFile);
|
---|
[992] | 463 | MenuFile(str_find)=[]; % suppress the input file to the list
|
---|
[867] | 464 | for ifile=1:numel(MenuFile)
|
---|
| 465 | set(handles.(['MenuFile_' num2str(ifile)]),'Label',MenuFile{ifile});
|
---|
| 466 | end
|
---|
| 467 | end
|
---|
| 468 |
|
---|
| 469 | %------------------------------------------------------------------------
|
---|
| 470 | % --- fct activated by selecting a previous file under the menu Open/append
|
---|
| 471 | %------------------------------------------------------------------------
|
---|
| 472 | function MenuFile_append_Callback(hObject, eventdata, handles)
|
---|
| 473 |
|
---|
| 474 | InputTable=get(handles.InputTable,'Data');
|
---|
| 475 | if isempty(InputTable{1,1})% no input file in the table
|
---|
| 476 | display_file_name(handles,get(hObject,'Label'),'one') %refresh the input table, not append
|
---|
| 477 | else
|
---|
| 478 | display_file_name(handles,get(hObject,'Label'),'append')% append the selected file to the current list of InputTable
|
---|
| 479 | end
|
---|
| 480 |
|
---|
| 481 | %------------------------------------------------------------------------
|
---|
| 482 | % --- fct activated by the browser under 'Open campaign/Browse...'
|
---|
| 483 | %------------------------------------------------------------------------
|
---|
| 484 | function MenuBrowseCampaign_Callback(hObject, eventdata, handles)
|
---|
| 485 |
|
---|
| 486 | %% look for the previously opened file 'oldfile'
|
---|
| 487 | InputTable=get(handles.InputTable,'Data');
|
---|
[937] | 488 | if ~isempty(InputTable)
|
---|
[934] | 489 | oldfile=fullfile(InputTable{1,1},InputTable{1,2});
|
---|
[937] | 490 | else
|
---|
[867] | 491 | % use a file name stored in prefdir
|
---|
| 492 | dir_perso=prefdir;
|
---|
| 493 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
|
---|
| 494 | if exist(profil_perso,'file')
|
---|
| 495 | h=load (profil_perso);
|
---|
[937] | 496 | if isfield(h,'MenuCampaign') && ~isempty(h.MenuCampaign)&& ischar(h.MenuCampaign{1})
|
---|
| 497 | oldfile=h.MenuCampaign{1};
|
---|
[867] | 498 | end
|
---|
| 499 | end
|
---|
| 500 | end
|
---|
[934] | 501 |
|
---|
[992] | 502 | OutPut=browse_data(oldfile,'on','on'); % open the GUI browse_data to get select a campaign dir, experiment and device
|
---|
[934] | 503 | NbLines=numel(OutPut.Experiment)*numel(OutPut.DataSeries);
|
---|
| 504 | icount=0;
|
---|
| 505 | for iexp=1:numel(OutPut.Experiment)
|
---|
| 506 | for idevice=1:numel(OutPut.DataSeries)
|
---|
| 507 | icount=icount+1;
|
---|
| 508 | InputTable{icount,1}=fullfile(OutPut.Campaign,OutPut.Experiment{iexp});
|
---|
| 509 | InputTable{icount,2}=OutPut.DataSeries{idevice};
|
---|
| 510 | if isempty(InputTable{icount,3})
|
---|
| 511 | if icount>1
|
---|
| 512 | InputTable{icount,3}=InputTable{icount-1,3};
|
---|
| 513 | else
|
---|
| 514 | InputTable{icount,3}='';
|
---|
| 515 | end
|
---|
| 516 | end
|
---|
| 517 | if isempty(InputTable{icount,4})
|
---|
| 518 | if icount>1
|
---|
| 519 | InputTable{icount,4}=InputTable{icount-1,4};
|
---|
| 520 | else
|
---|
| 521 | InputTable{icount,4}='';
|
---|
| 522 | end
|
---|
| 523 | end
|
---|
| 524 | if isempty(InputTable{icount,5})
|
---|
| 525 | if icount>1
|
---|
| 526 | InputTable{icount,5}=InputTable{icount-1,5};
|
---|
| 527 | else
|
---|
| 528 | InputTable{icount,5}='';
|
---|
| 529 | end
|
---|
| 530 | end
|
---|
[867] | 531 | end
|
---|
| 532 | end
|
---|
[934] | 533 | if size(InputTable,1)>icount
|
---|
| 534 | InputTable(icount+1:size(InputTable,1),:)=[];
|
---|
| 535 | end
|
---|
| 536 | set(handles.InputTable,'Data',InputTable)
|
---|
| 537 | REFRESH_Callback(hObject, eventdata, handles)
|
---|
[867] | 538 |
|
---|
| 539 | % --------------------------------------------------------------------
|
---|
| 540 | function MenuCampaign_Callback(hObject, eventdata, handles)
|
---|
| 541 | % --------------------------------------------------------------------
|
---|
[937] | 542 |
|
---|
[992] | 543 | OutPut=browse_data(get(hObject,'Label'),'on','on'); % open the GUI browse_data to get select a campaign dir, experiment and device
|
---|
[867] | 544 | if ~isfield(OutPut,'Campaign')
|
---|
| 545 | return
|
---|
| 546 | end
|
---|
[935] | 547 | NbLines=numel(OutPut.Experiment)*numel(OutPut.DataSeries);
|
---|
| 548 | icount=0;
|
---|
| 549 | InputTable=get(handles.InputTable,'Data');
|
---|
| 550 | for iexp=1:numel(OutPut.Experiment)
|
---|
| 551 | for idevice=1:numel(OutPut.DataSeries)
|
---|
| 552 | icount=icount+1;
|
---|
| 553 | InputTable{icount,1}=fullfile(OutPut.Campaign,OutPut.Experiment{iexp});
|
---|
| 554 | InputTable{icount,2}=OutPut.DataSeries{idevice};
|
---|
| 555 | if isempty(InputTable{icount,3})
|
---|
| 556 | if icount>1
|
---|
| 557 | InputTable{icount,3}=InputTable{icount-1,3};
|
---|
| 558 | else
|
---|
| 559 | InputTable{icount,3}='';
|
---|
| 560 | end
|
---|
[867] | 561 | end
|
---|
[935] | 562 | if isempty(InputTable{icount,4})
|
---|
| 563 | if icount>1
|
---|
| 564 | InputTable{icount,4}=InputTable{icount-1,4};
|
---|
| 565 | else
|
---|
| 566 | InputTable{icount,4}='';
|
---|
| 567 | end
|
---|
| 568 | end
|
---|
| 569 | if isempty(InputTable{icount,5})
|
---|
| 570 | if icount>1
|
---|
| 571 | InputTable{icount,5}=InputTable{icount-1,5};
|
---|
| 572 | else
|
---|
| 573 | InputTable{icount,5}='';
|
---|
| 574 | end
|
---|
| 575 | end
|
---|
[867] | 576 | end
|
---|
| 577 | end
|
---|
[935] | 578 | if size(InputTable,1)>icount
|
---|
| 579 | InputTable(icount+1:size(InputTable,1),:)=[];
|
---|
[867] | 580 | end
|
---|
[935] | 581 | set(handles.InputTable,'Data',InputTable)
|
---|
| 582 | REFRESH_Callback(hObject, eventdata, handles)
|
---|
[867] | 583 |
|
---|
| 584 |
|
---|
| 585 | % --- Executes when selected cell(s) is changed in InputTable.
|
---|
| 586 | function InputTable_CellSelectionCallback(hObject, eventdata, handles)
|
---|
| 587 | iline=[];
|
---|
| 588 | if ~isempty(eventdata.Indices)
|
---|
| 589 | iline=eventdata.Indices(1);
|
---|
| 590 | end
|
---|
| 591 | set(handles.InputLine,'String',num2str(iline));
|
---|
| 592 |
|
---|
| 593 | %------------------------------------------------------------------------
|
---|
| 594 | % --- 'key_press_fcn:' function activated when a key is pressed on the keyboard
|
---|
| 595 | %------------------------------------------------------------------------
|
---|
| 596 | function InputTable_KeyPressFcn(hObject, eventdata, handles)
|
---|
| 597 | set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color to indicate that input refresh is needed
|
---|
[880] | 598 | set(handles.OutputSubDir,'BackgroundColor',[1 0 1])% set edit box OutputSubDir to magenta color to indicate that refresh may be needed
|
---|
[992] | 599 | xx=double(get(handles.series,'CurrentCharacter')); % get the keyboard character
|
---|
[867] | 600 | if ~isempty(xx)
|
---|
| 601 | switch xx
|
---|
| 602 | case 31 %downward arrow
|
---|
| 603 | InputTable=get(handles.InputTable,'Data');
|
---|
| 604 | iline=str2double(get(handles.InputLine,'String'));
|
---|
| 605 | if isequal(iline,size(InputTable,1))% arrow downward
|
---|
[992] | 606 | InputTable=[InputTable;InputTable(iline,:)]; % create a new line as a copy of the last one
|
---|
[867] | 607 | set(handles.InputTable,'Data',InputTable);
|
---|
| 608 | end
|
---|
| 609 | case 127 %key 'Suppress'
|
---|
| 610 | ClearLine_Callback(hObject, eventdata, handles)
|
---|
| 611 | end
|
---|
| 612 | end
|
---|
| 613 |
|
---|
| 614 | %------------------------------------------------------------------------
|
---|
| 615 | % --- Executes on button press in REFRESH.
|
---|
| 616 | function REFRESH_Callback(hObject, eventdata, handles)
|
---|
| 617 | %------------------------------------------------------------------------
|
---|
| 618 | InputTable=get(handles.InputTable,'Data');
|
---|
| 619 | set(handles.series,'Pointer','watch') % set the mouse pointer to 'watch'
|
---|
| 620 | set(handles.REFRESH,'BackgroundColor',[1 1 0])% set REFRESH button to yellow color (indicate activation)
|
---|
| 621 | drawnow
|
---|
| 622 | empty_line=false(size(InputTable,1),1);
|
---|
| 623 | for iline=1:size(InputTable,1)
|
---|
| 624 | empty_line(iline)= isempty(cell2mat(InputTable(iline,1:3)));
|
---|
| 625 | end
|
---|
| 626 | if ~isempty(find(empty_line));
|
---|
[992] | 627 | InputTable(empty_line,:)=[]; % remove empty lines
|
---|
[867] | 628 | set(handles.InputTable,'Data',InputTable)
|
---|
| 629 | ListTable={'MinIndex_i','MaxIndex_i','MinIndex_j','MaxIndex_j','PairString','TimeTable'};
|
---|
| 630 | for ilist=1:numel(ListTable)
|
---|
| 631 | Table=get(handles.(ListTable{ilist}),'Data');
|
---|
[992] | 632 | Table(empty_line,:)=[]; % remove empty lines
|
---|
[867] | 633 | set(handles.(ListTable{ilist}),'Data',Table);
|
---|
| 634 | end
|
---|
| 635 | set(handles.series,'UserData',[])%refresh the stored info
|
---|
| 636 | end
|
---|
[883] | 637 | nbview=size(InputTable,1);
|
---|
| 638 | for iview=1:nbview
|
---|
[867] | 639 | RootPath=fullfile(InputTable{iview,1},InputTable{iview,2});
|
---|
| 640 | if ~exist(RootPath,'dir')
|
---|
| 641 | i1_series=[];
|
---|
| 642 | RootFile='';
|
---|
| 643 | else %scan the input folder
|
---|
[1011] | 644 | InputTable{iview,3}=regexprep(InputTable{iview,3},'^/','');
|
---|
[963] | 645 | [RootPath,~,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileInfo,MovieObject]=...
|
---|
| 646 | find_file_series(fullfile(InputTable{iview,1},InputTable{iview,2}),[InputTable{iview,3} InputTable{iview,4} InputTable{iview,5}]);
|
---|
[867] | 647 | end
|
---|
| 648 | % if no file is found, open a browser
|
---|
| 649 | if isempty(RootFile)&& isempty(i1_series)
|
---|
| 650 | fileinput=uigetfile_uvmat(['wrong input at line ' num2str(iview) ':pick a new input file'],RootPath);
|
---|
| 651 | if isempty(fileinput)
|
---|
| 652 | set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH back to red color
|
---|
| 653 | return
|
---|
| 654 | else
|
---|
| 655 | display_file_name(handles,fileinput,iview)
|
---|
| 656 | end
|
---|
| 657 | else
|
---|
| 658 | update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileInfo,MovieObject,iview)
|
---|
| 659 | end
|
---|
| 660 | end
|
---|
[883] | 661 |
|
---|
| 662 | %% update MinIndex_i and MaxIndex_i if the input table content has been reduced in line nbre
|
---|
[992] | 663 | MinIndex_i_table=get(handles.MinIndex_i,'Data'); % retrieve the min indices in the table MinIndex
|
---|
[883] | 664 | set(handles.MinIndex_i,'Data',MinIndex_i_table(1:nbview,:));
|
---|
[992] | 665 | MinIndex_j_table=get(handles.MinIndex_j,'Data'); % retrieve the min indices in the table MinIndex
|
---|
[883] | 666 | set(handles.MinIndex_j,'Data',MinIndex_j_table(1:nbview,:));
|
---|
[992] | 667 | MaxIndex_i_table=get(handles.MaxIndex_i,'Data'); % retrieve the min indices in the table MinIndex
|
---|
[991] | 668 |
|
---|
[883] | 669 | set(handles.MaxIndex_i,'Data',MaxIndex_i_table(1:nbview,:));
|
---|
[992] | 670 | MaxIndex_j_table=get(handles.MaxIndex_j,'Data'); % retrieve the min indices in the table MinIndex
|
---|
[883] | 671 | set(handles.MaxIndex_j,'Data',MaxIndex_j_table(1:nbview,:));
|
---|
[992] | 672 | PairString=get(handles.PairString,'Data'); % retrieve the min indices in the table MinIndex
|
---|
[883] | 673 | set(handles.PairString,'Data',PairString(1:nbview,:));
|
---|
[992] | 674 | TimeTable=get(handles.TimeTable,'Data'); % retrieve the min indices in the table MinIndex
|
---|
[883] | 675 | set(handles.TimeTable,'Data',TimeTable(1:nbview,:));
|
---|
| 676 |
|
---|
[867] | 677 | %% set length of waitbar
|
---|
| 678 | displ_time(handles)
|
---|
| 679 | set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH button to red color (indicate activation finished)
|
---|
| 680 | set(handles.series,'Pointer','arrow') % set the mouse pointer to 'watch'
|
---|
| 681 |
|
---|
[996] | 682 | %% enable field and veltype menus, in accordance with the current action
|
---|
| 683 | ActionInput_Callback([],[], handles)
|
---|
| 684 |
|
---|
| 685 |
|
---|
[867] | 686 | %------------------------------------------------------------------------
|
---|
| 687 | % --- Function called when a new file is opened, either by series_OpeningFcn or by the browser
|
---|
| 688 | %------------------------------------------------------------------------
|
---|
| 689 | % INPUT:
|
---|
| 690 | % handles: handles of elements in the GUI
|
---|
| 691 | % Param: structure of input parameters, including input file name and path
|
---|
| 692 | % iview: line index in the input table
|
---|
| 693 | % or 'one': refresh the list
|
---|
| 694 | % 'append': add a new line to the input table
|
---|
| 695 | function errormsg=display_file_name(handles,Param,iview)
|
---|
| 696 |
|
---|
| 697 | set(handles.REFRESH,'BackgroundColor',[1 1 0])% set REFRESH button to yellow color (indicate activation)
|
---|
| 698 | drawnow
|
---|
[992] | 699 | errormsg=''; % default
|
---|
[867] | 700 | if ischar(Param)
|
---|
| 701 | fileinput=Param;
|
---|
| 702 | else% input set when series is opened (called by the GUI uvmat)
|
---|
| 703 | fileinput=Param.FileName;
|
---|
| 704 | end
|
---|
| 705 |
|
---|
| 706 | %% get the input root name, indices, file extension and nomenclature NomType
|
---|
| 707 | if ~exist(fileinput,'file')
|
---|
| 708 | errormsg=['input file ' fileinput ' does not exist'];
|
---|
| 709 | msgbox_uvmat('ERROR',errormsg)
|
---|
| 710 | set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color (refresh still needed)
|
---|
| 711 | return
|
---|
| 712 | end
|
---|
| 713 |
|
---|
| 714 | %% detect root name, nomenclature and indices in the input file name:
|
---|
| 715 | [FilePath,FileName,FileExt]=fileparts(fileinput);
|
---|
| 716 | %%%%%%%%%%%%%%%%%%
|
---|
| 717 | %TODO: case of input by uvmat: do not check agai the input seies %%%%%%%
|
---|
| 718 | %%%%%%%%%%%%%%%%%%%
|
---|
| 719 | % detect the file type, get the movie object if relevant, and look for the corresponding file series:
|
---|
| 720 | % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists
|
---|
| 721 | [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileInfo,MovieObject,i1,i2,j1,j2]=find_file_series(FilePath,[FileName FileExt]);
|
---|
| 722 | FileType=FileInfo.FileType;
|
---|
| 723 | if isempty(RootFile)&&isempty(i1_series)
|
---|
| 724 | errormsg='no input file in the series';
|
---|
| 725 | msgbox_uvmat('ERROR',errormsg)
|
---|
| 726 | set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color (end of activation)
|
---|
| 727 | return
|
---|
| 728 | end
|
---|
| 729 | if strcmp(FileType,'txt')
|
---|
| 730 | edit(fileinput)
|
---|
| 731 | set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color (end of activation)
|
---|
| 732 | return
|
---|
| 733 | elseif strcmp(FileType,'xml')
|
---|
| 734 | editxml(fileinput)
|
---|
| 735 | set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color (end of activation)
|
---|
| 736 | return
|
---|
| 737 | elseif strcmp(FileType,'figure')
|
---|
| 738 | open(fileinput)
|
---|
| 739 | set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color (end of activation)
|
---|
| 740 | return
|
---|
| 741 | end
|
---|
| 742 |
|
---|
| 743 | %% enable other menus and uicontrols
|
---|
[937] | 744 | % set(handles.MenuOpenCampaign,'Enable','on')
|
---|
[867] | 745 | set(handles.MenuCampaign_1,'Enable','on')
|
---|
| 746 | set(handles.MenuCampaign_2,'Enable','on')
|
---|
| 747 | set(handles.MenuCampaign_3,'Enable','on')
|
---|
| 748 | set(handles.MenuCampaign_4,'Enable','on')
|
---|
| 749 | set(handles.MenuCampaign_5,'Enable','on')
|
---|
| 750 | set(handles.RUN, 'Enable','On')
|
---|
| 751 | set(handles.RUN,'BackgroundColor',[1 0 0])% set RUN button to red
|
---|
| 752 | set(handles.InputTable,'BackgroundColor',[1 1 0]) % set RootPath edit box to yellow
|
---|
| 753 | drawnow
|
---|
| 754 |
|
---|
| 755 |
|
---|
| 756 | %% fill the list of file series
|
---|
| 757 | InputTable=get(handles.InputTable,'Data');
|
---|
| 758 | SeriesData=get(handles.series,'UserData');
|
---|
| 759 | if strcmp(iview,'append') % display the input data as a new line in the table
|
---|
[992] | 760 | iview=size(InputTable,1)+1; % the next line in InputTable becomes the current line
|
---|
[867] | 761 | % InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
|
---|
| 762 | elseif strcmp(iview,'one') % refresh the list of input file series
|
---|
[992] | 763 | iview=1; % the first line in InputTable becomes the current line
|
---|
[867] | 764 | InputTable={'','','','',''};
|
---|
| 765 | % InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
|
---|
| 766 | set(handles.TimeTable,'Data',[{''},{[]},{[]},{[]},{[]}])
|
---|
| 767 | set(handles.MinIndex_i,'Data',[])
|
---|
| 768 | set(handles.MaxIndex_i,'Data',[])
|
---|
| 769 | set(handles.MinIndex_j,'Data',[])
|
---|
| 770 | set(handles.MaxIndex_j,'Data',[])
|
---|
| 771 | set(handles.PairString,'Data',{''})
|
---|
[992] | 772 | SeriesData.CheckPair=0; % reset the list of input lines with pairs
|
---|
[867] | 773 | SeriesData.i1_series={};
|
---|
| 774 | SeriesData.i2_series={};
|
---|
| 775 | SeriesData.j1_series={};
|
---|
| 776 | SeriesData.j2_series={};
|
---|
| 777 | SeriesData.FileType={};
|
---|
| 778 | SeriesData.FileInfo={};
|
---|
| 779 | SeriesData.Time={};
|
---|
| 780 | end
|
---|
[883] | 781 | if isfield(SeriesData,'i1_series')
|
---|
| 782 | SeriesData.i1_series(iview+1:end)=[];
|
---|
[867] | 783 | SeriesData.i2_series(iview+1:end)=[];
|
---|
| 784 | SeriesData.j1_series(iview+1:end)=[];
|
---|
| 785 | SeriesData.j2_series(iview+1:end)=[];
|
---|
| 786 | SeriesData.FileType(iview+1:end)=[];
|
---|
| 787 | SeriesData.FileInfo(iview+1:end)=[];
|
---|
| 788 | SeriesData.Time(iview+1:end)=[];
|
---|
[883] | 789 | end
|
---|
| 790 | InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
|
---|
[867] | 791 | if iview >1
|
---|
| 792 | set(handles.InputLine,'String',num2str(iview))
|
---|
| 793 | end
|
---|
| 794 | set(handles.InputTable,'Data',InputTable)
|
---|
| 795 |
|
---|
| 796 | %% determine the selected reference field indices for pair display
|
---|
| 797 | if isempty(i1)
|
---|
| 798 | i1=1;
|
---|
| 799 | end
|
---|
| 800 | if isempty(i2)
|
---|
| 801 | i2=i1;
|
---|
| 802 | end
|
---|
[992] | 803 | ref_i=floor((i1+i2)/2); % reference image number corresponding to the file
|
---|
[867] | 804 | % set(handles.num_ref_i,'String',num2str(ref_i));
|
---|
| 805 | if isempty(j1)
|
---|
| 806 | j1=1;
|
---|
| 807 | end
|
---|
| 808 | if isempty(j2)
|
---|
| 809 | j2=j1;
|
---|
| 810 | end
|
---|
[992] | 811 | ref_j=floor((j1+j2)/2); % reference image number corresponding to the file
|
---|
[867] | 812 | SeriesData.ref_i=ref_i;
|
---|
| 813 | SeriesData.ref_j=ref_j;
|
---|
| 814 |
|
---|
| 815 | %% update first and last indices if they do not exist
|
---|
| 816 | Param=read_GUI(handles.series);
|
---|
| 817 | first_j=[];
|
---|
| 818 | if isfield(Param.IndexRange,'first_j'); first_j=Param.IndexRange.first_j; end
|
---|
| 819 | last_j=[];
|
---|
| 820 | if isfield(Param.IndexRange,'last_j'); last_j=Param.IndexRange.last_j; end
|
---|
| 821 | PairString='';
|
---|
| 822 | if isfield(Param.IndexRange,'PairString'); PairString=Param.IndexRange.PairString; end
|
---|
| 823 | [i1,i2,j1,j2] = get_file_index(Param.IndexRange.first_i,first_j,PairString);
|
---|
| 824 | FirstFileName=fullfile_uvmat(Param.InputTable{1,1},Param.InputTable{1,2},Param.InputTable{1,3},...
|
---|
| 825 | Param.InputTable{1,5},Param.InputTable{1,4},i1,i2,j1,j2);
|
---|
| 826 | if ~exist(FirstFileName,'file')
|
---|
| 827 | set(handles.num_first_i,'String',num2str(ref_i))
|
---|
| 828 | set(handles.num_first_j,'String',num2str(ref_j))
|
---|
| 829 | end
|
---|
| 830 | [i1,i2,j1,j2] = get_file_index(Param.IndexRange.last_i,last_j,PairString);
|
---|
| 831 | LastFileName=fullfile_uvmat(Param.InputTable{1,1},Param.InputTable{1,2},Param.InputTable{1,3},...
|
---|
| 832 | Param.InputTable{1,5},Param.InputTable{1,4},i1,i2,j1,j2);
|
---|
| 833 | if ~exist(LastFileName,'file')
|
---|
| 834 | set(handles.num_last_i,'String',num2str(ref_i))
|
---|
| 835 | set(handles.num_last_j,'String',num2str(ref_j))
|
---|
| 836 | end
|
---|
| 837 |
|
---|
| 838 | %% update the list of recent files in the menubar and save it for future opening
|
---|
| 839 | MenuFile=[{get(handles.MenuFile_1,'Label')};{get(handles.MenuFile_2,'Label')};...
|
---|
| 840 | {get(handles.MenuFile_3,'Label')};{get(handles.MenuFile_4,'Label')};{get(handles.MenuFile_5,'Label')}];
|
---|
| 841 | str_find=strcmp(fileinput,MenuFile);
|
---|
| 842 | if isempty(find(str_find,1))
|
---|
[992] | 843 | MenuFile=[{fileinput};MenuFile]; % insert the current file if not already in the list
|
---|
[867] | 844 | end
|
---|
| 845 | for ifile=1:min(length(MenuFile),5)
|
---|
| 846 | eval(['set(handles.MenuFile_' num2str(ifile) ',''Label'',MenuFile{ifile});'])
|
---|
| 847 | end
|
---|
| 848 | dir_perso=prefdir;
|
---|
| 849 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
|
---|
| 850 | if exist(profil_perso,'file')
|
---|
[992] | 851 | save (profil_perso,'MenuFile','-append'); % store the file names for future opening of uvmat
|
---|
[867] | 852 | else
|
---|
[992] | 853 | save (profil_perso,'MenuFile','-V6'); % store the file names for future opening of uvmat
|
---|
[867] | 854 | end
|
---|
| 855 | % save the opened file to initiate future opening
|
---|
[992] | 856 | SeriesData.RefFile{iview}=fileinput; % reference opening file for line iview
|
---|
[867] | 857 | SeriesData.Ref_i1=i1;
|
---|
| 858 | SeriesData.Ref_i2=i2;
|
---|
| 859 | SeriesData.Ref_j1=j1;
|
---|
| 860 | SeriesData.Ref_j2=j2;
|
---|
| 861 | set(handles.series,'UserData',SeriesData)
|
---|
| 862 |
|
---|
| 863 | set(handles.InputTable,'BackgroundColor',[1 1 1])
|
---|
| 864 |
|
---|
| 865 | %% initiate input file series and refresh the current field view:
|
---|
| 866 | update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileInfo,MovieObject,iview);
|
---|
| 867 | %% enable field and veltype menus, in accordance with the current action
|
---|
| 868 | ActionName_Callback([],[], handles)
|
---|
| 869 |
|
---|
| 870 | %% set length of waitbar
|
---|
| 871 | displ_time(handles)
|
---|
| 872 |
|
---|
| 873 | set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH button to red color (end of activation)
|
---|
| 874 |
|
---|
| 875 | %------------------------------------------------------------------------
|
---|
| 876 | % --- Update information about a new field series (indices to scan, timing,
|
---|
| 877 | % calibration from an xml file
|
---|
| 878 | function update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileInfo,VideoObject,iview)
|
---|
| 879 | %------------------------------------------------------------------------
|
---|
| 880 | InputTable=get(handles.InputTable,'Data');
|
---|
| 881 |
|
---|
| 882 | %% display the min and max indices for the whole file series
|
---|
| 883 | if size(i1_series,2)==2 && min(min(i1_series(:,1,:)))==0
|
---|
[992] | 884 | MinIndex_j=1; % index j set to 1 by default
|
---|
[867] | 885 | MaxIndex_j=1;
|
---|
[992] | 886 | MinIndex_i=find(i1_series(1,2,:), 1 )-1; % min ref index i detected in the series (corresponding to the first non-zero value of i1_series, except for zero index)
|
---|
| 887 | MaxIndex_i=find(i1_series(1,2,:),1,'last' )-1; % max ref index i detected in the series (corresponding to the last non-zero value of i1_series)
|
---|
[867] | 888 | else
|
---|
[992] | 889 | ref_i=squeeze(max(i1_series(1,:,:),[],2)); % select ref_j index for each ref_i
|
---|
| 890 | ref_j=squeeze(max(j1_series(1,:,:),[],3)); % select ref_i index for each ref_j
|
---|
[867] | 891 | MinIndex_i=min(find(ref_i))-1;
|
---|
| 892 | MaxIndex_i=max(find(ref_i))-1;
|
---|
| 893 | MaxIndex_j=max(find(ref_j))-1;
|
---|
| 894 | MinIndex_j=min(find(ref_j))-1;
|
---|
| 895 | diff_j_max=diff(ref_j);
|
---|
| 896 | diff_i_max=diff(ref_i);
|
---|
| 897 | if ~isempty(diff_i_max) && isequal (diff_i_max,diff_i_max(1)*ones(size(diff_i_max)))
|
---|
| 898 | set(handles.num_incr_i,'String',num2str(diff_i_max(1)))% detect an increment to dispaly by default
|
---|
| 899 | end
|
---|
| 900 | if ~isempty(diff_j_max) && isequal (diff_j_max,diff_j_max(1)*ones(size(diff_j_max)))
|
---|
| 901 | set(handles.num_incr_j,'String',num2str(diff_j_max(1)))
|
---|
| 902 | end
|
---|
| 903 | end
|
---|
| 904 | if isequal(MinIndex_i,-1)
|
---|
| 905 | MinIndex_i=0;
|
---|
| 906 | end
|
---|
| 907 | if isequal(MinIndex_j,-1)
|
---|
| 908 | MinIndex_j=0;
|
---|
| 909 | end
|
---|
[992] | 910 | MinIndex_i_table=get(handles.MinIndex_i,'Data'); % retrieve the min indices in the table MinIndex
|
---|
| 911 | MinIndex_j_table=get(handles.MinIndex_j,'Data'); % retrieve the min indices in the table MinIndex
|
---|
| 912 | MaxIndex_i_table=get(handles.MaxIndex_i,'Data'); % retrieve the min indices in the table MinIndex
|
---|
| 913 | MaxIndex_j_table=get(handles.MaxIndex_j,'Data'); % retrieve the min indices in the table MinIndex
|
---|
[867] | 914 | if ~isempty(MinIndex_i)&&~isempty(MaxIndex_i)
|
---|
| 915 | MinIndex_i_table(iview,1)=MinIndex_i;
|
---|
| 916 | MaxIndex_i_table(iview,1)=MaxIndex_i;
|
---|
| 917 | end
|
---|
| 918 | if ~isempty(MinIndex_j)&&~isempty(MaxIndex_j)
|
---|
| 919 | MinIndex_j_table(iview,1)=MinIndex_j;
|
---|
| 920 | MaxIndex_j_table(iview,1)=MaxIndex_j;
|
---|
| 921 | end
|
---|
| 922 | set(handles.MinIndex_i,'Data',MinIndex_i_table)%display the min indices in the table MinIndex
|
---|
| 923 | set(handles.MinIndex_j,'Data',MinIndex_j_table)%display the max indices in the table MaxIndex
|
---|
| 924 | set(handles.MaxIndex_i,'Data',MaxIndex_i_table)%display the min indices in the table MinIndex
|
---|
| 925 | set(handles.MaxIndex_j,'Data',MaxIndex_j_table)%display the max indices in the table MaxIndex
|
---|
| 926 | SeriesData=get(handles.series,'UserData');
|
---|
| 927 |
|
---|
| 928 | %% adjust the first and last indices for the selected series, only if requested by the bounds
|
---|
| 929 | % i index, compare input to min index i
|
---|
[992] | 930 | first_i=str2num(get(handles.num_first_i,'String')); % retrieve previous first i
|
---|
| 931 | % ref_i=str2num(get(handles.num_ref_i,'String')); % index i given by the input field
|
---|
[867] | 932 | ref_i=1;
|
---|
| 933 | if isfield(SeriesData,'ref_i')
|
---|
[937] | 934 | ref_i=SeriesData.ref_i;
|
---|
[867] | 935 | end
|
---|
| 936 | if isempty(first_i)
|
---|
[992] | 937 | first_i=ref_i; % first_i updated by the input value
|
---|
[867] | 938 | elseif first_i < MinIndex_i
|
---|
| 939 | first_i=MinIndex_i; % first_i set to the min i index (restricted by oter input lines)
|
---|
| 940 | elseif first_i >MaxIndex_i
|
---|
[992] | 941 | first_i=MaxIndex_i; % first_i set to the max i index (restricted by oter input lines)
|
---|
[867] | 942 | end
|
---|
| 943 | % j index, compare input to min index j
|
---|
| 944 | first_j=str2num(get(handles.num_first_j,'String'));
|
---|
| 945 | ref_j=1;
|
---|
| 946 | if isfield(SeriesData,'ref_j')
|
---|
[937] | 947 | ref_j=SeriesData.ref_j;
|
---|
[867] | 948 | end
|
---|
| 949 | if isempty(first_j)
|
---|
[992] | 950 | first_j=ref_j; % first_j updated by the input value
|
---|
[867] | 951 | elseif first_j<MinIndex_j
|
---|
| 952 | first_j=MinIndex_j; % first_j set to the min j index (restricted by oter input lines)
|
---|
| 953 | elseif first_j >MaxIndex_j
|
---|
| 954 | first_j=MaxIndex_j; % first_j set to the max j index (restricted by oter input lines)
|
---|
| 955 | end
|
---|
| 956 | % i index, compare input to max index i
|
---|
| 957 | last_i=str2num(get(handles.num_last_i,'String'));
|
---|
| 958 | if isempty(last_i)
|
---|
| 959 | last_i=ref_i;
|
---|
| 960 | elseif last_i > MaxIndex_i
|
---|
| 961 | last_i=MaxIndex_i;
|
---|
| 962 | elseif last_i<first_i
|
---|
| 963 | last_i=first_i;
|
---|
| 964 | end
|
---|
| 965 | % j index, compare input to max index j
|
---|
| 966 | last_j=str2num(get(handles.num_last_j,'String'));
|
---|
| 967 | if isempty(last_j)
|
---|
| 968 | last_j=ref_j;
|
---|
| 969 | elseif last_j>MaxIndex_j
|
---|
| 970 | last_j=MaxIndex_j;
|
---|
| 971 | elseif last_j<first_j
|
---|
| 972 | last_j=first_j;
|
---|
| 973 | end
|
---|
[937] | 974 | set(handles.num_first_i,'String',num2str(first_i));
|
---|
[867] | 975 | set(handles.num_first_j,'String',num2str(first_j));
|
---|
[937] | 976 | set(handles.num_last_i,'String',num2str(last_i));
|
---|
[867] | 977 | set(handles.num_last_j,'String',num2str(last_j));
|
---|
| 978 |
|
---|
| 979 | %% number of slices set by default
|
---|
[992] | 980 | NbSlice=[]; % default
|
---|
[867] | 981 | % read value set by the first series for the append mode (iwiew >1)
|
---|
| 982 | if iview>1 && strcmp(get(handles.num_NbSlice,'Visible'),'on')
|
---|
[937] | 983 | NbSlice=str2double(get(handles.num_NbSlice,'String'));
|
---|
[867] | 984 | end
|
---|
| 985 |
|
---|
| 986 | %% default time settings
|
---|
| 987 | TimeUnit='';
|
---|
| 988 | % read value set by the first series for the append mode (iwiew >1)
|
---|
[937] | 989 | if iview>1
|
---|
[867] | 990 | TimeUnit=get(handles.TimeUnit,'String');
|
---|
| 991 | end
|
---|
| 992 | TimeName='';
|
---|
[992] | 993 | Time=[]; % default
|
---|
[867] | 994 | TimeMin=[];
|
---|
| 995 | TimeFirst=[];
|
---|
| 996 | TimeLast=[];
|
---|
| 997 | TimeMax=[];
|
---|
| 998 |
|
---|
| 999 | %% read image documentation file if found
|
---|
| 1000 | XmlData=[];
|
---|
| 1001 | check_calib=0;
|
---|
| 1002 | XmlFileName=find_imadoc(InputTable{iview,1},InputTable{iview,2},InputTable{iview,3},InputTable{iview,5});
|
---|
| 1003 | if ~isempty(XmlFileName)
|
---|
| 1004 | [XmlData,errormsg]=imadoc2struct(XmlFileName);
|
---|
| 1005 | if ~isempty(errormsg)
|
---|
[937] | 1006 | msgbox_uvmat('WARNING',['error in reading ' XmlFileName ': ' errormsg]);
|
---|
[867] | 1007 | end
|
---|
| 1008 | % read time if available
|
---|
| 1009 | if isfield(XmlData,'Time')
|
---|
[937] | 1010 | Time=XmlData.Time;
|
---|
[867] | 1011 | TimeName='xml';
|
---|
[951] | 1012 | % if XmlData.Time(1,:)==XmlData.Time(2,:)% case starting with index 1
|
---|
[992] | 1013 | % sizDti=size(XmlData.Time,1)-1; % size of the time vector explicitly defined in the xml file
|
---|
[951] | 1014 | % ind_start=1;
|
---|
| 1015 | % else
|
---|
[992] | 1016 | % sizDti=size(XmlData.Time,1); % case starting with index 0
|
---|
[951] | 1017 | % ind_start=0;
|
---|
| 1018 | % end
|
---|
| 1019 | % % complement the input if the whole time series is not defined
|
---|
| 1020 | % if size(i1_series,3)>size(XmlData.Time,1)-ind_start %only the first time interval is defined, extrapolate to the whole series
|
---|
[992] | 1021 | % Dti_total=XmlData.Time(end)-XmlData.Time(1); % total time interval covered by the time vector
|
---|
| 1022 | % missing_indices=sizDti+1+ind_start:size(i1_series,3)+1; % remaining set of frame indices for which time needs to be found
|
---|
| 1023 | % repeat_nbre=1+floor((missing_indices-sizDti-ind_start)/(sizDti-1)); % number of repetitions of Dti
|
---|
[951] | 1024 | % time_indices=1+mod(missing_indices-sizDti-1,sizDti-1);
|
---|
| 1025 | % for j=1:size(XmlData.Time,2)
|
---|
| 1026 | % Time(missing_indices,j)=XmlData.Time(time_indices,j)+repeat_nbre'*Dti_total;
|
---|
| 1027 | % end
|
---|
| 1028 | % % update the xml file with NbDti
|
---|
| 1029 | % t=xmltree(XmlFileName);
|
---|
| 1030 | % uid_NbDti=find(t,'ImaDoc/Camera/BurstTiming/NbDti')
|
---|
| 1031 | % if isempty(uid_NbDti)
|
---|
| 1032 | % uid_BurstTiming=find(t,'ImaDoc/Camera/BurstTiming')
|
---|
| 1033 | % [t,uid_NbDti]=add(t,uid_BurstTiming,'element','NbDti');
|
---|
| 1034 | % end
|
---|
| 1035 | % [t,uid_NbDti]=add(t,uid_NbDti,'chardata',num2str(repeat_nbre(end)-1));
|
---|
| 1036 | % save(t,XmlFileName)
|
---|
| 1037 | % end
|
---|
[867] | 1038 | end
|
---|
| 1039 | if isfield(XmlData,'Camera')
|
---|
[937] | 1040 | % if isfield(XmlData.Camera,'NbSlice')&& ~isempty(XmlData.Camera.NbSlice)
|
---|
| 1041 | % if iview>1 && ~isempty(NbSlice) && ~strcmp(NbSlice,XmlData.Camera.NbSlice)
|
---|
| 1042 | % msgbox_uvmat('WARNING','inconsistent number of slices with the first field series');
|
---|
| 1043 | % end
|
---|
[992] | 1044 | % NbSlice=XmlData.Camera.NbSlice; % Nbre of slices from camera
|
---|
[937] | 1045 | % end
|
---|
[867] | 1046 | if isfield(XmlData.Camera,'TimeUnit')&& ~isempty(XmlData.Camera.TimeUnit)
|
---|
| 1047 | if iview>1 && ~isempty(TimeUnit) && ~strcmp(TimeUnit,XmlData.Camera.TimeUnit)
|
---|
| 1048 | msgbox_uvmat('WARNING','inconsistent time unit with the first field series');
|
---|
| 1049 | end
|
---|
| 1050 | TimeUnit=XmlData.Camera.TimeUnit;
|
---|
| 1051 | end
|
---|
| 1052 | end
|
---|
| 1053 | % number of slices
|
---|
[937] | 1054 | if isfield(XmlData,'TranslationMotor')&& isfield(XmlData.TranslationMotor,'NbSlice')
|
---|
| 1055 | NbSlice_motor=XmlData.TranslationMotor.NbSlice;
|
---|
| 1056 | if ~isempty(NbSlice) && ~isequal(NbSlice_motor,NbSlice)
|
---|
| 1057 | msgbox_uvmat('WARNING','inconsistent Z numbers of Z indices');
|
---|
| 1058 | else
|
---|
| 1059 | NbSlice=NbSlice_motor;
|
---|
| 1060 | end
|
---|
| 1061 | end
|
---|
| 1062 |
|
---|
[867] | 1063 | if isfield(XmlData,'GeometryCalib')
|
---|
| 1064 | check_calib=1;
|
---|
| 1065 | if isfield(XmlData.GeometryCalib,'SliceCoord')
|
---|
| 1066 | siz=size(XmlData.GeometryCalib.SliceCoord);
|
---|
[937] | 1067 | if ~isempty(NbSlice)&& ~isequal(size(1),NbSlice)
|
---|
| 1068 | msgbox_uvmat('WARNING','inconsistent numbers of Z indices between motor and calibration');
|
---|
| 1069 | else
|
---|
[867] | 1070 | NbSlice=siz(1);
|
---|
| 1071 | end
|
---|
| 1072 | end
|
---|
| 1073 | end
|
---|
| 1074 | end
|
---|
[937] | 1075 | if ~isempty(NbSlice)
|
---|
| 1076 | set(handles.num_NbSlice,'String',num2str(NbSlice))
|
---|
| 1077 | set(handles.num_NbSlice,'Visible','on')
|
---|
| 1078 | end
|
---|
[867] | 1079 |
|
---|
| 1080 | %% read timing from the current file (prioritary)
|
---|
| 1081 | if ~isempty(VideoObject)% case of movies
|
---|
| 1082 | imainfo=get(VideoObject);
|
---|
[992] | 1083 | if isempty(j1_series); % frame index along i
|
---|
[867] | 1084 | Time=zeros(imainfo.NumberOfFrames+1,2);
|
---|
| 1085 | Time(:,2)=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate)';
|
---|
| 1086 | else
|
---|
| 1087 | Time=[0;ones(size(i1_series,3)-1,1)]*(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate);
|
---|
| 1088 | end
|
---|
| 1089 | TimeName='video';
|
---|
| 1090 | end
|
---|
| 1091 |
|
---|
| 1092 |
|
---|
| 1093 | %% determine the min and max times: case of Netcdf files will be treated later in FieldName_Callback
|
---|
| 1094 | if ~isempty(TimeName)
|
---|
| 1095 | TimeMin=Time(MinIndex_i+1,MinIndex_j+1);
|
---|
| 1096 | if size(Time)>=[first_i+1 first_j+1]
|
---|
| 1097 | TimeFirst=Time(first_i+1,first_j+1);
|
---|
| 1098 | end
|
---|
| 1099 | if size(Time)>=[last_i+1 last_j+1]
|
---|
| 1100 | TimeLast=Time(last_i+1,last_j+1);
|
---|
| 1101 | end
|
---|
| 1102 | if size(Time)>=[MaxIndex_i+1 MaxIndex_j+1];
|
---|
| 1103 | TimeMax=Time(MaxIndex_i+1,MaxIndex_j+1);
|
---|
| 1104 | end
|
---|
| 1105 | end
|
---|
| 1106 |
|
---|
| 1107 | %% update the time table
|
---|
| 1108 | TimeTable=get(handles.TimeTable,'Data');
|
---|
| 1109 | TimeTable{iview,1}=TimeName;
|
---|
| 1110 | TimeTable{iview,2}=TimeMin;
|
---|
| 1111 | TimeTable{iview,3}=TimeFirst;
|
---|
| 1112 | TimeTable{iview,4}=TimeLast;
|
---|
| 1113 | TimeTable{iview,5}=TimeMax;
|
---|
| 1114 | set(handles.TimeTable,'Data',TimeTable)
|
---|
| 1115 |
|
---|
| 1116 | %% update the series info in 'UserData'
|
---|
| 1117 | SeriesData.i1_series{iview}=i1_series;
|
---|
| 1118 | SeriesData.i2_series{iview}=i2_series;
|
---|
| 1119 | SeriesData.j1_series{iview}=j1_series;
|
---|
| 1120 | SeriesData.j2_series{iview}=j2_series;
|
---|
| 1121 | SeriesData.FileType{iview}=FileInfo.FileType;
|
---|
| 1122 | SeriesData.FileInfo{iview}=FileInfo;
|
---|
| 1123 | SeriesData.Time{iview}=Time;
|
---|
| 1124 | % if ~isempty(TimeName)
|
---|
| 1125 | % SeriesData.TimeSource=TimeSource;
|
---|
| 1126 | % end
|
---|
| 1127 | if check_calib
|
---|
| 1128 | SeriesData.GeometryCalib{iview}=XmlData.GeometryCalib;
|
---|
| 1129 | end
|
---|
| 1130 | set(handles.series,'UserData',SeriesData)
|
---|
| 1131 |
|
---|
| 1132 | %% update pair menus
|
---|
| 1133 | hset_pair=findobj(allchild(0),'Tag','set_pairs');
|
---|
| 1134 | if ~isempty(hset_pair), delete(hset_pair); end % delete the GUI set_pair if opened
|
---|
| 1135 | CheckPair= ~isempty(i2_series)||~isempty(j2_series); % check whether index pairs need to be defined
|
---|
| 1136 | PairString=get(handles.PairString,'Data');
|
---|
| 1137 | if CheckPair% if pairs need to be display for line iview
|
---|
| 1138 | [ModeMenu,ModeValue]=update_mode(i1_series,i2_series,j2_series);
|
---|
| 1139 | Menu=update_listpair(i1_series,i2_series,j1_series,j2_series,ModeMenu{ModeValue},Time,TimeUnit,ref_i,ref_j,TimeName,InputTable(iview,:),FileInfo);
|
---|
| 1140 | PairString{iview,1}=Menu{1};
|
---|
| 1141 | else
|
---|
[992] | 1142 | PairString{iview,1}=''; % no pair for #iview
|
---|
[867] | 1143 | end
|
---|
| 1144 | set(handles.PairString,'Data',PairString)
|
---|
| 1145 | if isempty(find(cellfun('isempty',get(handles.PairString,'Data'))==0, 1))% if all lines of pairs are empty
|
---|
| 1146 | set(handles.PairString,'Visible','off')
|
---|
| 1147 | set(handles.SetPairs,'Visible','off')
|
---|
| 1148 | else
|
---|
| 1149 | set(handles.PairString,'Visible','on')
|
---|
| 1150 | set(handles.SetPairs,'Visible','on')
|
---|
| 1151 | end
|
---|
| 1152 |
|
---|
| 1153 |
|
---|
| 1154 | %% display the set of existing files as an image
|
---|
| 1155 | set(handles.FileStatus,'Units','pixels')
|
---|
| 1156 | Position=get(handles.FileStatus,'Position');
|
---|
| 1157 | set(handles.FileStatus,'Units','normalized')
|
---|
| 1158 | %xI=0.5:Position(3)-0.5;
|
---|
| 1159 | nbview=numel(SeriesData.i1_series);
|
---|
| 1160 | j_max=cell(1,nbview);
|
---|
[992] | 1161 | MaxIndex_i=ones(1,nbview); % default
|
---|
| 1162 | MinIndex_i=ones(1,nbview); % default
|
---|
[867] | 1163 | for iline=1:nbview
|
---|
[992] | 1164 | pair_max=squeeze(max(SeriesData.i1_series{iline},[],1)); % max on pair index
|
---|
| 1165 | j_max{iline}=max(pair_max,[],1); % max on j index
|
---|
[867] | 1166 | if ~isempty(j_max{iline})
|
---|
[992] | 1167 | MaxIndex_i(iline)=max(find(j_max{iline}))-1; % max ref index i
|
---|
| 1168 | MinIndex_i(iline)=min(find(j_max{iline}))-1; % min ref index i
|
---|
[867] | 1169 | end
|
---|
| 1170 | end
|
---|
| 1171 | MinIndex_i=min(MinIndex_i);
|
---|
| 1172 | MaxIndex_i=max(MaxIndex_i);
|
---|
| 1173 | range_index=MaxIndex_i-MinIndex_i+1;
|
---|
| 1174 | range_y=max(1,floor(Position(4)/nbview));
|
---|
| 1175 | npx=floor(Position(3));
|
---|
| 1176 | file_indices=MinIndex_i+floor(((0.5:npx-0.5)/npx)*range_index)+1;
|
---|
[992] | 1177 | CData=zeros(nbview*range_y,npx); % initiate the image representing the existing files
|
---|
[867] | 1178 | for iline=1:nbview
|
---|
| 1179 | ind_y=1+(iline-1)*range_y:iline*range_y;
|
---|
| 1180 | LineData=zeros(size(file_indices));
|
---|
| 1181 | file_select=file_indices(file_indices<=numel(j_max{iline}));
|
---|
| 1182 | ind_select=find(file_indices<=numel(j_max{iline}));
|
---|
| 1183 | LineData(ind_select)=j_max{iline}(file_select)~=0;
|
---|
| 1184 | CData(ind_y,:)=ones(size(ind_y'))*LineData;
|
---|
| 1185 | end
|
---|
[992] | 1186 | CData=cat(3,zeros(size(CData)),CData,zeros(size(CData))); % make color images r=0,g,b=0
|
---|
[867] | 1187 | set(handles.FileStatus,'CData',CData);
|
---|
| 1188 |
|
---|
| 1189 | %-----------------------------------------------------------guide -------------
|
---|
| 1190 | %------------------------------------------------------------------------
|
---|
| 1191 | % III - FUNCTIONS ASSOCIATED TO THE FRAME IndexRange
|
---|
| 1192 | %------------------------------------------------------------------------
|
---|
| 1193 |
|
---|
| 1194 |
|
---|
| 1195 | % ---- determine the menu to put in mode and advice a default choice
|
---|
| 1196 | %------------------------------------------------------------------------
|
---|
| 1197 | function [ModeMenu,ModeValue]=update_mode(i1_series,i2_series,j2_series)
|
---|
| 1198 | %------------------------------------------------------------------------
|
---|
| 1199 | ModeMenu={''};
|
---|
| 1200 | if isempty(j2_series)% no j pair
|
---|
| 1201 | ModeValue=1;
|
---|
| 1202 | if ~isempty(i2_series)
|
---|
| 1203 | ModeMenu={'series(Di)'}; % pair menu with only option Di
|
---|
| 1204 | end
|
---|
| 1205 | else %existence of j pairs
|
---|
[992] | 1206 | pair_max=squeeze(max(i1_series,[],1)); % max on pair index
|
---|
[867] | 1207 | j_max=max(pair_max,[],1);
|
---|
[992] | 1208 | MaxIndex_i=find(j_max, 1, 'last' )-1; % max ref index i
|
---|
| 1209 | MinIndex_i=find(j_max, 1 )-1; % min ref index i
|
---|
[867] | 1210 | i_max=max(pair_max,[],2);
|
---|
[992] | 1211 | MaxIndex_j=find(i_max, 1, 'last' )-1; % max ref index i
|
---|
| 1212 | MinIndex_j=find(i_max, 1 )-1; % min ref index i
|
---|
[867] | 1213 | if MaxIndex_j==MinIndex_j
|
---|
| 1214 | ModeValue=1;
|
---|
| 1215 | ModeMenu={'bursts'};
|
---|
| 1216 | elseif MaxIndex_i==MinIndex_i
|
---|
| 1217 | ModeValue=1;
|
---|
| 1218 | ModeMenu={'series(Dj)'};
|
---|
| 1219 | else
|
---|
| 1220 | ModeMenu={'bursts';'series(Dj)'};
|
---|
| 1221 | if (MaxIndex_j-MinIndex_j)>10
|
---|
[992] | 1222 | ModeValue=2; % set mode to series(Dj) if more than 10 j values
|
---|
[867] | 1223 | else
|
---|
| 1224 | ModeValue=1;
|
---|
| 1225 | end
|
---|
| 1226 | end
|
---|
| 1227 | end
|
---|
| 1228 |
|
---|
| 1229 |
|
---|
| 1230 | %------------------------------------------------------------------------
|
---|
| 1231 | function displ_pair=update_listpair(i1_series,i2_series,j1_series,j2_series,mode,time,TimeUnit,ref_i,ref_j,TimeName,InputTable,FileInfo)
|
---|
| 1232 | %------------------------------------------------------------------------
|
---|
| 1233 | displ_pair={};
|
---|
| 1234 | if isempty(TimeUnit)
|
---|
| 1235 | dtunit='e-03';
|
---|
| 1236 | else
|
---|
| 1237 | dtunit=['m' TimeUnit];
|
---|
| 1238 | end
|
---|
| 1239 | switch mode
|
---|
| 1240 | case 'series(Di)'
|
---|
| 1241 | diff_i=i2_series-i1_series;
|
---|
| 1242 | min_diff=min(diff_i(diff_i>0));
|
---|
| 1243 | max_diff=max(diff_i(diff_i>0));
|
---|
| 1244 | for ipair=min_diff:max_diff
|
---|
| 1245 | if numel(diff_i(diff_i==ipair))>0
|
---|
| 1246 | pair_string=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ];
|
---|
| 1247 | if ~isempty(time)
|
---|
| 1248 | if ref_i<=floor(ipair/2)
|
---|
[992] | 1249 | ref_i=floor(ipair/2)+1; % shift ref_i to get the first pair
|
---|
[867] | 1250 | end
|
---|
| 1251 | Dt=time(ref_i+ceil(ipair/2),ref_j)-time(ref_i-floor(ipair/2),ref_j);
|
---|
| 1252 | pair_string=[pair_string ', Dt=' num2str(Dt) ' ' dtunit];
|
---|
| 1253 | end
|
---|
| 1254 | displ_pair=[displ_pair;{pair_string}];
|
---|
| 1255 | end
|
---|
| 1256 | end
|
---|
| 1257 | if ~isempty(displ_pair)
|
---|
| 1258 | displ_pair=[displ_pair;{'Di=*|*'}];
|
---|
| 1259 | end
|
---|
| 1260 | case 'series(Dj)'
|
---|
| 1261 | if isempty(j2_series)
|
---|
| 1262 | msgbox_uvmat('ERROR','no j1-j2 pair available')
|
---|
| 1263 | return
|
---|
| 1264 | end
|
---|
| 1265 | diff_j=j2_series-j1_series;
|
---|
| 1266 | min_diff=min(diff_j(diff_j>0));
|
---|
| 1267 | max_diff=max(diff_j(diff_j>0));
|
---|
| 1268 | for ipair=min_diff:max_diff
|
---|
| 1269 | if numel(diff_j(diff_j==ipair))>0
|
---|
| 1270 | pair_string=['Dj= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ];
|
---|
| 1271 | if ~isempty(time)
|
---|
| 1272 | if ref_j<=floor(ipair/2)
|
---|
[992] | 1273 | ref_j=floor(ipair/2)+1; % shift ref_i to get the first pair
|
---|
[867] | 1274 | end
|
---|
| 1275 | Dt=time(ref_i,ref_j+ceil(ipair/2))-time(ref_i,ref_j-floor(ipair/2));
|
---|
| 1276 | pair_string=[pair_string ', Dt=' num2str(Dt) ' ' dtunit];
|
---|
| 1277 | end
|
---|
| 1278 | displ_pair=[displ_pair;{pair_string}];
|
---|
| 1279 | end
|
---|
| 1280 | end
|
---|
| 1281 | if ~isempty(displ_pair)
|
---|
| 1282 | displ_pair=[displ_pair;{'Dj=*|*'}];
|
---|
| 1283 | end
|
---|
| 1284 | case 'bursts'
|
---|
| 1285 | if isempty(j2_series)
|
---|
| 1286 | msgbox_uvmat('ERROR','no j1-j2 pair available')
|
---|
| 1287 | return
|
---|
| 1288 | end
|
---|
| 1289 | %diff_j=j2_series-j1_series;
|
---|
| 1290 | min_j1=min(j1_series(j1_series>0));
|
---|
| 1291 | max_j1=max(j1_series(j1_series>0));
|
---|
| 1292 | min_j2=min(j2_series(j2_series>0));
|
---|
| 1293 | max_j2=max(j2_series(j2_series>0));
|
---|
| 1294 | for pair1=min_j1:min(max_j1,min_j1+20)
|
---|
| 1295 | for pair2=min_j2:min(max_j2,min_j2+20)
|
---|
| 1296 | if numel(j1_series(j1_series==pair1))>0 && numel(j2_series(j2_series==pair2))>0
|
---|
| 1297 | pair_string=['j= ' num2str(pair1) '-' num2str(pair2)];
|
---|
| 1298 | [TimeValue,DtValue]=get_time(ref_i,[],pair_string,InputTable,FileInfo,TimeName,'Dt');
|
---|
| 1299 | %Dt=time(ref_i,pair2+1)-time(ref_i,pair1+1);
|
---|
| 1300 | pair_string=[pair_string ', Dt=' num2str(DtValue) ' ' dtunit];
|
---|
| 1301 | displ_pair=[displ_pair;{pair_string}];
|
---|
| 1302 | end
|
---|
| 1303 | end
|
---|
| 1304 | end
|
---|
| 1305 | if ~isempty(displ_pair)
|
---|
| 1306 | displ_pair=[displ_pair;{'j=*-*'}];
|
---|
| 1307 | end
|
---|
| 1308 | end
|
---|
| 1309 |
|
---|
| 1310 | %------------------------------------------------------------------------
|
---|
| 1311 | function num_first_i_Callback(hObject, eventdata, handles)
|
---|
| 1312 | %------------------------------------------------------------------------
|
---|
| 1313 | num_last_i_Callback(hObject, eventdata, handles)
|
---|
| 1314 |
|
---|
| 1315 | %------------------------------------------------------------------------
|
---|
| 1316 | function num_last_i_Callback(hObject, eventdata, handles)
|
---|
| 1317 | %------------------------------------------------------------------------
|
---|
| 1318 | SeriesData=get(handles.series,'UserData');
|
---|
| 1319 | if ~isfield(SeriesData,'Time')
|
---|
| 1320 | SeriesData.Time{1}=[];
|
---|
| 1321 | end
|
---|
| 1322 | displ_time(handles);
|
---|
| 1323 |
|
---|
| 1324 | %------------------------------------------------------------------------
|
---|
| 1325 | function num_first_j_Callback(hObject, eventdata, handles)
|
---|
| 1326 | %------------------------------------------------------------------------
|
---|
| 1327 | num_last_j_Callback(hObject, eventdata, handles)
|
---|
| 1328 |
|
---|
| 1329 | %------------------------------------------------------------------------
|
---|
| 1330 | function num_last_j_Callback(hObject, eventdata, handles)
|
---|
| 1331 | %------------------------------------------------------------------------
|
---|
| 1332 | % first_j=str2num(get(handles.num_first_j,'String'));
|
---|
| 1333 | % last_j=str2num(get(handles.num_last_j,'String'));
|
---|
| 1334 | % ref_j=ceil((first_j+last_j)/2);
|
---|
| 1335 | % set(handles.num_ref_j,'String', num2str(ref_j))
|
---|
| 1336 | % num_ref_j_Callback(hObject, eventdata, handles)
|
---|
| 1337 | SeriesData=get(handles.series,'UserData');
|
---|
| 1338 | if ~isfield(SeriesData,'Time')
|
---|
| 1339 | SeriesData.Time{1}=[];
|
---|
| 1340 | end
|
---|
| 1341 | displ_time(handles);
|
---|
| 1342 |
|
---|
| 1343 | %------------------------------------------------------------------------
|
---|
| 1344 | % ---- find the times corresponding to the first and last indices of a series
|
---|
| 1345 | function displ_time(handles)
|
---|
| 1346 | %------------------------------------------------------------------------
|
---|
[992] | 1347 | SeriesData=get(handles.series,'UserData'); %
|
---|
[867] | 1348 | if ~isfield(SeriesData,'Time')
|
---|
| 1349 | return
|
---|
| 1350 | end
|
---|
| 1351 | PairString=get(handles.PairString,'Data');
|
---|
[992] | 1352 | ref_i_1=str2num(get(handles.num_first_i,'String')); % first reference index
|
---|
| 1353 | ref_i_2=str2num(get(handles.num_last_i,'String')); % last reference index
|
---|
[867] | 1354 | ref_j_1=[];ref_j_2=[];
|
---|
| 1355 | if strcmp(get(handles.num_first_j,'Visible'),'on')
|
---|
| 1356 | ref_j_1=str2num(get(handles.num_first_j,'String'));
|
---|
| 1357 | ref_j_2=str2num(get(handles.num_last_j,'String'));
|
---|
| 1358 | end
|
---|
| 1359 | [i1_1,i2_1,j1_1,j2_1] = get_file_index(ref_i_1,ref_j_1,PairString);
|
---|
| 1360 | [i1_2,i2_2,j1_2,j2_2] = get_file_index(ref_i_2,ref_j_2,PairString);
|
---|
| 1361 | TimeTable=get(handles.TimeTable,'Data');
|
---|
| 1362 | %%%%%%
|
---|
| 1363 | %TODO: read time in netcdf file, see ActionName_Callback
|
---|
| 1364 | %%%%%%%
|
---|
| 1365 | %Pairs=get(handles.PairString,'Data');
|
---|
| 1366 | for iview=1:size(TimeTable,1)
|
---|
| 1367 | if size(SeriesData.Time,1)<iview
|
---|
| 1368 | break
|
---|
| 1369 | end
|
---|
| 1370 | TimeTable{iview,3}=[];
|
---|
| 1371 | TimeTable{iview,4}=[];
|
---|
| 1372 | if size(SeriesData.Time{iview},1)>=i2_2+1 && (isempty(ref_j_1)||size(SeriesData.Time{iview},2)>=j2_2+1)
|
---|
| 1373 | if isempty(ref_j_1)
|
---|
| 1374 | time_first=(SeriesData.Time{iview}(i1_1+1,2)+SeriesData.Time{iview}(i2_1+1,2))/2;
|
---|
| 1375 | time_last=(SeriesData.Time{iview}(i1_2+1,2)+SeriesData.Time{iview}(i2_2+1,2))/2;
|
---|
| 1376 | else
|
---|
| 1377 | time_first=(SeriesData.Time{iview}(i1_1+1,j1_1+1)+SeriesData.Time{iview}(i2_1+1,j2_1+1))/2;
|
---|
| 1378 | time_last=(SeriesData.Time{iview}(i1_2+1,j1_2+1)+SeriesData.Time{iview}(i2_2+1,j2_1+1))/2;
|
---|
| 1379 | end
|
---|
[992] | 1380 | TimeTable{iview,3}=time_first; % TODO: take into account pairs
|
---|
| 1381 | TimeTable{iview,4}=time_last; % TODO: take into account pairs
|
---|
[867] | 1382 | end
|
---|
| 1383 | end
|
---|
| 1384 | set(handles.TimeTable,'Data',TimeTable)
|
---|
| 1385 |
|
---|
| 1386 | %% set the waitbar position with respect to the min and max in the series
|
---|
| 1387 | MinIndex_i=min(get(handles.MinIndex_i,'Data'));
|
---|
| 1388 | MaxIndex_i=max(get(handles.MaxIndex_i,'Data'));
|
---|
| 1389 | pos_first=(ref_i_1-MinIndex_i)/(MaxIndex_i-MinIndex_i+1);
|
---|
| 1390 | pos_last=(ref_i_2-MinIndex_i+1)/(MaxIndex_i-MinIndex_i+1);
|
---|
| 1391 | if isempty(pos_first), pos_first=0; end
|
---|
| 1392 | if isempty(pos_last), pos_last=1; end
|
---|
[992] | 1393 | Position=get(handles.Waitbar,'Position'); % position of the waitbar:= [ x,y, width, height]
|
---|
[867] | 1394 | Position_status=get(handles.FileStatus,'Position');
|
---|
| 1395 | Position(1)=Position_status(1)+Position_status(3)*pos_first;
|
---|
[992] | 1396 | Position(3)=max(Position_status(3)*(pos_last-pos_first),0.001); % width must remain positive
|
---|
[867] | 1397 | set(handles.Waitbar,'Position',Position)
|
---|
| 1398 | update_waitbar(handles.Waitbar,0)
|
---|
| 1399 |
|
---|
| 1400 | %------------------------------------------------------------------------
|
---|
| 1401 | % --- Executes when selected cell(s) is changed in PairString.
|
---|
| 1402 | function PairString_CellSelectionCallback(hObject, eventdata, handles)
|
---|
| 1403 | %------------------------------------------------------------------------
|
---|
| 1404 | if numel(eventdata.Indices)>=1
|
---|
| 1405 | PairString=get(hObject,'Data');
|
---|
| 1406 | if ~isempty(PairString{eventdata.Indices(1)})
|
---|
| 1407 | SetPairs_Callback(hObject, eventdata.Indices(1), handles)
|
---|
| 1408 | end
|
---|
| 1409 | end
|
---|
| 1410 |
|
---|
| 1411 | %-------------------------------------
|
---|
| 1412 | function enable_i(handles,state)
|
---|
| 1413 | set(handles.i_txt,'Visible',state)
|
---|
| 1414 | set(handles.num_first_i,'Visible',state)
|
---|
| 1415 | set(handles.num_last_i,'Visible',state)
|
---|
| 1416 | set(handles.num_incr_i,'Visible',state)
|
---|
| 1417 |
|
---|
| 1418 | %-----------------------------------
|
---|
| 1419 | function enable_j(handles,state)
|
---|
| 1420 | set(handles.j_txt,'Visible',state)
|
---|
| 1421 | set(handles.num_first_j,'Visible',state)
|
---|
| 1422 | set(handles.num_last_j,'Visible',state)
|
---|
| 1423 | set(handles.num_incr_j,'Visible',state)
|
---|
| 1424 | set(handles.MinIndex_j,'Visible',state)
|
---|
| 1425 | set(handles.MaxIndex_j,'Visible',state)
|
---|
| 1426 |
|
---|
| 1427 |
|
---|
| 1428 | %%%%%%%%%%%%%%%%%%%%
|
---|
| 1429 | %% MAIN ActionName FUNCTIONS
|
---|
| 1430 | %%%%%%%%%%%%%%%%%%%%
|
---|
| 1431 | %------------------------------------------------------------------------
|
---|
| 1432 | % --- Executes on button press in RUN.
|
---|
| 1433 | %------------------------------------------------------------------------
|
---|
| 1434 | function RUN_Callback(hObject, eventdata, handles)
|
---|
| 1435 |
|
---|
| 1436 | %% settings of the button RUN
|
---|
[996] | 1437 | if ~isequal(get(handles.ActionInput,'BackgroundColor'),[1 0 0])
|
---|
| 1438 | msgbox_uvmat('ERROR','first activate the button ActionInput')
|
---|
| 1439 | return
|
---|
| 1440 | end
|
---|
[992] | 1441 | set(handles.RUN,'BusyAction','queue'); % activation of STOP button will set BusyAction to 'cancel'
|
---|
[867] | 1442 | set(handles.RUN, 'Enable','Off')% avoid further RUN action until the current one is finished
|
---|
| 1443 | set(handles.RUN,'BackgroundColor',[1 1 0])%show activation of RUN by yellow color
|
---|
| 1444 | drawnow
|
---|
| 1445 | set(handles.status,'Value',0)% desable status display if relevant
|
---|
| 1446 | status_Callback([], eventdata, handles)
|
---|
| 1447 |
|
---|
| 1448 | %% launch action
|
---|
| 1449 | errormsg=launch_action(handles);
|
---|
| 1450 | if ~isempty(errormsg)
|
---|
| 1451 | msgbox_uvmat('ERROR',errormsg)
|
---|
| 1452 | end
|
---|
| 1453 |
|
---|
| 1454 | %% reset the GUI series
|
---|
| 1455 | update_waitbar(handles.Waitbar,1); % put the waitbar to end position to indicate launching is finished
|
---|
| 1456 | set(handles.RUN, 'Enable','On')
|
---|
| 1457 | set(handles.RUN,'BackgroundColor',[1 0 0])
|
---|
| 1458 | set(handles.RUN, 'Value',0)
|
---|
| 1459 |
|
---|
| 1460 | %------------------------------------------------------------------------
|
---|
| 1461 | % --- called by RUN_Callback
|
---|
| 1462 | %------------------------------------------------------------------------
|
---|
[997] | 1463 | % The calculations are launched in three different ways:
|
---|
| 1464 | % RunMode='local': calculation on the local Matlab session, will prevent other actions during that time.
|
---|
| 1465 | % RunMode='background': calculation on the local computer, but in a new Matlab session (with no graphic output).
|
---|
| 1466 | % RunMode='cluster': calculations dispatched in a cluster, using a managing system, 'oar, 'sge, or 'sgb'.
|
---|
| 1467 | % In the latter case, the calculation is split in 'packets' of i index (all j indices are contained in a single packet).
|
---|
| 1468 | % This splitting is possible only if the different calculations in the series are independent. Otherwise the action
|
---|
| 1469 | % function imposes a number of processes NbSlice in input, for instance NbSlice=1 for a time series.
|
---|
| 1470 | % If NbSlice is not imposed, the splitting in packets (jobs) is determined
|
---|
| 1471 | % so that a job is optimum length AdvisedJobCPUTime), and the total job number in any case smaller
|
---|
| 1472 | % than MaxJobNumber (these parameters are defined in the file series.xml in
|
---|
| 1473 | % accordance with the management strategy for the cluster). The jobs are
|
---|
| 1474 | % dispatched in parallel into NbCore processors by the cluster managing system.
|
---|
| 1475 |
|
---|
[867] | 1476 | function errormsg=launch_action(handles)
|
---|
[992] | 1477 | errormsg=''; % default
|
---|
[867] | 1478 |
|
---|
| 1479 | %% read the data on the GUI series
|
---|
[992] | 1480 | Param=read_GUI_series(handles); % displayed parameters
|
---|
| 1481 | SeriesData=get(handles.series,'UserData'); % hidden parameters
|
---|
[883] | 1482 | if isfield(SeriesData,'TransformInput')
|
---|
| 1483 | Param.TransformInput=SeriesData.TransformInput;
|
---|
| 1484 | end
|
---|
[867] | 1485 | if ~isfield(SeriesData,'i1_series')
|
---|
| 1486 | errormsg='The input field series needs to be refreshed: press REFRESH';
|
---|
| 1487 | return
|
---|
| 1488 | end
|
---|
[940] | 1489 | if isfield(Param,'InputFields')&& isfield(Param.InputFields,'FieldName')&& isequal(Param.InputFields.FieldName,'get_field...')
|
---|
[867] | 1490 | errormsg='input field name(s) not defined, select get_field...';
|
---|
| 1491 | return
|
---|
| 1492 | end
|
---|
| 1493 |
|
---|
| 1494 | %% select the Action mode, 'local', 'background' or 'cluster' (if available)
|
---|
[992] | 1495 | RunMode='local'; % default (needed for first opening of the GUI series)
|
---|
[867] | 1496 | if isfield(Param.Action,'RunMode')
|
---|
| 1497 | RunMode=Param.Action.RunMode;
|
---|
[992] | 1498 | Param.Action=rmfield(Param.Action,'RunMode'); % remove from the recorded xml file to avoid interference during ImportConfig
|
---|
[867] | 1499 | end
|
---|
[992] | 1500 | ActionExt='.m'; % default
|
---|
[867] | 1501 | if isfield(Param.Action,'ActionExt')
|
---|
[992] | 1502 | ActionExt=Param.Action.ActionExt; % '.m', '.sh' (compiled) or '.py' (Python)
|
---|
| 1503 | Param.Action=rmfield(Param.Action,'ActionExt'); % remove from the recorded xml file to avoid interference during ImportConfig
|
---|
[867] | 1504 | end
|
---|
| 1505 | ActionName=Param.Action.ActionName;
|
---|
| 1506 | ActionPath=Param.Action.ActionPath;
|
---|
| 1507 | path_series=fileparts(which('series'));
|
---|
| 1508 |
|
---|
| 1509 | %% create the Action fct handle if RunMode option = 'local'
|
---|
| 1510 | if strcmp(RunMode,'local')
|
---|
| 1511 | if ~isequal(ActionPath,path_series)
|
---|
| 1512 | eval(['spath=which(''' ActionName ''');']) %spath = current path of the selected function ACTION
|
---|
| 1513 | if ~exist(ActionPath,'dir')
|
---|
| 1514 | errormsg=['The prescribed function path ' ActionPath ' does not exist'];
|
---|
| 1515 | return
|
---|
| 1516 | end
|
---|
| 1517 | if ~isequal(spath,ActionPath)
|
---|
| 1518 | addpath(ActionPath)% add the prescribed path if not the current one
|
---|
| 1519 | end
|
---|
| 1520 | end
|
---|
| 1521 | eval(['h_fun=@' ActionName ';'])%create a function handle for ACTION
|
---|
| 1522 | if ~isequal(ActionPath,path_series)
|
---|
| 1523 | rmpath(ActionPath)% add the prescribed path if not the current one
|
---|
| 1524 | end
|
---|
| 1525 | end
|
---|
| 1526 |
|
---|
[994] | 1527 | %% Get parameters from series.xml
|
---|
[992] | 1528 | errormsg=''; % default error message
|
---|
[928] | 1529 | ActionFullName=fullfile(get(handles.ActionPath,'String'),ActionName);
|
---|
[934] | 1530 |
|
---|
| 1531 | %% If a compiled version has been selected (ext .sh) check wether it needs to be recompiled
|
---|
[867] | 1532 | if strcmp(ActionExt,'.sh')
|
---|
| 1533 | TransformPath='';
|
---|
[1001] | 1534 | if isfield(SeriesData,'TransformPath')
|
---|
| 1535 | TransformPath=SeriesData.TransformPath;
|
---|
| 1536 | if isfield(SeriesData,'TransformList')
|
---|
| 1537 | TransformList=get(handles.TransformName,'String');
|
---|
| 1538 | TransformIndex=get(handles.TransformName,'Value');
|
---|
| 1539 | TransformName=TransformList{TransformIndex};
|
---|
| 1540 | if ~ismember(TransformName,SeriesData.TransformList)
|
---|
| 1541 | TransformPath='';
|
---|
| 1542 | end
|
---|
| 1543 | end
|
---|
[867] | 1544 | end
|
---|
[1001] | 1545 | if ~isempty(TransformPath)&&...
|
---|
| 1546 | ~strcmp(TransformPath,get(handles.TransformPath,'String'))% if the transform is not in paths set for compilation
|
---|
| 1547 | msgbox_uvmat('ERROR', 'compilation not available for this transform function, select .m')
|
---|
| 1548 | return
|
---|
| 1549 | end
|
---|
[867] | 1550 | set(handles.series,'Pointer','watch') % set the mouse pointer to 'watch'
|
---|
| 1551 | set(handles.ActionExt,'BackgroundColor',[1 1 0])
|
---|
[923] | 1552 | [mcrmajor, mcrminor] = mcrversion;
|
---|
| 1553 | MCRROOT = ['MCRROOT',int2str(mcrmajor),int2str(mcrminor)];
|
---|
[895] | 1554 | RunTime = getenv(MCRROOT);
|
---|
| 1555 | ActionNameVersion=[ActionName '_' MCRROOT];
|
---|
| 1556 | ActionFullName=fullfile(get(handles.ActionPath,'String'),[ActionNameVersion '.sh']);
|
---|
[934] | 1557 | % compile the .m file if the .sh file does not exist yet
|
---|
[867] | 1558 | if ~exist(ActionFullName,'file')
|
---|
| 1559 | answer=msgbox_uvmat('INPUT_Y-N','compiled version has not been created: compile now?');
|
---|
| 1560 | if strcmp(answer,'Yes')
|
---|
| 1561 | set(handles.ActionExt,'BackgroundColor',[1 1 0])
|
---|
| 1562 | path_uvmat=fileparts(which('series'));
|
---|
| 1563 | currentdir=pwd;
|
---|
| 1564 | cd(get(handles.ActionPath,'String'))% go to the directory of Action
|
---|
| 1565 | addpath(path_uvmat)% add the path to uvmat to run the fct 'compile'
|
---|
| 1566 | compile(ActionName,TransformPath)
|
---|
| 1567 | cd(currentdir)
|
---|
[880] | 1568 | else
|
---|
| 1569 | errormsg='Action launch interrupted';
|
---|
| 1570 | return
|
---|
[867] | 1571 | end
|
---|
| 1572 | else
|
---|
[895] | 1573 | sh_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionNameVersion '.sh']));
|
---|
[867] | 1574 | m_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.m']));
|
---|
| 1575 | if isfield(m_file_info,'datenum') && m_file_info.datenum>sh_file_info.datenum
|
---|
| 1576 | set(handles.ActionExt,'BackgroundColor',[1 1 0])
|
---|
| 1577 | drawnow
|
---|
[895] | 1578 | answer=msgbox_uvmat('INPUT_Y-N',[ActionNameVersion '.sh needs to be updated: recompile now?']);
|
---|
[867] | 1579 | if strcmp(answer,'Yes')
|
---|
| 1580 | path_uvmat=fileparts(which('series'));
|
---|
| 1581 | currentdir=pwd;
|
---|
| 1582 | cd(get(handles.ActionPath,'String'))% go to the directory of Action
|
---|
| 1583 | addpath(path_uvmat)% add the path to uvmat to run the fct 'compile'
|
---|
| 1584 | addpath(fullfile(path_uvmat,'transform_field'))% add the path to uvmat to run the fct 'compile'
|
---|
| 1585 | compile(ActionName,TransformPath)
|
---|
| 1586 | cd(currentdir)
|
---|
| 1587 | end
|
---|
| 1588 | end
|
---|
| 1589 | end
|
---|
[934] | 1590 |
|
---|
[867] | 1591 | set(handles.ActionExt,'BackgroundColor',[1 1 1])
|
---|
| 1592 | set(handles.series,'Pointer','arrow') % set the mouse pointer to 'watch
|
---|
| 1593 | end
|
---|
| 1594 |
|
---|
[897] | 1595 | %% set nbre of cluster cores and processes:
|
---|
| 1596 | % NbCore is the number of computer processors used
|
---|
[917] | 1597 | % NbProcess is the number of independent processes in which the required calculation is split.
|
---|
[867] | 1598 | switch RunMode
|
---|
| 1599 | case {'local','background'}
|
---|
[992] | 1600 | NbCore=1; % no need to split the calculation
|
---|
[867] | 1601 | case 'cluster_oar'
|
---|
[997] | 1602 | %proposed number of cores to reserve in the cluster
|
---|
| 1603 | NbCoreAdvised=SeriesData.SeriesParam.OarParam.NbCoreAdvised;
|
---|
| 1604 | NbCoreMax=SeriesData.SeriesParam.OarParam.NbCoreMax;
|
---|
| 1605 | if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
|
---|
[996] | 1606 | warning_string=', preferably use .sh option to save Matlab licences';
|
---|
[997] | 1607 | else
|
---|
| 1608 | warning_string=')';
|
---|
| 1609 | end
|
---|
| 1610 | answer=inputdlg({['Number of cores (max ' num2str(NbCoreMax) warning_string],'extra oar options'},'oarsub parameter',1,{num2str(NbCoreAdvised),''});
|
---|
| 1611 | if isempty(answer)
|
---|
| 1612 | errormsg='Action launch interrupted by user';
|
---|
| 1613 | return
|
---|
| 1614 | end
|
---|
| 1615 | NbCore=str2double(answer{1});
|
---|
| 1616 | extra_oar=answer{2};
|
---|
[984] | 1617 | case {'cluster_pbs', 'cluster_sge', 'cluster_qstat_unknown'}
|
---|
[882] | 1618 | if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
|
---|
[992] | 1619 | NbCore=1; % one core used only (limitation of Matlab licences)
|
---|
[882] | 1620 | answer=msgbox_uvmat('INPUT_Y-N','Number of cores =1: select the compiled version .sh for multi-core processing. Proceed with the .m version?');
|
---|
| 1621 | if ~strcmp(answer,'Yes')
|
---|
| 1622 | errormsg='Action launch interrupted';
|
---|
| 1623 | return
|
---|
| 1624 | end
|
---|
| 1625 | extra_oar='';
|
---|
| 1626 | else
|
---|
[984] | 1627 | answer=inputdlg({'Number of jobs (max 1000)','Queue'},'qsub parameters',1,{'100','piv_debian'});
|
---|
[882] | 1628 | NbCore=str2double(answer{1});
|
---|
[984] | 1629 | qstat_Queue=answer{2};
|
---|
[992] | 1630 | %extra_oar=answer{2}; % TODO : fix this for LMFA cluster. Maybe
|
---|
[882] | 1631 | %extrs_oar and extra_pbs are not the best names
|
---|
| 1632 | end
|
---|
[867] | 1633 | end
|
---|
| 1634 | if ~isfield(Param.IndexRange,'NbSlice')
|
---|
| 1635 | Param.IndexRange.NbSlice=[];
|
---|
| 1636 | end
|
---|
| 1637 |
|
---|
| 1638 | %% create the output data directory if needed
|
---|
| 1639 | OutputDir='';
|
---|
| 1640 | if isfield(Param,'OutputSubDir')
|
---|
| 1641 | SubDirOut=[get(handles.OutputSubDir,'String') Param.OutputDirExt];
|
---|
| 1642 | SubDirOutNew=SubDirOut;
|
---|
[992] | 1643 | detect=exist(fullfile(Param.InputTable{1,1},SubDirOutNew),'dir'); % test if the dir already exist
|
---|
| 1644 | check_create=1; % need to create the result directory by default
|
---|
[905] | 1645 | CheckOverwrite=1;
|
---|
| 1646 | if isfield(Param,'CheckOverwrite')
|
---|
| 1647 | CheckOverwrite=Param.CheckOverwrite;
|
---|
| 1648 | end
|
---|
[867] | 1649 | while detect
|
---|
[905] | 1650 | if CheckOverwrite
|
---|
[904] | 1651 | comment=', possibly overwrite previous data';
|
---|
| 1652 | else
|
---|
| 1653 | comment=', will complement existing result files (no overwriting)';
|
---|
| 1654 | end
|
---|
| 1655 | answer=msgbox_uvmat('INPUT_Y-N-Cancel',['use existing ouput directory: ' fullfile(Param.InputTable{1,1},SubDirOutNew) comment]);
|
---|
[867] | 1656 | if strcmp(answer,'Cancel')
|
---|
| 1657 | return
|
---|
| 1658 | elseif strcmp(answer,'Yes')
|
---|
| 1659 | detect=0;
|
---|
| 1660 | check_create=0;
|
---|
| 1661 | else
|
---|
[992] | 1662 | r=regexp(SubDirOutNew,'(?<root>.*\D)(?<num1>\d+)$','names'); % detect whether name ends by a number
|
---|
[867] | 1663 | if isempty(r)
|
---|
| 1664 | r(1).root=[SubDirOutNew '_'];
|
---|
| 1665 | r(1).num1='0';
|
---|
| 1666 | end
|
---|
[992] | 1667 | SubDirOutNew=[r(1).root num2str(str2num(r(1).num1)+1)]; % increment the index by 1 or put 1
|
---|
| 1668 | detect=exist(fullfile(Param.InputTable{1,1},SubDirOutNew),'dir'); % test if the dir already exists
|
---|
[867] | 1669 | check_create=1;
|
---|
| 1670 | end
|
---|
| 1671 | end
|
---|
| 1672 | Param.OutputDirExt=regexprep(SubDirOutNew,Param.OutputSubDir,'');
|
---|
[992] | 1673 | Param.OutputRootFile=Param.InputTable{1,3}; % the first sorted RootFile taken for output
|
---|
[867] | 1674 | set(handles.OutputDirExt,'String',Param.OutputDirExt)
|
---|
[992] | 1675 | OutputDir=fullfile(Param.InputTable{1,1},[Param.OutputSubDir Param.OutputDirExt]); % full name (with path) of output directory
|
---|
[867] | 1676 | if check_create % create output directory if it does not exist
|
---|
| 1677 | [tild,msg1]=mkdir(OutputDir);
|
---|
| 1678 | if ~strcmp(msg1,'')
|
---|
[992] | 1679 | errormsg=['cannot create ' OutputDir ': ' msg1]; % error message for directory creation
|
---|
[867] | 1680 | return
|
---|
| 1681 | end
|
---|
| 1682 | end
|
---|
| 1683 |
|
---|
| 1684 | elseif isfield(Param,'ActionInput')&&isfield(Param.ActionInput,'LogPath')% custom definition of the output dir
|
---|
| 1685 | OutputDir=Param.ActionInput.LogPath;
|
---|
| 1686 | end
|
---|
| 1687 | DirXml=fullfile(OutputDir,'0_XML');
|
---|
| 1688 | if ~exist(DirXml,'dir')
|
---|
[935] | 1689 | [~,msg1]=mkdir(DirXml);
|
---|
[867] | 1690 | if ~strcmp(msg1,'')
|
---|
[992] | 1691 | errormsg=['cannot create ' DirXml ': ' msg1]; % error message for directory creation
|
---|
[867] | 1692 | return
|
---|
| 1693 | end
|
---|
| 1694 | end
|
---|
[992] | 1695 | OutputNomType=nomtype2pair(Param.InputTable{1,4}); % nomenclature for output files
|
---|
[867] | 1696 |
|
---|
[897] | 1697 | %% get the set of reference input field indices
|
---|
[992] | 1698 | first_i=1; % first i index to process
|
---|
| 1699 | last_i=1; % last i index to process
|
---|
| 1700 | incr_i=1; % increment step in i index
|
---|
| 1701 | first_j=1; % first j index to process
|
---|
| 1702 | last_j=1; % last j index to process
|
---|
| 1703 | incr_j=1; % increment step in j index
|
---|
[867] | 1704 | if isfield(Param.IndexRange,'first_i')
|
---|
| 1705 | first_i=Param.IndexRange.first_i;
|
---|
| 1706 | incr_i=Param.IndexRange.incr_i;
|
---|
| 1707 | last_i=Param.IndexRange.last_i;
|
---|
| 1708 | end
|
---|
[996] | 1709 | if isfield(Param.IndexRange,'incr_j')
|
---|
[867] | 1710 | first_j=Param.IndexRange.first_j;
|
---|
| 1711 | last_j=Param.IndexRange.last_j;
|
---|
| 1712 | incr_j=Param.IndexRange.incr_j;
|
---|
| 1713 | end
|
---|
[932] | 1714 | if last_i < first_i || last_j < first_j
|
---|
[867] | 1715 | errormsg= 'series/Run_Callback:last field index must be larger or equal to the first one';
|
---|
| 1716 | return
|
---|
| 1717 | end
|
---|
| 1718 | %incr_i must be defined, =1 by default, if NbSlice is active
|
---|
| 1719 | if isempty(incr_i)&& ~isempty(Param.IndexRange.NbSlice)
|
---|
| 1720 | incr_i=1;
|
---|
| 1721 | set(handles.num_incr_i,'String','1')
|
---|
| 1722 | end
|
---|
[897] | 1723 | % case of no increment i defined: processing is done on the available files found in i1_series
|
---|
[867] | 1724 | if isempty(incr_i)
|
---|
| 1725 | if isempty(incr_j)
|
---|
| 1726 | [ref_j,ref_i]=find(squeeze(SeriesData.i1_series{1}(1,:,:)));
|
---|
| 1727 | ref_j=ref_j(ref_j>=first_j & ref_j<=last_j);
|
---|
| 1728 | ref_i=ref_i(ref_i>=first_i & ref_i<=last_i);
|
---|
| 1729 | ref_j=ref_j-1;
|
---|
| 1730 | ref_i=ref_i-1;
|
---|
| 1731 | else
|
---|
| 1732 | ref_j=first_j:incr_j:last_j;
|
---|
| 1733 | [tild,ref_i]=find(squeeze(SeriesData.i1_series{1}(1,:,:)));
|
---|
| 1734 | ref_i=ref_i-1;
|
---|
| 1735 | ref_i=ref_i(ref_i>=first_i & ref_i<=last_i);
|
---|
| 1736 | end
|
---|
[932] | 1737 | % increment i is defined: processing is done on first_i:incr_i:last_i;
|
---|
[867] | 1738 | else
|
---|
| 1739 | ref_i=first_i:incr_i:last_i;
|
---|
[904] | 1740 | if isempty(incr_j)% automatic finding of the existing j indices
|
---|
[867] | 1741 | [ref_j,tild]=find(squeeze(SeriesData.i1_series{1}(1,:,:)));
|
---|
| 1742 | ref_j=ref_j-1;
|
---|
| 1743 | ref_j=ref_j(ref_j>=first_j & ref_j<=last_j);
|
---|
| 1744 | else
|
---|
| 1745 | ref_j=first_j:incr_j:last_j;
|
---|
| 1746 | end
|
---|
| 1747 | end
|
---|
[992] | 1748 | CPUTime=1; % job time estimated at 1 min per iteration (on index i and j) by default
|
---|
[906] | 1749 | if isfield(Param.Action, 'CPUTime') && ~isempty(Param.Action.CPUTime)
|
---|
[992] | 1750 | CPUTime=Param.Action.CPUTime; % Note: CpUTime for one iteration ref_i has to be multiplied by the number of j indices nbfield_j
|
---|
[904] | 1751 | end
|
---|
| 1752 | nbfield_j=numel(ref_j); % number of j indices
|
---|
[992] | 1753 | BlockLength=numel(ref_i); % by default, job involves the full set of i field indices
|
---|
[910] | 1754 | NbProcess=1;
|
---|
| 1755 | switch RunMode
|
---|
[984] | 1756 | case {'cluster_oar','cluster_pbs','cluster_sge','cluster_qstat_unknown'}
|
---|
[997] | 1757 | JobNumberMax=SeriesData.SeriesParam.OarParam.JobNumberMax;
|
---|
| 1758 | JobCPUTimeAdvised=SeriesData.SeriesParam.OarParam.JobCPUTimeAdvised;
|
---|
[910] | 1759 | if isempty(Param.IndexRange.NbSlice)% if NbSlice is not defined
|
---|
[997] | 1760 | BlockLength= ceil(JobCPUTimeAdvised/(CPUTime*nbfield_j)); % iterations are grouped in sets with length BlockLength such that the typical CPU time of a job is MinJobNumber.
|
---|
| 1761 | BlockLength=max(BlockLength,ceil(numel(ref_i)/JobNumberMax)); % possibly increase the BlockLength to have less than MaxJobNumber jobs
|
---|
[932] | 1762 | NbProcess=ceil(numel(ref_i)/BlockLength) ; % nbre of processes sent to oar
|
---|
[910] | 1763 | else
|
---|
[992] | 1764 | NbProcess=Param.IndexRange.NbSlice; % the parameter NbSlice sets the nbre of run processes
|
---|
[910] | 1765 | end
|
---|
[997] | 1766 | NbCore=min(NbCore,NbProcess); % reduces the number of cores if it exceeds the number of processes
|
---|
[917] | 1767 | otherwise
|
---|
[932] | 1768 | if ~isempty(Param.IndexRange.NbSlice)
|
---|
[992] | 1769 | NbProcess=Param.IndexRange.NbSlice; % the parameter NbSlice sets the nbre of run processes
|
---|
[932] | 1770 | end
|
---|
[902] | 1771 | end
|
---|
[867] | 1772 |
|
---|
| 1773 | %% record nbre of output files and starting time for computation for status
|
---|
| 1774 | StatusData=get(handles.status,'UserData');
|
---|
| 1775 | if isfield(StatusData,'OutputFileMode')
|
---|
| 1776 | switch StatusData.OutputFileMode
|
---|
| 1777 | case 'NbInput'
|
---|
| 1778 | StatusData.NbOutputFile=numel(ref_i)*nbfield_j;
|
---|
| 1779 | case 'NbInput_i'
|
---|
| 1780 | StatusData.NbOutputFile=numel(ref_i);
|
---|
[932] | 1781 | case 'NbSlice'
|
---|
[867] | 1782 | StatusData.NbOutputFile=str2num(get(handles.num_NbSlice,'String'));
|
---|
| 1783 | end
|
---|
| 1784 | end
|
---|
| 1785 | StatusData.TimeStart=now;
|
---|
| 1786 | set(handles.status,'UserData',StatusData)
|
---|
| 1787 |
|
---|
[897] | 1788 | %% case of a function in Python
|
---|
[867] | 1789 | if strcmp(ActionExt, '.py (in dev.)')
|
---|
| 1790 | fprintf([
|
---|
| 1791 | '\n' ...
|
---|
| 1792 | '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n' ...
|
---|
| 1793 | 'The option .py is used. It is still in development.\n' ...
|
---|
[1004] | 1794 | 'To try it, first install pyper and the most recent version of fluidimage\n' ...
|
---|
| 1795 | '(see https://bitbucket.org/fluiddyn/fluidimage).\n' ...
|
---|
| 1796 | 'Warning: there is no direct correspondance between UVMAT and fluidimage parameters\n' ...
|
---|
[867] | 1797 | '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n'])
|
---|
| 1798 | RunMode = 'python';
|
---|
| 1799 | end
|
---|
| 1800 |
|
---|
| 1801 |
|
---|
[919] | 1802 | %% direct processing on the current Matlab session or creation of command files
|
---|
[992] | 1803 | filexml=cell(1,NbProcess); % initialisation of the names of the files containing the processing parameters
|
---|
[919] | 1804 | extxml=cell(1,NbProcess); % initialisation of the set of labels used for the files documenting each process
|
---|
[918] | 1805 | for iprocess=1:NbProcess
|
---|
[922] | 1806 | extxml{iprocess}='.xml';
|
---|
| 1807 | end
|
---|
| 1808 | for iprocess=1:NbProcess
|
---|
[918] | 1809 | if ~strcmp(get(handles.RUN,'BusyAction'),'queue')% allow for STOP action
|
---|
| 1810 | disp('program stopped by user')
|
---|
| 1811 | return
|
---|
| 1812 | end
|
---|
| 1813 | if isempty(Param.IndexRange.NbSlice)
|
---|
| 1814 | Param.IndexRange.first_i=first_i+(iprocess-1)*BlockLength*incr_i;
|
---|
| 1815 | if Param.IndexRange.first_i>last_i
|
---|
[992] | 1816 | NbProcess=iprocess-1; % leave the loop, we are at the end of the calculation
|
---|
[918] | 1817 | break
|
---|
[917] | 1818 | end
|
---|
[918] | 1819 | Param.IndexRange.last_i=min(last_i,first_i+(iprocess)*BlockLength*incr_i-1);
|
---|
| 1820 | else %multislices (then incr_i is not empty)
|
---|
| 1821 | Param.IndexRange.first_i= first_i+iprocess-1;
|
---|
| 1822 | Param.IndexRange.incr_i=incr_i*Param.IndexRange.NbSlice;
|
---|
| 1823 | end
|
---|
| 1824 | for ilist=1:size(Param.InputTable,1)
|
---|
[992] | 1825 | Param.InputTable{ilist,1}=regexprep(Param.InputTable{ilist,1},'\','/'); % correct path name for PCWIN system
|
---|
[918] | 1826 | end
|
---|
| 1827 |
|
---|
| 1828 | if isfield(Param,'OutputSubDir')
|
---|
| 1829 | t=struct2xml(Param);
|
---|
| 1830 | t=set(t,1,'name','Series');
|
---|
| 1831 | extxml{iprocess}=fullfile_uvmat('','',Param.InputTable{1,3},'.xml',OutputNomType,...
|
---|
| 1832 | Param.IndexRange.first_i,Param.IndexRange.last_i,first_j,last_j);
|
---|
[919] | 1833 | filexml{iprocess}=fullfile(OutputDir,'0_XML',extxml{iprocess});
|
---|
| 1834 | try
|
---|
[992] | 1835 | save(t, filexml{iprocess}); % save the xml file containing the processing parameters
|
---|
[919] | 1836 | catch ME
|
---|
| 1837 | if ~strcmp (RunMode,'local')
|
---|
| 1838 | errormsg=['error writting ' filexml{iprocess} ': ' ME.message];
|
---|
| 1839 | return
|
---|
| 1840 | end
|
---|
| 1841 | end
|
---|
[918] | 1842 | end
|
---|
| 1843 | if strcmp (RunMode,'local')
|
---|
[867] | 1844 | switch ActionExt
|
---|
| 1845 | case '.m'
|
---|
[992] | 1846 | h_fun(Param); % direct launching
|
---|
[932] | 1847 |
|
---|
[867] | 1848 | case '.sh'
|
---|
| 1849 | switch computer
|
---|
| 1850 | case {'PCWIN','PCWIN64'} %Windows system
|
---|
[992] | 1851 | filexml=regexprep(filexml,'\\','\\\\'); % add '\' so that '\' are left as characters
|
---|
| 1852 | system([ActionFullName ' ' RunTime ' ' filexml{iprocess}]); % TODO: adapt to DOS system
|
---|
[867] | 1853 | case {'GLNX86','GLNXA64','MACI64'}%Linux system
|
---|
[979] | 1854 | system([ActionFullName ' ' RunTime ' ' filexml{iprocess}]);
|
---|
[867] | 1855 | end
|
---|
| 1856 | end
|
---|
| 1857 | end
|
---|
[918] | 1858 | end
|
---|
[934] | 1859 |
|
---|
[918] | 1860 | if ~strcmp (RunMode,'local') && ~strcmp(RunMode,'python')
|
---|
[867] | 1861 | %% processing on a different session of the same computer (background) or cluster, create executable files
|
---|
[992] | 1862 | batch_file_list=cell(NbProcess,1); % initiate the list of executable files
|
---|
| 1863 | DirExe=fullfile(OutputDir,'0_EXE'); % directory name for executable files
|
---|
[867] | 1864 | switch computer
|
---|
| 1865 | case {'PCWIN','PCWIN64'} %Windows system
|
---|
| 1866 | ExeExt='.bat';
|
---|
| 1867 | case {'GLNX86','GLNXA64','MACI64'}%Linux system
|
---|
[917] | 1868 | ExeExt='.sh';
|
---|
[867] | 1869 | end
|
---|
| 1870 | %create subdirectory for executable files
|
---|
[905] | 1871 | if ~exist(DirExe,'dir')
|
---|
| 1872 | [tild,msg1]=mkdir(DirExe);
|
---|
[867] | 1873 | if ~strcmp(msg1,'')
|
---|
[992] | 1874 | errormsg=['cannot create ' DirExe ': ' msg1]; % error message for directory creation
|
---|
[867] | 1875 | return
|
---|
| 1876 | end
|
---|
| 1877 | end
|
---|
| 1878 | %create subdirectory for log files
|
---|
| 1879 | DirLog=fullfile(OutputDir,'0_LOG');
|
---|
| 1880 | if ~exist(DirLog,'dir')
|
---|
| 1881 | [tild,msg1]=mkdir(DirLog);
|
---|
| 1882 | if ~strcmp(msg1,'')
|
---|
[992] | 1883 | errormsg=['cannot create ' DirLog ': ' msg1]; % error message for directory creation
|
---|
[867] | 1884 | return
|
---|
| 1885 | end
|
---|
| 1886 | end
|
---|
[932] | 1887 |
|
---|
[918] | 1888 | %create the executable file
|
---|
| 1889 | file_exe_global=fullfile_uvmat('','',Param.InputTable{1,3},ExeExt,OutputNomType,...
|
---|
| 1890 | first_i,last_i,first_j,last_j);
|
---|
| 1891 | file_exe_global=fullfile(OutputDir,'0_EXE',file_exe_global);
|
---|
| 1892 | filelog_global=fullfile_uvmat('','',Param.InputTable{1,3},'.log',OutputNomType,...
|
---|
| 1893 | first_i,last_i,first_j,last_j);
|
---|
| 1894 | filelog_global=fullfile(OutputDir,'0_LOG',filelog_global);
|
---|
[934] | 1895 |
|
---|
[997] | 1896 | for iprocess=1:NbProcess
|
---|
| 1897 | %create the executable file
|
---|
[918] | 1898 | batch_file_list{iprocess}=fullfile(OutputDir,'0_EXE',regexprep(extxml{iprocess},'.xml$',ExeExt));
|
---|
| 1899 |
|
---|
[917] | 1900 | % set the log file name
|
---|
[997] | 1901 | filelog{iprocess}=fullfile(OutputDir,'0_LOG',regexprep(extxml{iprocess},'.xml$','.log'));
|
---|
[917] | 1902 | end
|
---|
| 1903 | end
|
---|
| 1904 |
|
---|
| 1905 | %% launch the executable files for background or cluster processing
|
---|
[918] | 1906 |
|
---|
[917] | 1907 | switch RunMode
|
---|
[918] | 1908 |
|
---|
[917] | 1909 | case 'background'
|
---|
[918] | 1910 | [fid,message]=fopen(file_exe_global,'w');
|
---|
[867] | 1911 | if isequal(fid,-1)
|
---|
[918] | 1912 | errormsg=['creation of ' file_exe_global ':' message];
|
---|
[867] | 1913 | return
|
---|
| 1914 | end
|
---|
| 1915 | switch ActionExt
|
---|
| 1916 | case '.m'% Matlab function
|
---|
| 1917 | switch computer
|
---|
| 1918 | case {'GLNX86','GLNXA64','MACI64'}
|
---|
[983] | 1919 | matlab_ver = ver('MATLAB');
|
---|
| 1920 | matlab_version = matlab_ver.Version;
|
---|
[867] | 1921 | cmd=[...
|
---|
| 1922 | '#!/bin/bash \n'...
|
---|
[973] | 1923 | 'source /etc/profile \n'...
|
---|
[983] | 1924 | 'module load matlab/''' matlab_version ''' \n'...% CHOICE OF MATLAB VERSION
|
---|
[1005] | 1925 | 'time_start=$(date +%%s)\n'...
|
---|
| 1926 | 'matlab -nodisplay -nosplash -nojvm -logfile ''' filelog_global ''' <<END_MATLAB\n'...
|
---|
[867] | 1927 | 'addpath(''' path_series '''); \n'...
|
---|
[917] | 1928 | 'addpath(''' Param.Action.ActionPath '''); \n'];
|
---|
| 1929 | for iprocess=1:NbProcess
|
---|
| 1930 | cmd=[cmd '' Param.Action.ActionName '( ''' filexml{iprocess} '''); \n'];
|
---|
| 1931 | end
|
---|
[1005] | 1932 | cmd=[cmd 'exit \n' 'END_MATLAB\n'...
|
---|
| 1933 | 'time_end=$(date +%%s)\n'...
|
---|
| 1934 | 'echo "global time = " $(($time_end - $time_start)) >> ''' filelog_global '''\n'];
|
---|
[992] | 1935 | fprintf(fid,cmd); % fill the executable file with the char string cmd
|
---|
[1005] | 1936 | fclose(fid); % close the executable filefilelog_global
|
---|
[992] | 1937 | system(['chmod +x ' file_exe_global]); % set the file to executable
|
---|
[867] | 1938 | case {'PCWIN','PCWIN64'}
|
---|
[917] | 1939 | cmd=['matlab -automation -logfile ' regexprep(filelog{iprocess},'\\','\\\\')...
|
---|
[867] | 1940 | ' -r "addpath(''' regexprep(path_series,'\\','\\\\') ''');'...
|
---|
[917] | 1941 | 'addpath(''' regexprep(Param.Action.ActionPath,'\\','\\\\') ''');'];
|
---|
| 1942 | for iprocess=1:NbProcess
|
---|
[918] | 1943 | cmd=[cmd '' Param.Action.ActionName '( ''' regexprep(filexml{iprocess},'\\','\\\\') ''');']
|
---|
[917] | 1944 | end
|
---|
| 1945 | cmd=[cmd ';exit"'];
|
---|
[992] | 1946 | fprintf(fid,cmd); % fill the executable file with the char string cmd
|
---|
| 1947 | fclose(fid); % close the executable file
|
---|
[867] | 1948 | end
|
---|
[918] | 1949 | system([file_exe_global ' &'])% directly execute the command file
|
---|
[867] | 1950 | case '.sh' % compiled Matlab function
|
---|
[918] | 1951 | for iprocess=1:NbProcess
|
---|
| 1952 | switch computer
|
---|
| 1953 | case {'GLNX86','GLNXA64','MACI64'}
|
---|
[992] | 1954 | [fid,message]=fopen(batch_file_list{iprocess},'w'); % create the executable file
|
---|
[918] | 1955 | if isequal(fid,-1)
|
---|
| 1956 | errormsg=['creation of .bat file: ' message];
|
---|
| 1957 | return
|
---|
| 1958 | end
|
---|
| 1959 | cmd=['#!/bin/bash \n '...
|
---|
| 1960 | '#$ -cwd \n '...
|
---|
| 1961 | 'hostname && date \n '...
|
---|
| 1962 | 'umask 002 \n'...
|
---|
[992] | 1963 | ActionFullName ' ' RunTime ' ' filexml{iprocess}]; % allow writting access to created files for user group
|
---|
| 1964 | fprintf(fid,cmd); % fill the executable file with the char string cmd
|
---|
| 1965 | fclose(fid); % close the executable file
|
---|
| 1966 | system(['chmod +x ' batch_file_list{iprocess}]); % set the file to executable
|
---|
[918] | 1967 | system([batch_file_list{iprocess} ' &'])% directly execute the command file
|
---|
| 1968 | case {'PCWIN','PCWIN64'}
|
---|
| 1969 | msgbox_uvmat('ERROR','option for compiled Matlab functions not implemented for Windows system')
|
---|
| 1970 | return
|
---|
| 1971 | end
|
---|
[867] | 1972 | end
|
---|
[922] | 1973 | msgbox_uvmat('CONFIRMATION',[ActionFullName ' launched in background: press STATUS to see results'])
|
---|
[867] | 1974 | end
|
---|
[918] | 1975 |
|
---|
| 1976 | case 'cluster_oar' % option 'oar-parexec' used
|
---|
| 1977 | %create subdirectory for oar commands
|
---|
[932] | 1978 | for iprocess=1:NbProcess
|
---|
[992] | 1979 | [fid,message]=fopen(batch_file_list{iprocess},'w'); % create the executable file
|
---|
[918] | 1980 | if isequal(fid,-1)
|
---|
| 1981 | errormsg=['creation of .bat file: ' message];
|
---|
| 1982 | return
|
---|
| 1983 | end
|
---|
| 1984 | if strcmp(ActionExt,'.sh')
|
---|
[932] | 1985 | cmd=['#!/bin/bash \n '...
|
---|
| 1986 | '#$ -cwd \n '...
|
---|
| 1987 | 'hostname && date \n '...
|
---|
| 1988 | 'umask 002 \n'...
|
---|
[992] | 1989 | ActionFullName ' ' RunTime ' ' filexml{iprocess}]; % allow writting access to created files for user group
|
---|
[918] | 1990 | else
|
---|
[973] | 1991 | matlab_ver = ver('MATLAB');
|
---|
| 1992 | matlab_version = matlab_ver.Version;
|
---|
[918] | 1993 | cmd=[...
|
---|
[932] | 1994 | '#!/bin/bash \n'...
|
---|
[973] | 1995 | 'source /etc/profile \n'...
|
---|
| 1996 | 'module load matlab/''' matlab_version ''' \n'...% CHOICE OF MATLAB VERSION
|
---|
[1005] | 1997 | 'matlab -nodisplay -nosplash -nojvm -singleCompThread -logfile ''' filelog{iprocess} ''' <<END_MATLAB\n'...
|
---|
[932] | 1998 | 'addpath(''' path_series '''); \n'...
|
---|
| 1999 | 'addpath(''' Param.Action.ActionPath '''); \n'...
|
---|
| 2000 | '' Param.Action.ActionName '( ''' filexml{iprocess} '''); \n'...
|
---|
[1005] | 2001 | 'exit' '\n'...
|
---|
| 2002 | 'END_MATLAB\n'];
|
---|
[918] | 2003 | end
|
---|
[992] | 2004 | fprintf(fid,cmd); % fill the executable file with the char string cmd
|
---|
| 2005 | fclose(fid); % close the executable file
|
---|
| 2006 | system(['chmod +x ' batch_file_list{iprocess}]); % set the file to executable
|
---|
[918] | 2007 | end
|
---|
| 2008 | DirOAR=fullfile(OutputDir,'0_OAR');
|
---|
| 2009 | if exist(DirOAR,'dir')% delete the content of the dir 0_LOG to allow new input
|
---|
| 2010 | curdir=pwd;
|
---|
| 2011 | cd(DirOAR)
|
---|
| 2012 | delete('*')
|
---|
| 2013 | cd(curdir)
|
---|
| 2014 | else
|
---|
| 2015 | [tild,msg1]=mkdir(DirOAR);
|
---|
| 2016 | if ~strcmp(msg1,'')
|
---|
[992] | 2017 | errormsg=['cannot create ' DirOAR ': ' msg1]; % error message for directory creation
|
---|
[918] | 2018 | return
|
---|
| 2019 | end
|
---|
| 2020 | end
|
---|
| 2021 | % create file containing the list of jobs
|
---|
[992] | 2022 | filename_joblist=fullfile(DirOAR,'job_list.txt'); % name of the file containing the list of executables
|
---|
| 2023 | fid=fopen(filename_joblist,'w'); % open it for writting
|
---|
[918] | 2024 | for iprocess=1:length(batch_file_list)
|
---|
[992] | 2025 | fprintf(fid,[batch_file_list{iprocess} '\n']); % write list of exe files
|
---|
[918] | 2026 | end
|
---|
| 2027 | fclose(fid);
|
---|
[992] | 2028 | system(['chmod +x ' filename_joblist]); % set the file to executable
|
---|
[918] | 2029 |
|
---|
[992] | 2030 | filename_log=fullfile(DirLog,'job_list.stdout'); % file for output messages of the master oar process
|
---|
| 2031 | filename_errors=fullfile(DirLog,'job_list.stderr'); % file for error messages of the master oar process
|
---|
[918] | 2032 | % the command job_list.txt contains the list of NbProcess independent individual jobs
|
---|
| 2033 | % in which the total calculation has been split. Those are written as executable files .sh in the folder /O_EXE.
|
---|
| 2034 | % These individual jobs are grouped by the system as oar jobs on the NbCore processors.
|
---|
| 2035 | % For each processor, the oar job must stop after the walltime which has been set, which is limited to 24 h.
|
---|
| 2036 | % However, the oar job is automatically restarted (option 'idempotent') provided the individual jobs are
|
---|
| 2037 | % shorter than the wall time: in the time interval 'checkpoint' (WallTimeOneJob) before the end of the allowed duration,
|
---|
| 2038 | % the oar job restarts when an individual job ends.
|
---|
[997] | 2039 | WallTimeMax=SeriesData.SeriesParam.OarParam.WallTimeMax;
|
---|
| 2040 | JobTime=CPUTime*BlockLength*nbfield_j; % estimated CPU time for one individual job (in minutes)
|
---|
[918] | 2041 | % wall time (in hours ) for each oar job, allowing 10 individual jobs, but limited to 23 h:
|
---|
[997] | 2042 | WallTimeTotal=min(WallTimeMax,4*JobTime/60);
|
---|
[918] | 2043 | %disp(['WallTimeTotal: ' num2str(WallTimeTotal) ' hours'])
|
---|
| 2044 | % estimated time of an individual job (in min), with a margin of error
|
---|
[992] | 2045 | WallTimeOneJob=min(4*JobTime+10,WallTimeTotal*60/2); % estimated max time of an individual job for checkpoint
|
---|
[918] | 2046 | disp(['WallTimeOneJob: ' num2str(WallTimeOneJob) ' minutes'])
|
---|
[1010] | 2047 | if NbProcess>=8
|
---|
| 2048 | bigiojob_string=['+{type = ' char(39) 'bigiojob' char(39) '}/licence=1'];% char(39) is quote - bigiojob limit UVmat parallel launch on cluster to avoid saturation of disk access to data
|
---|
| 2049 | else
|
---|
| 2050 | bigiojob_string='';
|
---|
| 2051 | end
|
---|
[922] | 2052 | oar_command=['oarsub -n UVmat_' ActionFullName ' '...
|
---|
[918] | 2053 | '-t idempotent --checkpoint ' num2str(WallTimeOneJob*60) ' '...
|
---|
[989] | 2054 | '-l "/core=' num2str(NbCore)...
|
---|
[1010] | 2055 | bigiojob_string... % char(39) is quote - bigiojob limit UVmat parallel launch on cluster
|
---|
[989] | 2056 | ',walltime=' datestr(WallTimeTotal/24,13) '" '...
|
---|
[918] | 2057 | '-E ' filename_errors ' '...
|
---|
| 2058 | '-O ' filename_log ' '...
|
---|
| 2059 | extra_oar ' '...
|
---|
[932] | 2060 | '"oar-parexec -s -f ' filename_joblist ' '...
|
---|
[918] | 2061 | '-l ' filename_joblist '.log"'];
|
---|
[922] | 2062 |
|
---|
[992] | 2063 | fprintf(oar_command); % display system command on the Matlab command window
|
---|
[918] | 2064 | [status,result]=system(oar_command)% execute system command and show the result (ID number of the launched job) on the Matlab command window
|
---|
[992] | 2065 | filename_oarcommand=fullfile(DirOAR,'0_oar_command'); % keep track of the command in file '0-OAR/0_oar_command'
|
---|
[918] | 2066 | fid=fopen(filename_oarcommand,'w');
|
---|
| 2067 | fprintf(fid,oar_command); % store the command
|
---|
[992] | 2068 | fprintf(fid,result); % store the result (job ID number)
|
---|
[918] | 2069 | fclose(fid);
|
---|
[922] | 2070 | msgbox_uvmat('CONFIRMATION',[ActionFullName ' launched as ' num2str(NbProcess) ' processes in cluster: press STATUS to see results'])
|
---|
[918] | 2071 |
|
---|
| 2072 | case 'cluster_pbs' % for LMFA Kepler machine
|
---|
| 2073 | %create subdirectory for pbs command and log files
|
---|
[992] | 2074 | DirPBS=fullfile(OutputDir,'0_PBS'); % todo : common name OAR/PBS
|
---|
[918] | 2075 | if exist(DirPBS,'dir')% delete the content of the dir 0_LOG to allow new input
|
---|
| 2076 | curdir=pwd;
|
---|
| 2077 | cd(DirPBS)
|
---|
| 2078 | delete('*')
|
---|
| 2079 | cd(curdir)
|
---|
| 2080 | else
|
---|
| 2081 | [tild,msg1]=mkdir(DirPBS);
|
---|
| 2082 | if ~strcmp(msg1,'')
|
---|
[992] | 2083 | errormsg=['cannot create ' DirPBS ': ' msg1]; % error message for directory creation
|
---|
[918] | 2084 | return
|
---|
| 2085 | end
|
---|
| 2086 | end
|
---|
| 2087 | max_walltime=3600*20; % 20h max total calculation (cannot exceed 24 h)
|
---|
| 2088 | walltime_onejob=1800; % seconds, max estimated time for asingle file index value
|
---|
[992] | 2089 | filename_joblist=fullfile(DirPBS,'job_list.txt'); % create name of the global executable file
|
---|
[918] | 2090 | fid=fopen(filename_joblist,'w');
|
---|
| 2091 | for iprocess=1:length(batch_file_list)
|
---|
[992] | 2092 | fprintf(fid,[batch_file_list{iprocess} '\n']); % list of exe files
|
---|
[918] | 2093 | end
|
---|
| 2094 | fclose(fid);
|
---|
[992] | 2095 | system(['chmod +x ' filename_joblist]); % set the file to executable
|
---|
[984] | 2096 | pbs_command=['qsub -n CIVX '...
|
---|
[918] | 2097 | '-t idempotent --checkpoint ' num2str(walltime_onejob+60) ' '...
|
---|
| 2098 | '-l /core=' num2str(NbCore) ','...
|
---|
| 2099 | 'walltime=' datestr(min(1.05*walltime_onejob/86400*max(NbProcess*BlockLength*nbfield_j,NbCore)/NbCore,max_walltime/86400),13) ' '...
|
---|
| 2100 | '-E ' regexprep(filename_joblist,'\.txt\>','.stderr') ' '...
|
---|
| 2101 | '-O ' regexprep(filename_joblist,'\.txt\>','.log') ' '...
|
---|
[984] | 2102 | extra_qstat ' '...
|
---|
[918] | 2103 | '"oar-parexec -s -f ' filename_joblist ' '...
|
---|
| 2104 | '-l ' filename_joblist '.log"'];
|
---|
| 2105 | filename_oarcommand=fullfile(DirPBS,'pbs_command');
|
---|
| 2106 | fid=fopen(filename_oarcommand,'w');
|
---|
| 2107 | fprintf(fid,pbs_command);
|
---|
| 2108 | fclose(fid);
|
---|
[992] | 2109 | fprintf(pbs_command); % display in command line
|
---|
[918] | 2110 | %system(pbs_command);
|
---|
[922] | 2111 | msgbox_uvmat('CONFIRMATION',[ActionFullName ' command ready to be launched in cluster'])
|
---|
[984] | 2112 |
|
---|
| 2113 | case 'cluster_sge' % for PSMN
|
---|
[991] | 2114 | % Au PSMN, on ne cr??e pas 1 job avec plusieurs c??urs, mais N jobs de 1 c??urs
|
---|
| 2115 | % o?? N < 1000.
|
---|
[984] | 2116 | %create subdirectory for pbs command and log files
|
---|
| 2117 |
|
---|
| 2118 | DirSGE=fullfile(OutputDir,'0_SGE');
|
---|
| 2119 | if exist(DirSGE,'dir')% delete the content of the dir 0_LOG to allow new input
|
---|
| 2120 | curdir=pwd;
|
---|
| 2121 | cd(DirSGE)
|
---|
| 2122 | delete('*')
|
---|
| 2123 | cd(curdir)
|
---|
| 2124 | else
|
---|
| 2125 | [tild,msg1]=mkdir(DirSGE);
|
---|
| 2126 | if ~strcmp(msg1,'')
|
---|
[992] | 2127 | errormsg=['cannot create ' DirSGE ': ' msg1]; % error message for directory creation
|
---|
[984] | 2128 | return
|
---|
| 2129 | end
|
---|
| 2130 | end
|
---|
| 2131 | maxImgsPerJob = ceil(length(batch_file_list)/NbCore);
|
---|
| 2132 | disp(['Max number of jobs: ' num2str(NbCore)])
|
---|
| 2133 | disp(['Images per job: ' num2str(maxImgsPerJob)])
|
---|
| 2134 |
|
---|
| 2135 | iprocess = 1;
|
---|
| 2136 | imgsInJob = [];
|
---|
| 2137 | currJobIndex = 1;
|
---|
| 2138 | done = 0;
|
---|
| 2139 | while(~done)
|
---|
| 2140 | if(iprocess <= length(batch_file_list))
|
---|
| 2141 | imgsInJob = [imgsInJob, iprocess];
|
---|
| 2142 | end
|
---|
| 2143 | if((numel(imgsInJob) >= maxImgsPerJob) || (iprocess == length(batch_file_list)))
|
---|
| 2144 | cmd=['#!/bin/sh \n'...
|
---|
| 2145 | '#$ -cwd \n'...
|
---|
| 2146 | 'hostname && date\n']
|
---|
| 2147 | for ii=1:numel(imgsInJob)
|
---|
| 2148 | cmd=[cmd ActionFullName ' /softs/matlab ' filexml{imgsInJob(ii)} '\n'];
|
---|
| 2149 | end
|
---|
| 2150 | [fid, message] = fopen([DirSGE '/job' num2str(currJobIndex) '.sh'], 'w');
|
---|
| 2151 | fprintf(fid, cmd);
|
---|
| 2152 | fclose(fid);
|
---|
| 2153 | system(['chmod +x ' DirSGE '/job' num2str(currJobIndex) '.sh'])
|
---|
| 2154 | sge_command=['qsub -N civ_' num2str(currJobIndex) ' '...
|
---|
| 2155 | '-q ' qstat_Queue ' '...
|
---|
| 2156 | '-e ' fullfile([DirSGE '/job' num2str(currJobIndex) '.out']) ' '...
|
---|
| 2157 | '-o ' fullfile([DirSGE '/job' num2str(currJobIndex) '.out']) ' '...
|
---|
| 2158 | fullfile([DirSGE '/job' num2str(currJobIndex) '.sh'])];
|
---|
[992] | 2159 | fprintf(sge_command); % display in command line
|
---|
[984] | 2160 | [status, result] = system(sge_command);
|
---|
| 2161 | fprintf(result);
|
---|
| 2162 | currJobIndex = currJobIndex + 1;
|
---|
| 2163 | imgsInJob = [];
|
---|
| 2164 | end
|
---|
| 2165 | if(iprocess == length(batch_file_list))
|
---|
| 2166 | done = 1;
|
---|
| 2167 | end
|
---|
| 2168 | iprocess = iprocess + 1;
|
---|
| 2169 | end
|
---|
| 2170 | msgbox_uvmat('CONFIRMATION',[num2str(currJobIndex-1) ' jobs launched on queue ' qstat_Queue '.'])
|
---|
[918] | 2171 | case 'python'
|
---|
[1003] | 2172 | command = ['LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | pyp "l = x.split('':''); l = [s for s in l if ''matlab'' not in s]; print('':''.join(l))") ' ...
|
---|
[942] | 2173 | 'python -m fluidimage.run_from_xml ' filexml{iprocess}];
|
---|
[1004] | 2174 | fprintf(['command:\n' command '\n\n'])
|
---|
[918] | 2175 | system(command, '-echo');
|
---|
[867] | 2176 | end
|
---|
[932] | 2177 | if exist(OutputDir,'dir')
|
---|
[996] | 2178 | [SUCCESS,MESSAGE,MESSAGEID] = fileattrib (OutputDir);
|
---|
[935] | 2179 | if MESSAGE.GroupWrite~=1
|
---|
[992] | 2180 | [success,msg] = fileattrib(OutputDir,'+w','g','s'); % allow writing access for the group of users, recursively in the folder
|
---|
[932] | 2181 | if success==0
|
---|
[992] | 2182 | msgbox_uvmat('WARNING',{['unable to set group write access to ' OutputDir ':']; msg}); % error message for directory creation
|
---|
[932] | 2183 | end
|
---|
[935] | 2184 | end
|
---|
[932] | 2185 | end
|
---|
[934] | 2186 |
|
---|
[867] | 2187 | %------------------------------------------------------------------------
|
---|
| 2188 | function STOP_Callback(hObject, eventdata, handles)
|
---|
| 2189 | %------------------------------------------------------------------------
|
---|
| 2190 | set(handles.RUN, 'BusyAction','cancel')
|
---|
| 2191 | set(handles.RUN,'BackgroundColor',[1 0 0])
|
---|
| 2192 | set(handles.RUN,'enable','on')
|
---|
| 2193 | set(handles.RUN, 'Value',0)
|
---|
| 2194 |
|
---|
| 2195 | %------------------------------------------------------------------------
|
---|
| 2196 | % --- read parameters from the GUI series
|
---|
| 2197 | %------------------------------------------------------------------------
|
---|
| 2198 | function Param=read_GUI_series(handles)
|
---|
| 2199 |
|
---|
| 2200 | %% read raw parameters from the GUI series
|
---|
| 2201 | Param=read_GUI(handles.series);
|
---|
| 2202 |
|
---|
| 2203 | %% clean the output structure by removing unused information
|
---|
| 2204 | if isfield(Param,'Pairs')
|
---|
[992] | 2205 | Param=rmfield(Param,'Pairs'); % info Pairs not needed for output
|
---|
[867] | 2206 | end
|
---|
| 2207 | if isfield(Param,'InputLine')
|
---|
| 2208 | Param=rmfield(Param,'InputLine');
|
---|
| 2209 | end
|
---|
| 2210 | if isfield(Param,'EditObject')
|
---|
| 2211 | Param=rmfield(Param,'EditObject');
|
---|
| 2212 | end
|
---|
| 2213 | Param.IndexRange.TimeSource=Param.IndexRange.TimeTable{end,1};
|
---|
| 2214 | Param.IndexRange=rmfield(Param.IndexRange,'TimeTable');
|
---|
| 2215 | empty_line=false(size(Param.InputTable,1),1);
|
---|
| 2216 | for iline=1:size(Param.InputTable,1)
|
---|
| 2217 | empty_line(iline)=isempty(cell2mat(Param.InputTable(iline,1:3)));
|
---|
| 2218 | end
|
---|
| 2219 | Param.InputTable(empty_line,:)=[];
|
---|
| 2220 |
|
---|
| 2221 | %------------------------------------------------------------------------
|
---|
| 2222 | % --- Executes on selection change in ActionName.
|
---|
| 2223 | function ActionName_Callback(hObject, eventdata, handles)
|
---|
| 2224 | %------------------------------------------------------------------------
|
---|
| 2225 |
|
---|
| 2226 | %% stop any ongoing series processing
|
---|
| 2227 | if isequal(get(handles.RUN,'Value'),1)
|
---|
| 2228 | answer= msgbox_uvmat('INPUT_Y-N','stop current Action process?');
|
---|
| 2229 | if strcmp(answer,'Yes')
|
---|
| 2230 | STOP_Callback(hObject, eventdata, handles)
|
---|
| 2231 | else
|
---|
| 2232 | return
|
---|
| 2233 | end
|
---|
| 2234 | end
|
---|
| 2235 | set(handles.ActionName,'BackgroundColor',[1 1 0])
|
---|
| 2236 | huigetfile=findobj(allchild(0),'tag','status_display');
|
---|
| 2237 | if ~isempty(huigetfile)
|
---|
| 2238 | delete(huigetfile)
|
---|
| 2239 | end
|
---|
| 2240 | drawnow
|
---|
| 2241 |
|
---|
| 2242 | %% get Action name and path
|
---|
[992] | 2243 | NbBuiltinAction=get(handles.Action,'UserData'); % nbre of functions initially proposed in the menu ActionName (as defined in the Opening fct of series)
|
---|
| 2244 | ActionList=get(handles.ActionName,'String'); % list menu fields
|
---|
[867] | 2245 | ActionIndex=get(handles.ActionName,'Value');
|
---|
| 2246 | if ~isequal(ActionIndex,1)% if we are not just opening series
|
---|
| 2247 | InputTable=get(handles.InputTable,'Data');
|
---|
| 2248 | if isempty(InputTable{1,4})
|
---|
| 2249 | msgbox_uvmat('ERROR','no input file available: use Open in the menu bar')
|
---|
| 2250 | return
|
---|
| 2251 | end
|
---|
| 2252 | end
|
---|
| 2253 | ActionName= ActionList{get(handles.ActionName,'Value')}; % selected function name
|
---|
[992] | 2254 | ActionPathList=get(handles.ActionName,'UserData'); % list of recorded paths to functions of the list ActionName
|
---|
[867] | 2255 |
|
---|
| 2256 | %% add a new function to the menu if 'more...' has been selected in the menu ActionName
|
---|
| 2257 | if isequal(ActionName,'more...')
|
---|
| 2258 | [FileName, PathName] = uigetfile( ...
|
---|
| 2259 | {'*.m', ' (*.m)';
|
---|
| 2260 | '*.m', '.m files '; ...
|
---|
| 2261 | '*.*', 'All Files (*.*)'}, ...
|
---|
| 2262 | 'Pick a series processing function ',get(handles.ActionPath,'String'));
|
---|
| 2263 | if length(FileName)<2
|
---|
| 2264 | return
|
---|
| 2265 | end
|
---|
| 2266 | [tild,ActionName,ActionExt]=fileparts(FileName);
|
---|
| 2267 |
|
---|
| 2268 | % insert the choice in the menu ActionName
|
---|
[992] | 2269 | ActionIndex=find(strcmp(ActionName,ActionList),1); % look for the selected function in the menu Action
|
---|
[867] | 2270 | PathName=regexprep(PathName,'/$','');
|
---|
| 2271 | if ~isempty(ActionIndex) && ~strcmp(ActionPathList{ActionIndex},PathName)%compare the path to the existing fct
|
---|
| 2272 | ActionIndex=[]; % the selected path is different than the recorded one
|
---|
| 2273 | end
|
---|
| 2274 | if isempty(ActionIndex)%the qselected fct (with selected path) does not exist in the menu
|
---|
| 2275 | ActionIndex= length(ActionList);
|
---|
[992] | 2276 | ActionList=[ActionList(1:end-1);{ActionName};ActionList(end)]; % the selected function is appended in the menu, before the last item 'more...'
|
---|
[867] | 2277 | ActionPathList=[ActionPathList; PathName];
|
---|
| 2278 | end
|
---|
| 2279 |
|
---|
| 2280 | % record the file extension and extend the path list if it is a new extension
|
---|
[886] | 2281 | ActionExtList=get(handles.ActionExt,'String');
|
---|
| 2282 | ActionExtIndex=find(strcmp(ActionExt,ActionExtList), 1);
|
---|
| 2283 | if isempty(ActionExtIndex)
|
---|
| 2284 | set(handles.ActionExt,'String',[ActionExtList;{ActionExt}])
|
---|
| 2285 | end
|
---|
[867] | 2286 |
|
---|
| 2287 | % remove old Action options in the menu (keeping a menu length <nb_builtin_ACTION+5)
|
---|
[992] | 2288 | if length(ActionList)>NbBuiltinAction+5; % nb_builtin_ACTION=nbre of functions always remaining in the initial menu
|
---|
[867] | 2289 | nbremove=length(ActionList)-NbBuiltinAction-5;
|
---|
| 2290 | ActionList(NbBuiltinAction+1:end-5)=[];
|
---|
| 2291 | ActionPathList(NbBuiltinAction+1:end-4,:)=[];
|
---|
| 2292 | ActionIndex=ActionIndex-nbremove;
|
---|
| 2293 | end
|
---|
| 2294 |
|
---|
| 2295 | % record action menu, choice and path
|
---|
| 2296 | set(handles.ActionName,'Value',ActionIndex)
|
---|
| 2297 | set(handles.ActionName,'String',ActionList)
|
---|
| 2298 | set(handles.ActionName,'UserData',ActionPathList);
|
---|
| 2299 | set(handles.ActionExt,'Value',ActionExtIndex)
|
---|
| 2300 |
|
---|
| 2301 | %record the user defined menu additions in personal file profil_perso
|
---|
| 2302 | dir_perso=prefdir;
|
---|
| 2303 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
|
---|
| 2304 | if NbBuiltinAction+1<=numel(ActionList)-1
|
---|
| 2305 | ActionListUser=ActionList(NbBuiltinAction+1:numel(ActionList)-1);
|
---|
| 2306 | ActionPathListUser=ActionPathList(NbBuiltinAction+1:numel(ActionList)-1);
|
---|
[886] | 2307 | ActionExtListUser={};
|
---|
| 2308 | if numel(ActionExtList)>2
|
---|
| 2309 | ActionExtListUser=ActionExtList(3:end);
|
---|
| 2310 | end
|
---|
[867] | 2311 | if exist(profil_perso,'file')
|
---|
| 2312 | save(profil_perso,'ActionListUser','ActionPathListUser','ActionExtListUser','-append')
|
---|
| 2313 | else
|
---|
| 2314 | save(profil_perso,'ActionListUser','ActionPathListUser','ActionExtListUser','-V6')
|
---|
| 2315 | end
|
---|
| 2316 | end
|
---|
| 2317 | end
|
---|
| 2318 |
|
---|
| 2319 | %% check the current ActionPath to the selected function
|
---|
[992] | 2320 | ActionPath=ActionPathList{ActionIndex}; % current recorded path
|
---|
| 2321 | set(handles.ActionPath,'String',ActionPath); % show the path to the senlected function
|
---|
[867] | 2322 |
|
---|
| 2323 | %% reinitialise the waitbar
|
---|
| 2324 | update_waitbar(handles.Waitbar,0)
|
---|
| 2325 |
|
---|
[996] | 2326 | %% Put the first line of the selected Action fct as tooltip help
|
---|
| 2327 | try
|
---|
| 2328 | [fid,errormsg] =fopen([ActionName '.m']);
|
---|
| 2329 | InputText=textscan(fid,'%s',1,'delimiter','\n');
|
---|
| 2330 | fclose(fid);
|
---|
| 2331 | set(handles.ActionName,'ToolTipString',InputText{1}{1})% put the first line of the selected function as tooltip help
|
---|
| 2332 | end
|
---|
| 2333 | set(handles.ActionName,'BackgroundColor',[1 1 1])
|
---|
| 2334 | set(handles.ActionInput,'BackgroundColor',[1 0 1])% set ActionInput button to magenta color to indicate that input refr
|
---|
| 2335 |
|
---|
| 2336 |
|
---|
| 2337 | % --- Executes on button press in ActionInput.
|
---|
| 2338 | function ActionInput_Callback(hObject, eventdata, handles)
|
---|
| 2339 |
|
---|
| 2340 | set(handles.ActionInput,'BackgroundColor',[1 1 0])
|
---|
| 2341 |
|
---|
[867] | 2342 | %% create the function handle for Action
|
---|
[996] | 2343 | ActionPath=get(handles.ActionPath,'String');
|
---|
| 2344 | ActionList=get(handles.ActionName,'String');
|
---|
| 2345 | ActionName= ActionList{get(handles.ActionName,'Value')}; % selected function name
|
---|
[897] | 2346 | if ~exist(ActionPath,'dir')
|
---|
| 2347 | msgbox_uvmat('ERROR',['The prescribed function path ' ActionPath ' does not exist']);
|
---|
| 2348 | return
|
---|
[867] | 2349 | end
|
---|
[992] | 2350 | current_dir=pwd; % current working dir
|
---|
[897] | 2351 | cd(ActionPath)
|
---|
| 2352 | h_fun=str2func(ActionName);
|
---|
| 2353 | cd(current_dir)
|
---|
[867] | 2354 |
|
---|
| 2355 | %% Activate the Action fct to adapt the configuration of the GUI series and bring specific parameters in SeriesData
|
---|
[992] | 2356 | Param=read_GUI_series(handles); % read the parameters from the GUI series
|
---|
[997] | 2357 | Param.Action.RUN=0;
|
---|
[992] | 2358 | ParamOut=h_fun(Param); % run the selected Action function to get the relevant input
|
---|
[867] | 2359 |
|
---|
| 2360 |
|
---|
| 2361 | %% Visibility of VelType and VelType_1 menus asked by ActionName
|
---|
[992] | 2362 | VelTypeRequest=1; % VelType requested by default
|
---|
| 2363 | VelTypeRequest_1=1; % VelType requested by default
|
---|
[867] | 2364 | if isfield(ParamOut,'VelType')
|
---|
| 2365 | VelTypeRequest=ismember(ParamOut.VelType,{'on','one','two'});
|
---|
| 2366 | VelTypeRequest_1=strcmp( ParamOut.VelType,'two');
|
---|
| 2367 | end
|
---|
| 2368 | FieldNameRequest=0; %hidden by default
|
---|
| 2369 | FieldNameRequest_1=0; %hidden by default
|
---|
| 2370 | if isfield(ParamOut,'FieldName')
|
---|
| 2371 | FieldNameRequest=ismember(ParamOut.FieldName,{'on','one','two'});
|
---|
| 2372 | FieldNameRequest_1=strcmp( ParamOut.FieldName,'two');
|
---|
| 2373 | end
|
---|
| 2374 |
|
---|
| 2375 | %% Detect the types of input files and set menus and default options in 'VelType'
|
---|
[992] | 2376 | SeriesData=get(handles.series,'UserData'); % info on the input file series
|
---|
[867] | 2377 | iview_civ=find(strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType));
|
---|
[992] | 2378 | iview_netcdf=find(strcmp('netcdf',SeriesData.FileType)|strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType)); % all nc files, icluding civ
|
---|
| 2379 | FieldList=get(handles.FieldName,'String'); % previous list as default
|
---|
[867] | 2380 | if ~iscell(FieldList),FieldList={FieldList};end
|
---|
[992] | 2381 | FieldList_1=get(handles.FieldName_1,'String'); % previous list as default
|
---|
[867] | 2382 | if ~iscell(FieldList_1),FieldList_1={FieldList_1};end
|
---|
[992] | 2383 | %CheckList=0; % indicate whether FieldName has been updated
|
---|
| 2384 | CheckList_1=1; % indicate whether FieldName_1 has been updated
|
---|
[867] | 2385 | handles_coord=[handles.Coord_x handles.Coord_y handles.Coord_z handles.Coord_x_title handles.Coord_y_title handles.Coord_z_title];
|
---|
[954] | 2386 | if VelTypeRequest && numel(iview_civ)>=1
|
---|
[867] | 2387 | menu=set_veltype_display(SeriesData.FileInfo{iview_civ(1)}.CivStage,SeriesData.FileType{iview_civ(1)});
|
---|
| 2388 | set(handles.VelType,'Value',1)% set first choice by default
|
---|
| 2389 | set(handles.VelType,'String',[{'*'};menu])
|
---|
| 2390 | set(handles.VelType,'Visible','on')
|
---|
| 2391 | set(handles.VelType_title,'Visible','on')
|
---|
[992] | 2392 | FieldList=[set_field_list('U','V');{'C'};{'get_field...'}]; % standard menu for civx data
|
---|
[897] | 2393 | %CheckList=1;
|
---|
[992] | 2394 | set(handles.FieldName,'Value',1); % velocity vector choice by default
|
---|
[954] | 2395 | if VelTypeRequest_1 && numel(iview_civ)>=2
|
---|
[867] | 2396 | menu=set_veltype_display(SeriesData.FileInfo{iview_civ(2)}.CivStage,SeriesData.FileType{iview_civ(2)});
|
---|
| 2397 | set(handles.VelType_1,'Value',1)% set first choice by default
|
---|
| 2398 | set(handles.VelType_1,'String',[{'*'};menu])
|
---|
| 2399 | set(handles.VelType_1,'Visible','on')
|
---|
| 2400 | set(handles.VelType_title_1,'Visible','on')
|
---|
[992] | 2401 | FieldList_1=[set_field_list('U','V');{'C'};{'get_field...'}]; % standard menu for civx data
|
---|
[867] | 2402 | CheckList_1=1;
|
---|
[992] | 2403 | set(handles.FieldName_1,'Value',1); % velocity vector choice by default
|
---|
[867] | 2404 | else
|
---|
| 2405 | set(handles.VelType_1,'Visible','off')
|
---|
| 2406 | set(handles.VelType_title_1,'Visible','off')
|
---|
| 2407 | end
|
---|
| 2408 | else
|
---|
| 2409 | set(handles.VelType,'Visible','off')
|
---|
| 2410 | set(handles.VelType_title,'Visible','off')
|
---|
[954] | 2411 | end
|
---|
[867] | 2412 |
|
---|
| 2413 | %% Detect the types of input files and set menus and default options in 'FieldName'
|
---|
[940] | 2414 | if (FieldNameRequest || VelTypeRequest) && numel(iview_netcdf)>=1
|
---|
[954] | 2415 | set(handles.InputFields,'Visible','on')% set the frame InputFields visible
|
---|
[940] | 2416 | if FieldNameRequest && isfield(SeriesData.FileInfo{iview_netcdf(1)},'ListVarName')
|
---|
| 2417 | set(handles.FieldName,'Visible','on')
|
---|
[867] | 2418 | ListVarName=SeriesData.FileInfo{iview_netcdf(1)}.ListVarName;
|
---|
[992] | 2419 | ind_var=get(handles.FieldName,'Value'); % indices of previously selected variables
|
---|
[867] | 2420 | for ilist=1:numel(ind_var)
|
---|
| 2421 | if isempty(find(strcmp(FieldList{ind_var(ilist)},ListVarName)))
|
---|
[992] | 2422 | FieldList={}; % previous choice not consistent with new input field
|
---|
[867] | 2423 | set(handles.FieldName,'Value',1)
|
---|
| 2424 | break
|
---|
| 2425 | end
|
---|
| 2426 | end
|
---|
| 2427 | if ~isempty(FieldList)
|
---|
| 2428 | if isempty(find(strcmp(get(handles.Coord_x,'String'),ListVarName)))||...
|
---|
| 2429 | isempty(find(strcmp(get(handles.Coord_y,'String'),ListVarName)))
|
---|
| 2430 | FieldList={};
|
---|
| 2431 | set(handles.Coord_x,'String','')
|
---|
| 2432 | set(handles.Coord_y,'String','')
|
---|
| 2433 | end
|
---|
| 2434 | Coord_z=get(handles.Coord_z,'String');
|
---|
| 2435 | if ~isempty(Coord_z) && isempty(find(strcmp(Coord_z,ListVarName)))
|
---|
| 2436 | FieldList={};
|
---|
| 2437 | set(handles.Coord_z,'String','')
|
---|
| 2438 | end
|
---|
| 2439 | end
|
---|
[984] | 2440 | else
|
---|
| 2441 | set(handles.FieldName,'Visible','off')
|
---|
[954] | 2442 | end
|
---|
| 2443 |
|
---|
| 2444 | set(handles_coord,'Visible','on')
|
---|
| 2445 | FieldList=[FieldList;{'get_field...'}];
|
---|
| 2446 | if FieldNameRequest_1 && numel(iview_netcdf)>=2
|
---|
| 2447 | set(handles.FieldName_1,'Visible','on')
|
---|
| 2448 | if CheckList_1==0 % not civ input made
|
---|
| 2449 | ListVarName=SeriesData.FileInfo{iview_netcdf(2)}.ListVarName;
|
---|
[992] | 2450 | ind_var=get(handles.FieldName,'Value'); % indices of previously selected variables
|
---|
[954] | 2451 | for ilist=1:numel(ind_var)
|
---|
| 2452 | if isempty(find(strcmp(FieldList{ind_var(ilist)},ListVarName)))
|
---|
[992] | 2453 | FieldList_1={}; % previous choice not consistent with new input field
|
---|
[954] | 2454 | set(handles.FieldName_1,'Value',1)
|
---|
| 2455 | break
|
---|
[867] | 2456 | end
|
---|
| 2457 | end
|
---|
[954] | 2458 | warn_coord=0;
|
---|
| 2459 | if isempty(find(strcmp(get(handles.Coord_x,'String'),ListVarName)))||...
|
---|
| 2460 | isempty(find(strcmp(get(handles.Coord_y,'String'),ListVarName)))
|
---|
| 2461 | warn_coord=1;
|
---|
| 2462 | end
|
---|
| 2463 | if ~isempty(Coord_z) && isempty(find(strcmp(Coord_z,ListVarName)))
|
---|
| 2464 | FieldList_1={};
|
---|
| 2465 | warn_coord=1;
|
---|
| 2466 | end
|
---|
| 2467 | if warn_coord
|
---|
[984] | 2468 | msgbox_uvmat('WARNING','coordinate names do not exist in the second netcdf input file')
|
---|
[954] | 2469 | end
|
---|
| 2470 |
|
---|
| 2471 | set(handles.FieldName_1,'Visible','on')
|
---|
| 2472 | set(handles.FieldName_1,'Value',1)
|
---|
| 2473 | set(handles.FieldName_1,'String',FieldList_1)
|
---|
[867] | 2474 | end
|
---|
[940] | 2475 | else
|
---|
[954] | 2476 | set(handles.FieldName_1,'Visible','off')
|
---|
| 2477 | end
|
---|
| 2478 | if isempty(FieldList)
|
---|
[940] | 2479 | set(handles.FieldName,'Visible','off')
|
---|
[954] | 2480 | else
|
---|
| 2481 | set(handles.FieldName,'Visible','on')
|
---|
| 2482 | set(handles.FieldName,'String',FieldList)
|
---|
[940] | 2483 | end
|
---|
[867] | 2484 | else
|
---|
| 2485 | set(handles.InputFields,'Visible','off')
|
---|
| 2486 | end
|
---|
| 2487 |
|
---|
[904] | 2488 | %% Introduce visibility of file overwrite option
|
---|
| 2489 | if isfield(ParamOut,'CheckOverwriteVisible')&& strcmp(ParamOut.CheckOverwriteVisible,'on')
|
---|
| 2490 | set(handles.CheckOverwrite,'Visible','on')
|
---|
| 2491 | else
|
---|
| 2492 | set(handles.CheckOverwrite,'Visible','off')
|
---|
| 2493 | end
|
---|
[867] | 2494 |
|
---|
| 2495 | %% Check whether alphabetical sorting of input Subdir is allowed by the Action fct (for multiples series entries)
|
---|
| 2496 | if isfield(ParamOut,'AllowInputSort')&&isequal(ParamOut.AllowInputSort,'on')&& size(Param.InputTable,1)>1
|
---|
[1008] | 2497 | [tild,iview]=sort(Param.InputTable(:,2)); % subdirectories sorted in alphabetical order
|
---|
| 2498 | set(handles.InputTable,'Data',Param.InputTable(iview,:));
|
---|
[867] | 2499 | MinIndex_i=get(handles.MinIndex_i,'Data');
|
---|
| 2500 | MinIndex_j=get(handles.MinIndex_j,'Data');
|
---|
| 2501 | MaxIndex_i=get(handles.MaxIndex_i,'Data');
|
---|
| 2502 | MaxIndex_j=get(handles.MaxIndex_j,'Data');
|
---|
| 2503 | set(handles.MinIndex_i,'Data',MinIndex_i(iview,:));
|
---|
| 2504 | set(handles.MinIndex_j,'Data',MinIndex_j(iview,:));
|
---|
| 2505 | set(handles.MaxIndex_i,'Data',MaxIndex_i(iview,:));
|
---|
| 2506 | set(handles.MaxIndex_j,'Data',MaxIndex_j(iview,:));
|
---|
| 2507 | TimeTable=get(handles.TimeTable,'Data');
|
---|
| 2508 | set(handles.TimeTable,'Data',TimeTable(iview,:));
|
---|
| 2509 | PairString=get(handles.PairString,'Data');
|
---|
| 2510 | set(handles.PairString,'Data',PairString(iview,:));
|
---|
| 2511 | end
|
---|
| 2512 |
|
---|
| 2513 | %% Impose the whole input file index range if requested
|
---|
| 2514 | if isfield(ParamOut,'WholeIndexRange')&&isequal(ParamOut.WholeIndexRange,'on')
|
---|
| 2515 | MinIndex_i=get(handles.MinIndex_i,'Data');
|
---|
| 2516 | MinIndex_j=get(handles.MinIndex_j,'Data');
|
---|
| 2517 | MaxIndex_i=get(handles.MaxIndex_i,'Data');
|
---|
| 2518 | MaxIndex_j=get(handles.MaxIndex_j,'Data');
|
---|
| 2519 | set(handles.num_first_i,'String',num2str(MinIndex_i(1)))% set first as the min index (for the first line)
|
---|
| 2520 | set(handles.num_last_i,'String',num2str(MaxIndex_i(1)))% set last as the max index (for the first line)
|
---|
| 2521 | set(handles.num_incr_i,'String','1')
|
---|
| 2522 | set(handles.num_first_j,'String',num2str(MinIndex_j(1)))% set first as the min index (for the first line)
|
---|
| 2523 | set(handles.num_last_j,'String',num2str(MaxIndex_j(1)))% set last as the max index (for the first line)
|
---|
| 2524 | set(handles.num_incr_j,'String','1')
|
---|
| 2525 | else % check index ranges
|
---|
| 2526 | first_i=1;last_i=1;first_j=1;last_j=1;
|
---|
| 2527 | if isfield(Param.IndexRange,'first_i')
|
---|
| 2528 | first_i=Param.IndexRange.first_i;
|
---|
| 2529 | last_i=Param.IndexRange.last_i;
|
---|
| 2530 | end
|
---|
| 2531 | if isfield(Param.IndexRange,'first_j')
|
---|
| 2532 | first_j=Param.IndexRange.first_j;
|
---|
| 2533 | last_j=Param.IndexRange.last_j;
|
---|
| 2534 | end
|
---|
| 2535 | if last_i < first_i || last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),...
|
---|
| 2536 | set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end;
|
---|
| 2537 | end
|
---|
| 2538 |
|
---|
| 2539 | %% enable or desable j index visibility
|
---|
[992] | 2540 | status_j='on'; % default
|
---|
[867] | 2541 | if isempty(find(~cellfun(@isempty,SeriesData.j1_series), 1)); % case of empty j indices
|
---|
| 2542 | status_j='off'; % no j index needed
|
---|
| 2543 | elseif strcmp(get(handles.PairString,'Visible'),'on')
|
---|
[992] | 2544 | check_burst=cellfun(@isempty,regexp(get(handles.PairString,'Data'),'^j')); % =0 for burst case, 1 otherwise
|
---|
[867] | 2545 | if isempty(find(check_burst, 1))% if all pair string begins by j (burst)
|
---|
| 2546 | status_j='off'; % no j index needed for bust case
|
---|
| 2547 | end
|
---|
| 2548 | end
|
---|
| 2549 | enable_j(handles,status_j) % no j index needed
|
---|
[994] | 2550 | if isfield(ParamOut,'j_index_1')&& isfield(ParamOut,'j_index_2')%strcmp(ParamOut.Desable_j_index,'on')
|
---|
| 2551 | %status_j='off';
|
---|
| 2552 | set(handles.num_first_j,'String',num2str(ParamOut.j_index_1))
|
---|
| 2553 | set(handles.num_last_j,'String',num2str(ParamOut.j_index_2))
|
---|
| 2554 | set(handles.num_first_j,'enable','off')
|
---|
| 2555 | set(handles.num_last_j,'enable','off')
|
---|
| 2556 | set(handles.num_incr_j,'visible','off')
|
---|
| 2557 | else
|
---|
| 2558 | set(handles.num_first_j,'enable','on')
|
---|
| 2559 | set(handles.num_last_j,'enable','on')
|
---|
| 2560 | set(handles.num_incr_j,'visible',status_j)
|
---|
| 2561 | end
|
---|
[867] | 2562 |
|
---|
| 2563 | %% NbSlice visibility
|
---|
[897] | 2564 | if isfield(ParamOut,'NbSlice') && (strcmp(ParamOut.NbSlice,'on')||isnumeric(ParamOut.NbSlice))
|
---|
| 2565 | set(handles.num_NbSlice,'Visible','on')
|
---|
| 2566 | set(handles.NbSlice_title,'Visible','on')
|
---|
[867] | 2567 | else
|
---|
[897] | 2568 | set(handles.num_NbSlice,'Visible','off')
|
---|
| 2569 | set(handles.NbSlice_title,'Visible','off')
|
---|
[867] | 2570 | end
|
---|
[997] | 2571 | if isfield(ParamOut,'NbSlice') && isnumeric(ParamOut.NbSlice)
|
---|
[897] | 2572 | set(handles.num_NbSlice,'String',num2str(ParamOut.NbSlice))
|
---|
| 2573 | set(handles.num_NbSlice,'Enable','off'); % NbSlice set by the activation of the Action function
|
---|
| 2574 | else
|
---|
| 2575 | set(handles.num_NbSlice,'Enable','on'); % NbSlice can be modified on the GUI series
|
---|
| 2576 | end
|
---|
[867] | 2577 |
|
---|
| 2578 | %% Visibility of FieldTransform menu
|
---|
| 2579 | FieldTransformVisible='off'; %hidden by default
|
---|
| 2580 | if isfield(ParamOut,'FieldTransform')
|
---|
[1001] | 2581 | if ~strcmp(ParamOut.FieldTransform,'off')
|
---|
| 2582 | FieldTransformVisible='on';
|
---|
| 2583 | end
|
---|
| 2584 | if iscell(ParamOut.FieldTransform)
|
---|
| 2585 | SeriesData.TransformList=ParamOut.FieldTransform;
|
---|
| 2586 | end
|
---|
[867] | 2587 | TransformName_Callback([],[], handles)
|
---|
| 2588 | end
|
---|
| 2589 | set(handles.FieldTransform,'Visible',FieldTransformVisible)
|
---|
[1001] | 2590 | if isfield(ParamOut,'TransformPath');% record the path of transform function requested for compilation
|
---|
| 2591 | set(handles.TransformPath,'UserData',ParamOut.TransformPath)
|
---|
[867] | 2592 | else
|
---|
[1001] | 2593 | set(handles.TransformPath,'UserData',[])
|
---|
[867] | 2594 | end
|
---|
| 2595 |
|
---|
| 2596 | %% Visibility of projection object
|
---|
| 2597 | ProjObjectVisible='off'; %hidden by default
|
---|
| 2598 | if isfield(ParamOut,'ProjObject')
|
---|
| 2599 | ProjObjectVisible=ParamOut.ProjObject;
|
---|
| 2600 | end
|
---|
| 2601 | set(handles.CheckObject,'Visible',ProjObjectVisible)
|
---|
| 2602 | if ~get(handles.CheckObject,'Value')
|
---|
| 2603 | ProjObjectVisible='off';
|
---|
| 2604 | end
|
---|
| 2605 | set(handles.ProjObject,'Visible',ProjObjectVisible)
|
---|
| 2606 | set(handles.DeleteObject,'Visible',ProjObjectVisible)
|
---|
| 2607 | set(handles.ViewObject,'Visible',ProjObjectVisible)
|
---|
| 2608 | set(handles.EditObject,'Visible',ProjObjectVisible)
|
---|
| 2609 |
|
---|
| 2610 | %% Visibility of mask input
|
---|
| 2611 | MaskVisible='off'; %hidden by default
|
---|
| 2612 | if isfield(ParamOut,'Mask')
|
---|
| 2613 | MaskVisible=ParamOut.Mask;
|
---|
| 2614 | end
|
---|
| 2615 | set(handles.CheckMask,'Visible',MaskVisible);
|
---|
| 2616 |
|
---|
| 2617 | %% definition of the directory containing the output files
|
---|
| 2618 | if ~(isfield(SeriesData,'ActionName') && strcmp(ActionName,SeriesData.ActionName))
|
---|
[992] | 2619 | OutputDirExt='.series'; % default
|
---|
[867] | 2620 | if isfield(ParamOut,'OutputDirExt')&&~isempty(ParamOut.OutputDirExt)
|
---|
| 2621 | OutputDirExt=ParamOut.OutputDirExt;
|
---|
| 2622 | end
|
---|
| 2623 | set(handles.OutputDirExt,'String',OutputDirExt)
|
---|
| 2624 | end
|
---|
| 2625 | OutputDirVisible='off';
|
---|
[992] | 2626 | OutputSubDirMode='auto'; % default
|
---|
[867] | 2627 | SubDirOut='';
|
---|
| 2628 | if isfield(ParamOut,'OutputSubDirMode')
|
---|
| 2629 | OutputSubDirMode=ParamOut.OutputSubDirMode;
|
---|
| 2630 | end
|
---|
[996] | 2631 | InputTable=get(handles.InputTable,'Data');
|
---|
[867] | 2632 | switch OutputSubDirMode
|
---|
[992] | 2633 | case 'auto'; % default
|
---|
[867] | 2634 | OutputDirVisible='on';
|
---|
[992] | 2635 | SubDir=InputTable(1:end,2); % set of subdirectories
|
---|
[867] | 2636 | SubDirOut=SubDir{1};
|
---|
| 2637 | if numel(SubDir)>1
|
---|
| 2638 | for ilist=2:numel(SubDir)
|
---|
| 2639 | SubDirOut=[SubDirOut '-' regexprep(SubDir{ilist},'^/','')];
|
---|
| 2640 | end
|
---|
| 2641 | end
|
---|
| 2642 | case 'one'
|
---|
| 2643 | OutputDirVisible='on';
|
---|
[992] | 2644 | SubDirOut=InputTable{1,2}; % use the first subdir name (+OutputDirExt) as output subdirectory
|
---|
[867] | 2645 | case 'two'
|
---|
| 2646 | OutputDirVisible='on';
|
---|
[992] | 2647 | SubDir=InputTable(1:2,2); % set of subdirectories
|
---|
[867] | 2648 | SubDirOut=SubDir{1};
|
---|
| 2649 | if numel(SubDir)>1
|
---|
| 2650 | SubDirOut=[SubDirOut '-' regexprep(SubDir{2},'^/','')];
|
---|
| 2651 | end
|
---|
| 2652 | case 'last'
|
---|
| 2653 | OutputDirVisible='on';
|
---|
[992] | 2654 | SubDirOut=InputTable{end,2}; % use the last subdir name (+OutputDirExt) as output subdirectory
|
---|
[867] | 2655 | end
|
---|
| 2656 | set(handles.OutputSubDir,'String',SubDirOut)
|
---|
[883] | 2657 | set(handles.OutputSubDir,'BackgroundColor',[1 1 1])% set edit box to white color to indicate refreshment
|
---|
[867] | 2658 | set(handles.OutputDirExt,'Visible',OutputDirVisible)
|
---|
| 2659 | set(handles.OutputSubDir,'Visible',OutputDirVisible)
|
---|
[904] | 2660 | %set(handles.CheckOverwrite,'Visible',OutputDirVisible)
|
---|
[867] | 2661 | set(handles.OutputDir_title,'Visible',OutputDirVisible)
|
---|
[992] | 2662 | SeriesData.ActionName=ActionName; % record ActionName for next use
|
---|
[867] | 2663 |
|
---|
| 2664 |
|
---|
| 2665 | %% visibility of the run mode (local or background or cluster)
|
---|
| 2666 | if strcmp(OutputSubDirMode,'none')
|
---|
[992] | 2667 | RunModeVisible='off'; % only local mode available if no output file is produced
|
---|
[867] | 2668 | else
|
---|
| 2669 | RunModeVisible='on';
|
---|
| 2670 | end
|
---|
| 2671 | set(handles.RunMode,'Visible',RunModeVisible)
|
---|
| 2672 | set(handles.ActionExt,'Visible',RunModeVisible)
|
---|
| 2673 | set(handles.RunMode_title,'Visible',RunModeVisible)
|
---|
| 2674 | set(handles.ActionExt_title,'Visible',RunModeVisible)
|
---|
| 2675 |
|
---|
| 2676 |
|
---|
| 2677 | %% Expected nbre of output files
|
---|
| 2678 | if isfield(ParamOut,'OutputFileMode')
|
---|
| 2679 | StatusData.OutputFileMode=ParamOut.OutputFileMode;
|
---|
| 2680 | set(handles.status,'UserData',StatusData)
|
---|
| 2681 | end
|
---|
| 2682 |
|
---|
| 2683 | %% definition of an additional parameter set, determined by an ancillary GUI
|
---|
| 2684 | if isfield(ParamOut,'ActionInput')
|
---|
[996] | 2685 | % set(handles.ActionInput,'Visible','on')
|
---|
[867] | 2686 | ParamOut.ActionInput.Program=ActionName; % record the program in ActionInput
|
---|
| 2687 | SeriesData.ActionInput=ParamOut.ActionInput;
|
---|
| 2688 | else
|
---|
[996] | 2689 | % set(handles.ActionInput,'Visible','off')
|
---|
[867] | 2690 | if isfield(SeriesData,'ActionInput')
|
---|
| 2691 | SeriesData=rmfield(SeriesData,'ActionInput');
|
---|
| 2692 | end
|
---|
| 2693 | end
|
---|
| 2694 | set(handles.series,'UserData',SeriesData)
|
---|
[996] | 2695 | set(handles.ActionInput,'BackgroundColor',[1 0 0])
|
---|
[867] | 2696 |
|
---|
| 2697 | %------------------------------------------------------------------------
|
---|
| 2698 | % --- Executes on selection change in FieldName.
|
---|
| 2699 | function FieldName_Callback(hObject, eventdata, handles)
|
---|
| 2700 | %------------------------------------------------------------------------
|
---|
| 2701 | field_str=get(handles.FieldName,'String');
|
---|
| 2702 | field_index=get(handles.FieldName,'Value');
|
---|
| 2703 | field=field_str{field_index(1)};
|
---|
| 2704 | if isequal(field,'get_field...')
|
---|
| 2705 | SeriesData=get(handles.series,'UserData');
|
---|
| 2706 | % input line for which the field choice is relevant
|
---|
[992] | 2707 | iview=find(ismember(SeriesData.FileType,{'netcdf','civx','civdata'})); % all nc files, icluding civ
|
---|
[867] | 2708 | hget_field=findobj(allchild(0),'name','get_field');
|
---|
| 2709 | if ~isempty(hget_field)
|
---|
| 2710 | delete(hget_field)%delete opened versions of get_field
|
---|
| 2711 | end
|
---|
| 2712 | Param=read_GUI(handles.series);
|
---|
| 2713 | InputTable=Param.InputTable(iview,:);
|
---|
| 2714 | % check the existence of the first file in the series
|
---|
[992] | 2715 | first_j=[];last_j=[];MinIndex_j=1;MaxIndex_j=1; % default setting for index j
|
---|
| 2716 | if isfield(Param.IndexRange,'first_j'); % if index j is used
|
---|
[867] | 2717 | first_j=Param.IndexRange.first_j;
|
---|
| 2718 | last_j=Param.IndexRange.last_j;
|
---|
| 2719 | MinIndex_j=Param.IndexRange.MinIndex_j(iview);
|
---|
| 2720 | MaxIndex_j=Param.IndexRange.MaxIndex_j(iview);
|
---|
| 2721 | end
|
---|
| 2722 | PairString='';
|
---|
| 2723 | if isfield(Param.IndexRange,'PairString'); PairString=Param.IndexRange.PairString{iview}; end
|
---|
| 2724 | [i1,i2,j1,j2] = get_file_index(Param.IndexRange.first_i,first_j,PairString);
|
---|
| 2725 | LineIndex=iview(1);
|
---|
| 2726 | if numel(iview)>1
|
---|
| 2727 | answer=msgbox_uvmat('INPUT_TXT',['select the line of the input table:' num2str(iview)] ,num2str(iview(1)));
|
---|
| 2728 | LineIndex=str2num(answer);
|
---|
| 2729 | % InputLine=str2num(get(handles.InputLine,'String'));
|
---|
| 2730 | % if ismember(InputLine,iview)
|
---|
| 2731 | % LineIndex=InputLine;
|
---|
| 2732 | % end
|
---|
| 2733 | end
|
---|
| 2734 | FirstFileName=fullfile_uvmat(InputTable{LineIndex,1},InputTable{LineIndex,2},InputTable{LineIndex,3},...
|
---|
| 2735 | InputTable{LineIndex,5},InputTable{LineIndex,4},i1,i2,j1,j2);
|
---|
| 2736 | if exist(FirstFileName,'file')
|
---|
| 2737 | ParamIn.Title='get_field: pick input variables and coordinates for series processing';
|
---|
| 2738 | ParamIn.SeriesInput=1;
|
---|
| 2739 | GetFieldData=get_field(FirstFileName,ParamIn);
|
---|
| 2740 | FieldList={};
|
---|
[876] | 2741 | if isfield(GetFieldData,'FieldOption')% if a field has been selected
|
---|
[867] | 2742 | switch GetFieldData.FieldOption
|
---|
| 2743 | case 'vectors'
|
---|
| 2744 | UName=GetFieldData.PanelVectors.vector_x;
|
---|
| 2745 | VName=GetFieldData.PanelVectors.vector_y;
|
---|
| 2746 | YName={GetFieldData.Coordinates.Coord_y};
|
---|
| 2747 | FieldList={['vec(' UName ',' VName ')'];...
|
---|
| 2748 | ['norm(' UName ',' VName ')'];...
|
---|
| 2749 | UName;VName};
|
---|
| 2750 | case {'scalar'}
|
---|
| 2751 | FieldList=GetFieldData.PanelScalar.scalar;
|
---|
| 2752 | YName={GetFieldData.Coordinates.Coord_y};
|
---|
| 2753 | if ischar(FieldList)
|
---|
| 2754 | FieldList={FieldList};
|
---|
| 2755 | end
|
---|
| 2756 | case 'civdata...'
|
---|
| 2757 | FieldList=[set_field_list('U','V') ;{'C'}];
|
---|
| 2758 | set(handles.FieldName,'Value',1) % set menu to 'velocity
|
---|
| 2759 | XName='X';
|
---|
| 2760 | YName='y';
|
---|
| 2761 | end
|
---|
| 2762 | set(handles.FieldName,'Value',1)
|
---|
| 2763 | set(handles.FieldName,'String',[FieldList; {'get_field...'}]);
|
---|
| 2764 | if ~strcmp(GetFieldData.FieldOption,'civdata...')
|
---|
| 2765 | if ~isempty(regexp(FieldList{1},'^vec'))
|
---|
| 2766 | set(handles.FieldName,'Value',1)
|
---|
| 2767 | else
|
---|
| 2768 | set(handles.FieldName,'Value',1:numel(FieldList))%select all input fields by default
|
---|
| 2769 | end
|
---|
| 2770 | XName=GetFieldData.Coordinates.Coord_x;
|
---|
| 2771 | YName=GetFieldData.Coordinates.Coord_y;
|
---|
| 2772 | TimeNameStr=GetFieldData.Time.SwitchVarIndexTime;
|
---|
| 2773 | % get the time info
|
---|
| 2774 | TimeTable=get(handles.TimeTable,'Data');
|
---|
| 2775 | switch TimeNameStr
|
---|
| 2776 | case 'file index'
|
---|
| 2777 | TimeName='';
|
---|
| 2778 | case 'attribute'
|
---|
| 2779 | TimeName=['att:' GetFieldData.Time.TimeName];
|
---|
| 2780 | % update the time table
|
---|
| 2781 | TimeTable{LineIndex,2}=get_time(Param.IndexRange.MinIndex_i(LineIndex),MinIndex_j,PairString,InputTable,SeriesData.FileInfo{LineIndex},GetFieldData.Time.TimeName); % Min time
|
---|
| 2782 | TimeTable{LineIndex,3}=get_time(Param.IndexRange.first_i,first_j,PairString,InputTable,SeriesData.FileInfo{LineIndex},GetFieldData.Time.TimeName); % first time
|
---|
| 2783 | TimeTable{LineIndex,4}=get_time(Param.IndexRange.last_i,last_j,PairString,InputTable,SeriesData.FileInfo{LineIndex},GetFieldData.Time.TimeName); % last time
|
---|
| 2784 | TimeTable{LineIndex,5}=get_time(Param.IndexRange.MaxIndex_i(LineIndex),MaxIndex_j,PairString,InputTable,SeriesData.FileInfo{LineIndex},GetFieldData.Time.TimeName); % Max time
|
---|
| 2785 | case 'variable'
|
---|
| 2786 | set(handles.TimeName,'String',['var:' GetFieldData.Time.TimeName])
|
---|
| 2787 | set(handles.NomType,'String','*')
|
---|
| 2788 | set(handles.RootFile,'String',[get(handles.RootFile,'String') get(handles.FileIndex,'String')])% A VERIFIER !!!!!!
|
---|
| 2789 | set(handles.FileIndex,'String','')
|
---|
| 2790 | ParamIn.TimeVarName=GetFieldData.Time.TimeName;
|
---|
| 2791 | case 'matrix_index'
|
---|
| 2792 | TimeName=['dim:' GetFieldData.Time.TimeName];
|
---|
| 2793 | set(handles.NomType,'String','*')
|
---|
| 2794 | set(handles.RootFile,'String',[get(handles.RootFile,'String') get(handles.FileIndex,'String')])
|
---|
| 2795 | set(handles.FileIndex,'String','')
|
---|
| 2796 | ParamIn.TimeDimName=GetFieldData.Time.TimeName;
|
---|
| 2797 | end
|
---|
| 2798 | TimeTable{LineIndex,1}=TimeName;
|
---|
| 2799 | set(handles.TimeTable,'Data',TimeTable);
|
---|
| 2800 | end
|
---|
| 2801 | set(handles.Coord_x,'String',XName)
|
---|
| 2802 | set(handles.Coord_y,'String',YName)
|
---|
| 2803 | set(handles.Coord_x,'Visible','on')
|
---|
| 2804 | set(handles.Coord_y,'Visible','on')
|
---|
[876] | 2805 | end
|
---|
[867] | 2806 | else
|
---|
| 2807 | msgbox_uvmat('ERROR',[FirstFileName ' does not exist'])
|
---|
| 2808 | end
|
---|
| 2809 | end
|
---|
| 2810 |
|
---|
[972] | 2811 |
|
---|
[867] | 2812 | function [TimeValue,DtValue]=get_time(ref_i,ref_j,PairString,InputTable,FileInfo,TimeName,DtName)
|
---|
| 2813 | [i1,i2,j1,j2] = get_file_index(ref_i,ref_j,PairString);
|
---|
| 2814 | FileName=fullfile_uvmat(InputTable{1},InputTable{2},InputTable{3},InputTable{5},InputTable{4},i1,i2,j1,j2);
|
---|
| 2815 | Data=nc2struct(FileName,[]);
|
---|
| 2816 | TimeValue=[];
|
---|
| 2817 | DtValue=[];
|
---|
| 2818 | if isequal(FileInfo.FileType,'civdata')
|
---|
| 2819 | if ismember(TimeName,{'civ1','filter1'})
|
---|
[970] | 2820 | if isfield(Data,'Civ1_Time')
|
---|
[867] | 2821 | TimeValue=Data.Civ1_Time;
|
---|
[970] | 2822 | end
|
---|
| 2823 | if isfield(Data,'Civ1_Dt')
|
---|
[867] | 2824 | DtValue=Data.Civ1_Dt;
|
---|
[970] | 2825 | end
|
---|
[867] | 2826 | else
|
---|
[970] | 2827 | if isfield(Data,'Civ2_Time')
|
---|
[867] | 2828 | TimeValue=Data.Civ2_Time;
|
---|
[970] | 2829 | end
|
---|
| 2830 | if isfield(Data,'Civ2_Dt')
|
---|
[867] | 2831 | DtValue=Data.Civ2_Dt;
|
---|
[970] | 2832 | end
|
---|
[867] | 2833 | end
|
---|
| 2834 | else
|
---|
| 2835 | if ~isempty(TimeName)&& isfield(Data,TimeName)
|
---|
| 2836 | TimeValue=Data.(TimeName);
|
---|
| 2837 | end
|
---|
| 2838 | if exist('DtName','var') && isfield(Data,DtName)
|
---|
| 2839 | DtValue=Data.(DtName);
|
---|
| 2840 | end
|
---|
| 2841 | end
|
---|
| 2842 |
|
---|
| 2843 | %------------------------------------------------------------------------
|
---|
| 2844 | % --- Executes on selection change in FieldName_1.
|
---|
| 2845 | function FieldName_1_Callback(hObject, eventdata, handles)
|
---|
| 2846 | %------------------------------------------------------------------------
|
---|
| 2847 | field_str=get(handles.FieldName_1,'String');
|
---|
| 2848 | field_index=get(handles.FieldName_1,'Value');
|
---|
| 2849 | field=field_str{field_index(1)};
|
---|
| 2850 | if isequal(field,'get_field...')
|
---|
| 2851 | hget_field=findobj(allchild(0),'name','get_field');
|
---|
| 2852 | if ~isempty(hget_field)
|
---|
| 2853 | delete(hget_field)%delete opened versions of get_field
|
---|
| 2854 | end
|
---|
| 2855 | Param=read_GUI(handles.series);
|
---|
| 2856 | Param.InputTable=Param.InputTable(1,:);
|
---|
| 2857 | % check the existence of the first file in the series
|
---|
| 2858 | first_j=[];
|
---|
| 2859 | if isfield(Param.IndexRange,'first_j'); first_j=Param.IndexRange.first_j; end
|
---|
| 2860 | if isfield(Param.IndexRange,'last_j'); last_j=Param.IndexRange.last_j; end
|
---|
| 2861 | PairString='';
|
---|
| 2862 | if isfield(Param.IndexRange,'PairString'); PairString=Param.IndexRange.PairString; end
|
---|
| 2863 | [i1,i2,j1,j2] = get_file_index(Param.IndexRange.first_i,first_j,PairString);
|
---|
| 2864 | FirstFileName=fullfile_uvmat(Param.InputTable{1,1},Param.InputTable{1,2},Param.InputTable{1,3},...
|
---|
| 2865 | Param.InputTable{1,5},Param.InputTable{1,4},i1,i2,j1,j2);
|
---|
| 2866 | if exist(FirstFileName,'file')
|
---|
| 2867 | ParamIn.SeriesInput=1;
|
---|
| 2868 | GetFieldData=get_field(FirstFileName,ParamIn);
|
---|
| 2869 | FieldList={};
|
---|
| 2870 | switch GetFieldData.FieldOption
|
---|
| 2871 | case 'vectors'
|
---|
| 2872 | UName=GetFieldData.PanelVectors.vector_x;
|
---|
| 2873 | VName=GetFieldData.PanelVectors.vector_y;
|
---|
| 2874 | FieldList={['vec(' UName ',' VName ')'];...
|
---|
| 2875 | ['norm(' UName ',' VName ')'];...
|
---|
| 2876 | UName;VName};
|
---|
| 2877 | case {'scalar','pick variables'}
|
---|
| 2878 | FieldList=GetFieldData.PanelScalar.scalar;
|
---|
| 2879 | if ischar(FieldList)
|
---|
| 2880 | FieldList={FieldList};
|
---|
| 2881 | end
|
---|
| 2882 | case '1D plot'
|
---|
| 2883 |
|
---|
| 2884 | case 'civdata...'
|
---|
| 2885 | FieldList=set_field_list('U','V','C');
|
---|
| 2886 | set(handles.FieldName,'Value',2) % set menu to 'velocity
|
---|
| 2887 | end
|
---|
| 2888 | if ~strcmp(GetFieldData.FieldOption,'civdata...')
|
---|
| 2889 | TimeNameStr=GetFieldData.Time.SwitchVarIndexTime;
|
---|
| 2890 | switch TimeNameStr
|
---|
| 2891 | case 'file index'
|
---|
| 2892 | set(handles.TimeName,'String','');
|
---|
| 2893 | case 'attribute'
|
---|
| 2894 | set(handles.TimeName,'String',['att:' GetFieldData.Time.TimeName]);
|
---|
| 2895 | case 'variable'
|
---|
| 2896 | set(handles.TimeName,'String',['var:' GetFieldData.Time.TimeName])
|
---|
| 2897 | set(handles.NomType,'String','*')
|
---|
| 2898 | set(handles.RootFile,'String',[get(handles.RootFile,'String') get(handles.FileIndex,'String')])% A VERIFIER !!!!!!
|
---|
| 2899 | set(handles.FileIndex,'String','')
|
---|
| 2900 | ParamIn.TimeVarName=GetFieldData.Time.TimeName;
|
---|
| 2901 | case 'matrix_index'
|
---|
| 2902 | set(handles.TimeName,'String',['dim:' GetFieldData.Time.TimeName]);
|
---|
| 2903 | set(handles.NomType,'String','*')
|
---|
| 2904 | set(handles.RootFile,'String',[get(handles.RootFile,'String') get(handles.FileIndex,'String')])
|
---|
| 2905 | set(handles.FileIndex,'String','')
|
---|
| 2906 | ParamIn.TimeDimName=GetFieldData.Time.TimeName;
|
---|
| 2907 | end
|
---|
| 2908 | end
|
---|
| 2909 | set(handles.FieldName_1,'Value',1)
|
---|
| 2910 | set(handles.FieldName_1,'String',[FieldList; {'get_field...'}]);
|
---|
| 2911 | end
|
---|
| 2912 | end
|
---|
| 2913 |
|
---|
| 2914 |
|
---|
| 2915 | %%%%%%%%%%%%%
|
---|
| 2916 | function [ind_remove]=find_pairs(dirpair,ind_i,last_i)
|
---|
| 2917 | indsel=ind_i;
|
---|
[992] | 2918 | indiff=diff(ind_i); % test index increment to detect multiplets (several pairs with the same index ind_i) and holes in the series
|
---|
| 2919 | indiff=[1 indiff last_i-ind_i(end)+1]; % for testing gaps with the imposed bounds
|
---|
[867] | 2920 | if ~isempty(indiff)
|
---|
| 2921 | indiff2=diff(indiff);
|
---|
| 2922 | indiffp=[indiff2 1];
|
---|
| 2923 | indiffm=[1 indiff2];
|
---|
[992] | 2924 | ind_multi_m=find((indiff==0)&(indiffm<0))-1; % indices of first members of multiplets
|
---|
| 2925 | ind_multi_p=find((indiff==0)&(indiffp>0)); % indices of last members of multiplets
|
---|
[867] | 2926 | %for each multiplet, select the most recent file
|
---|
| 2927 | ind_remove=[];
|
---|
| 2928 | for i=1:length(ind_multi_m)
|
---|
| 2929 | ind_pairs=ind_multi_m(i):ind_multi_p(i);
|
---|
| 2930 | for imulti=1:length(ind_pairs)
|
---|
[992] | 2931 | datepair(imulti)=datenum(dirpair(ind_pairs(imulti)).date); % dates of creation
|
---|
[867] | 2932 | end
|
---|
[992] | 2933 | [datenew,indsort2]=sort(datepair); % sort the multiplet by creation date
|
---|
| 2934 | ind_s=indsort2(1:end-1); %
|
---|
| 2935 | ind_remove=[ind_remove ind_pairs(ind_s)]; % remove these indices, leave the last one
|
---|
[867] | 2936 | end
|
---|
| 2937 | end
|
---|
| 2938 |
|
---|
| 2939 | %------------------------------------------------------------------------
|
---|
| 2940 | % --- determine the list of index pairstring of processing file
|
---|
| 2941 | function [num_i1,num_i2,num_j1,num_j2,num_i_out,num_j_out]=find_file_indices(num_i,num_j,ind_shift,NomType,mode)
|
---|
| 2942 | %------------------------------------------------------------------------
|
---|
[992] | 2943 | num_i1=num_i; % set of first image numbers by default
|
---|
[867] | 2944 | num_i2=num_i;
|
---|
| 2945 | num_j1=num_j;
|
---|
| 2946 | num_j2=num_j;
|
---|
| 2947 | num_i_out=num_i;
|
---|
| 2948 | num_j_out=num_j;
|
---|
| 2949 | % if isequal (NomType,'_1-2_1') || isequal (NomType,'_1-2')
|
---|
| 2950 | if isequal(mode,'series(Di)')
|
---|
[992] | 2951 | num_i1_line=num_i+ind_shift(3); % set of first image numbers
|
---|
[867] | 2952 | num_i2_line=num_i+ind_shift(4);
|
---|
| 2953 | % adjust the first and last field number
|
---|
| 2954 | indsel=find(num_i1_line >= 1);
|
---|
| 2955 | num_i_out=num_i(indsel);
|
---|
| 2956 | num_i1_line=num_i1_line(indsel);
|
---|
| 2957 | num_i2_line=num_i2_line(indsel);
|
---|
| 2958 | num_j1=meshgrid(num_j,ones(size(num_i1_line)));
|
---|
| 2959 | num_j2=meshgrid(num_j,ones(size(num_i1_line)));
|
---|
| 2960 | [xx,num_i1]=meshgrid(num_j,num_i1_line);
|
---|
| 2961 | [xx,num_i2]=meshgrid(num_j,num_i2_line);
|
---|
| 2962 | elseif isequal (mode,'series(Dj)')||isequal (mode,'bursts')
|
---|
| 2963 | if isequal(mode,'bursts') %case of bursts (png_old or png_2D)
|
---|
| 2964 | num_j1=ind_shift(1)*ones(size(num_i));
|
---|
| 2965 | num_j2=ind_shift(2)*ones(size(num_i));
|
---|
| 2966 | else
|
---|
[992] | 2967 | num_j1_col=num_j+ind_shift(1); % set of first image numbers
|
---|
[867] | 2968 | num_j2_col=num_j+ind_shift(2);
|
---|
| 2969 | % adjust the first field number
|
---|
| 2970 | indsel=find((num_j1_col >= 1));
|
---|
| 2971 | num_j_out=num_j(indsel);
|
---|
| 2972 | num_j1_col=num_j1_col(indsel);
|
---|
| 2973 | num_j2_col=num_j2_col(indsel);
|
---|
| 2974 | [num_i1,num_j1]=meshgrid(num_i,num_j1_col);
|
---|
| 2975 | [num_i2,num_j2]=meshgrid(num_i,num_j2_col);
|
---|
| 2976 | end
|
---|
| 2977 | end
|
---|
| 2978 |
|
---|
| 2979 | %------------------------------------------------------------------------
|
---|
| 2980 | % --- Executes on button press in CheckObject.
|
---|
| 2981 | function CheckObject_Callback(hObject, eventdata, handles)
|
---|
| 2982 | %------------------------------------------------------------------------
|
---|
[992] | 2983 | hset_object=findobj(allchild(0),'tag','set_object'); % find the set_object interface handle
|
---|
[867] | 2984 | if get(handles.CheckObject,'Value')
|
---|
| 2985 | SeriesData=get(handles.series,'UserData');
|
---|
| 2986 | if isfield(SeriesData,'ProjObject') && ~isempty(SeriesData.ProjObject)
|
---|
| 2987 | set(handles.ViewObject,'Value',1)
|
---|
| 2988 | ViewObject_Callback(hObject, eventdata, handles)
|
---|
| 2989 | else
|
---|
| 2990 | if ishandle(hset_object)
|
---|
| 2991 | uistack(hset_object,'top')% show the GUI set_object if opened
|
---|
| 2992 | else
|
---|
| 2993 | %get the object file
|
---|
| 2994 | InputTable=get(handles.InputTable,'Data');
|
---|
| 2995 | defaultname=InputTable{1,1};
|
---|
| 2996 | if isempty(defaultname)
|
---|
| 2997 | defaultname={''};
|
---|
| 2998 | end
|
---|
| 2999 | fileinput=uigetfile_uvmat('pick a xml object file (or use uvmat to create it)',defaultname,'.xml');
|
---|
| 3000 | if isempty(fileinput)% exit if no object file is selected
|
---|
| 3001 | set(handles.CheckObject,'Value',0)
|
---|
| 3002 | return
|
---|
| 3003 | end
|
---|
| 3004 | %read the file
|
---|
| 3005 | data=xml2struct(fileinput);
|
---|
| 3006 | if ~isfield(data,'Type')
|
---|
| 3007 | msgbox_uvmat('ERROR',[fileinput ' is not an object xml file'])
|
---|
| 3008 | set(handles.CheckObject,'Value',0)
|
---|
| 3009 | return
|
---|
| 3010 | end
|
---|
| 3011 | if ~isfield(data,'ProjMode')
|
---|
| 3012 | data.ProjMode='none';
|
---|
| 3013 | end
|
---|
[992] | 3014 | hset_object=set_object(data); % call the set_object interface
|
---|
[867] | 3015 | set(hset_object,'Name','set_object_series')% name to distinguish from set_object used with uvmat
|
---|
| 3016 | end
|
---|
| 3017 | ProjObject=read_GUI(hset_object);
|
---|
[992] | 3018 | set(handles.ProjObject,'String',ProjObject.Name); % display the object name
|
---|
[867] | 3019 | SeriesData=get(handles.series,'UserData');
|
---|
| 3020 | SeriesData.ProjObject=ProjObject;
|
---|
| 3021 | set(handles.series,'UserData',SeriesData);
|
---|
| 3022 | end
|
---|
| 3023 | set(handles.EditObject,'Visible','on');
|
---|
| 3024 | set(handles.DeleteObject,'Visible','on');
|
---|
| 3025 | set(handles.ViewObject,'Visible','on');
|
---|
| 3026 | set(handles.ProjObject,'Visible','on');
|
---|
| 3027 | else
|
---|
| 3028 | set(handles.EditObject,'Visible','off');
|
---|
| 3029 | set(handles.DeleteObject,'Visible','off');
|
---|
| 3030 | set(handles.ViewObject,'Visible','off');
|
---|
| 3031 | if ~ishandle(hset_object)
|
---|
| 3032 | set(handles.ViewObject,'Value',0);
|
---|
| 3033 | end
|
---|
| 3034 | set(handles.ProjObject,'Visible','off');
|
---|
| 3035 | end
|
---|
| 3036 |
|
---|
| 3037 | %------------------------------------------------------------------------
|
---|
| 3038 | % --- Executes on button press in ViewObject.
|
---|
| 3039 | %------------------------------------------------------------------------
|
---|
| 3040 | function ViewObject_Callback(hObject, eventdata, handles)
|
---|
| 3041 |
|
---|
| 3042 | UserData=get(handles.series,'UserData');
|
---|
| 3043 | hset_object=findobj(allchild(0),'Tag','set_object');
|
---|
| 3044 | if ~isempty(hset_object)
|
---|
| 3045 | delete(hset_object)% refresh set_object if already opened
|
---|
| 3046 | end
|
---|
| 3047 | hset_object=set_object(UserData.ProjObject);
|
---|
| 3048 | set(hset_object,'Name','view_object_series')
|
---|
| 3049 |
|
---|
| 3050 |
|
---|
| 3051 | %------------------------------------------------------------------------
|
---|
| 3052 | % --- Executes on button press in EditObject.
|
---|
| 3053 | function EditObject_Callback(hObject, eventdata, handles)
|
---|
| 3054 | %------------------------------------------------------------------------
|
---|
| 3055 | if get(handles.EditObject,'Value')
|
---|
| 3056 | set(handles.ViewObject,'Value',0)
|
---|
[998] | 3057 | UserData=get(handles.series,'UserData');
|
---|
[867] | 3058 | hset_object=set_object(UserData.ProjObject);
|
---|
| 3059 | set(hset_object,'Name','edit_object_series')
|
---|
| 3060 | set(get(hset_object,'Children'),'Enable','on')
|
---|
| 3061 | else
|
---|
| 3062 | hset_object=findobj(allchild(0),'Tag','set_object');
|
---|
| 3063 | if ~isempty(hset_object)
|
---|
| 3064 | set(get(hset_object,'Children'),'Enable','off')
|
---|
| 3065 | end
|
---|
| 3066 | end
|
---|
| 3067 |
|
---|
| 3068 | %------------------------------------------------------------------------
|
---|
| 3069 | % --- Executes on button press in DeleteObject.
|
---|
| 3070 | function DeleteObject_Callback(hObject, eventdata, handles)
|
---|
| 3071 | %------------------------------------------------------------------------
|
---|
| 3072 | SeriesData=get(handles.series,'UserData');
|
---|
| 3073 | SeriesData.ProjObject=[];
|
---|
| 3074 | set(handles.series,'UserData',SeriesData)
|
---|
| 3075 | set(handles.ProjObject,'String','')
|
---|
| 3076 | set(handles.ProjObject,'Visible','off')
|
---|
| 3077 | set(handles.CheckObject,'Value',0)
|
---|
| 3078 | set(handles.ViewObject,'Visible','off')
|
---|
| 3079 | set(handles.EditObject,'Visible','off')
|
---|
| 3080 | hset_object=findobj(allchild(0),'name','set_object_series');
|
---|
| 3081 | if ~isempty(hset_object)
|
---|
| 3082 | delete(hset_object)
|
---|
| 3083 | end
|
---|
| 3084 | set(handles.DeleteObject,'Visible','off')
|
---|
| 3085 |
|
---|
| 3086 | %------------------------------------------------------------------------
|
---|
| 3087 | % --- Executed when CheckMask is activated
|
---|
| 3088 | %------------------------------------------------------------------------
|
---|
| 3089 | function CheckMask_Callback(hObject, eventdata, handles)
|
---|
| 3090 |
|
---|
| 3091 | if get(handles.CheckMask,'Value')
|
---|
| 3092 | InputTable=get(handles.InputTable,'Data');
|
---|
| 3093 | nbview=size(InputTable,1);
|
---|
[992] | 3094 | MaskTable=cell(nbview,1); % default
|
---|
| 3095 | ListMask=cell(nbview,1); % default
|
---|
[867] | 3096 | MaskData=get(handles.MaskTable,'Data');
|
---|
[992] | 3097 | MaskData(size(MaskData,1):nbview,1)=cell(size(MaskData,1):nbview,1); % complement if undefined lines
|
---|
[867] | 3098 | for iview=1:nbview
|
---|
| 3099 | ListMask{iview,1}=num2str(iview);
|
---|
| 3100 | RootPath=InputTable{iview,1};
|
---|
| 3101 | if ~isempty(RootPath)
|
---|
| 3102 | if isempty(MaskData{iview})
|
---|
| 3103 | SubDir=InputTable{iview,2};
|
---|
[992] | 3104 | MaskPath=fullfile(RootPath,[regexprep(SubDir,'\..*','') '.mask']); % take the root part of SubDir, before the first dot '.'
|
---|
[867] | 3105 | if exist(MaskPath,'dir')
|
---|
[992] | 3106 | ListStruct=dir(MaskPath); % look for a mask file
|
---|
| 3107 | ListCells=struct2cell(ListStruct); % transform dir struct to a cell arrray
|
---|
| 3108 | check_dir=cell2mat(ListCells(4,:)); % =1 for directories, =0 for files
|
---|
| 3109 | ListFiles=ListCells(1,:); % list of file and dri names
|
---|
| 3110 | ListFiles=ListFiles(~check_dir); % list of file names (excluding dir)
|
---|
[867] | 3111 | mdetect=0;
|
---|
| 3112 | if ~isempty(ListFiles)
|
---|
| 3113 | for ifile=1:numel(ListFiles)
|
---|
| 3114 | [tild,tild,MaskFile{ifile},i1_series,i2_series,j1_series,j2_series,MaskNomType,MaskFileType]=find_file_series(MaskPath,ListFiles{ifile},0);
|
---|
| 3115 | if strcmp(MaskFileType,'image') && isempty(i2_series) && isempty(j2_series)
|
---|
| 3116 | mdetect=1;
|
---|
| 3117 | MaskName=ListFiles{ifile};
|
---|
| 3118 | end
|
---|
| 3119 | if ~strcmp(MaskFile{ifile},MaskFile{1})
|
---|
[992] | 3120 | mdetect=0; % cancel detection test in case of multiple masks, use the brower for selection
|
---|
[867] | 3121 | break
|
---|
| 3122 | end
|
---|
| 3123 | end
|
---|
| 3124 | end
|
---|
| 3125 | if mdetect==1
|
---|
| 3126 | MaskName=fullfile(MaskPath,'mask_1.png');
|
---|
| 3127 | else
|
---|
| 3128 | MaskName=uigetfile_uvmat('select a mask file:',MaskPath,'image');
|
---|
| 3129 | end
|
---|
| 3130 | else
|
---|
| 3131 | MaskName=uigetfile_uvmat('select a mask file:',RootPath,'image');
|
---|
| 3132 | end
|
---|
| 3133 | MaskTable{iview,1}=MaskName ;
|
---|
| 3134 | ListMask{iview,1}=num2str(iview);
|
---|
| 3135 | end
|
---|
| 3136 | end
|
---|
| 3137 | end
|
---|
| 3138 | set(handles.MaskTable,'Data',MaskTable)
|
---|
| 3139 | set(handles.MaskTable,'Visible','on')
|
---|
| 3140 | set(handles.MaskBrowse,'Visible','on')
|
---|
| 3141 | set(handles.ListMask,'Visible','on')
|
---|
| 3142 | set(handles.ListMask,'String',ListMask)
|
---|
| 3143 | set(handles.ListMask,'Value',1)
|
---|
| 3144 | else
|
---|
| 3145 | set(handles.MaskTable,'Visible','off')
|
---|
| 3146 | set(handles.MaskBrowse,'Visible','off')
|
---|
| 3147 | set(handles.ListMask,'Visible','off')
|
---|
| 3148 | end
|
---|
| 3149 |
|
---|
| 3150 | %------------------------------------------------------------------------
|
---|
| 3151 | % --- Executes on button press in MaskBrowse.
|
---|
| 3152 | %------------------------------------------------------------------------
|
---|
| 3153 | function MaskBrowse_Callback(hObject, eventdata, handles)
|
---|
| 3154 |
|
---|
| 3155 | InputTable=get(handles.InputTable,'Data');
|
---|
| 3156 | iview=get(handles.ListMask,'Value');
|
---|
| 3157 | RootPath=InputTable{iview,1};
|
---|
| 3158 | MaskName=uigetfile_uvmat('select a mask file:',RootPath,'image');
|
---|
| 3159 | if ~isempty(MaskName)
|
---|
| 3160 | MaskTable=get(handles.MaskTable,'Data');
|
---|
| 3161 | MaskTable{iview,1}=MaskName ;
|
---|
| 3162 | set(handles.MaskTable,'Data',MaskTable)
|
---|
| 3163 | end
|
---|
| 3164 |
|
---|
| 3165 | %------------------------------------------------------------------------
|
---|
| 3166 | % --- Executes when selected cell(s) is changed in MaskTable.
|
---|
| 3167 | %------------------------------------------------------------------------
|
---|
| 3168 | function MaskTable_CellSelectionCallback(hObject, eventdata, handles)
|
---|
| 3169 |
|
---|
| 3170 | if numel(eventdata.Indices)>=1
|
---|
| 3171 | set(handles.ListMask,'Value',eventdata.Indices(1))
|
---|
| 3172 | end
|
---|
| 3173 |
|
---|
| 3174 | %-------------------------------------------------------------------
|
---|
| 3175 | function MenuHelp_Callback(hObject, eventdata, handles)
|
---|
| 3176 | %-------------------------------------------------------------------
|
---|
| 3177 |
|
---|
| 3178 |
|
---|
[992] | 3179 | % path_to_uvmat=which ('uvmat'); % check the path of uvmat
|
---|
[867] | 3180 | % pathelp=fileparts(path_to_uvmat);
|
---|
| 3181 | % helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html');
|
---|
| 3182 | % if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the sub-directory /uvmat_doc of the UVMAT package')
|
---|
| 3183 | % else
|
---|
| 3184 | % addpath (fullfile(pathelp,'uvmat_doc'))
|
---|
| 3185 | % web([helpfile '#series'])
|
---|
| 3186 | % end
|
---|
| 3187 |
|
---|
| 3188 | %-------------------------------------------------------------------
|
---|
| 3189 | % --- Executes on selection change in TransformName.
|
---|
| 3190 | function TransformName_Callback(hObject, eventdata, handles)
|
---|
| 3191 | %----------------------------------------------------------------------
|
---|
| 3192 | TransformList=get(handles.TransformName,'String');
|
---|
| 3193 | TransformIndex=get(handles.TransformName,'Value');
|
---|
| 3194 | TransformName=TransformList{TransformIndex};
|
---|
| 3195 | TransformPathList=get(handles.TransformName,'UserData');
|
---|
| 3196 | nb_builtin_transform=4;
|
---|
| 3197 | if isequal(TransformName,'more...');
|
---|
| 3198 | FileName=uigetfile_uvmat('Pick a transform function',get(handles.TransformPath,'String'),'.m');
|
---|
| 3199 | if isempty(FileName)
|
---|
| 3200 | return %browser closed without choice
|
---|
| 3201 | end
|
---|
[992] | 3202 | [TransformPath,TransformName,TransformExt]=fileparts(FileName); % removes extension .m
|
---|
[867] | 3203 | if ~strcmp(TransformExt,'.m')
|
---|
| 3204 | msgbox_uvmat('ERROR','a Matlab function .m must be introduced');
|
---|
| 3205 | return
|
---|
| 3206 | end
|
---|
| 3207 | % insert the choice in the menu
|
---|
[992] | 3208 | TransformIndex=find(strcmp(TransformName,TransformList),1); % look for the selected function in the menu Action
|
---|
[867] | 3209 | if isempty(TransformIndex)%the input string does not exist in the menu
|
---|
| 3210 | TransformIndex= length(TransformList);
|
---|
[992] | 3211 | TransformList=[TransformList(1:end-1);{TransformName};TransformList(end)]; % the selected function is appended in the menu, before the last item 'more...'
|
---|
[867] | 3212 | set(handles.TransformName,'String',TransformList)
|
---|
| 3213 | TransformPathList=[TransformPathList;{TransformPath}];
|
---|
| 3214 | else% the input function already exist, we update its path (possibly new)
|
---|
[992] | 3215 | TransformPathList{TransformIndex}=TransformPath; %
|
---|
[867] | 3216 | set(handles.TransformName,'Value',TransformIndex)
|
---|
| 3217 | end
|
---|
| 3218 | % save the new menu in the personal file 'uvmat_perso.mat'
|
---|
[992] | 3219 | dir_perso=prefdir; % personal Matalb directory
|
---|
[867] | 3220 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
|
---|
| 3221 | if exist(profil_perso,'file')
|
---|
| 3222 | for ilist=nb_builtin_transform+1:numel(TransformPathList)
|
---|
| 3223 | TransformListUser{ilist-nb_builtin_transform}=TransformList{ilist};
|
---|
| 3224 | TransformPathListUser{ilist-nb_builtin_transform}=TransformPathList{ilist};
|
---|
| 3225 | end
|
---|
| 3226 | TransformPathListUser=TransformPathListUser';
|
---|
| 3227 | TransformListUser=TransformListUser';
|
---|
[992] | 3228 | save (profil_perso,'TransformPathListUser','TransformListUser','-append'); % store the root name for future opening of uvmat
|
---|
[867] | 3229 | end
|
---|
| 3230 | end
|
---|
| 3231 |
|
---|
| 3232 | %display the current function path
|
---|
[992] | 3233 | set(handles.TransformPath,'String',TransformPathList{TransformIndex}); % show the path to the senlected function
|
---|
[867] | 3234 | set(handles.TransformName,'UserData',TransformPathList);
|
---|
| 3235 |
|
---|
[883] | 3236 | %% create the function handle of the selected fct
|
---|
| 3237 | if ~isempty(TransformName)
|
---|
[897] | 3238 | if ~exist(TransformPathList{TransformIndex},'dir')
|
---|
| 3239 | msgbox_uvmat('ERROR',['The prescribed transform function path ' TransformPathList{TransformIndex} ' does not exist']);
|
---|
| 3240 | return
|
---|
| 3241 | end
|
---|
[992] | 3242 | current_dir=pwd; % current working dir
|
---|
[883] | 3243 | cd(TransformPathList{TransformIndex})
|
---|
| 3244 | transform_handle=str2func(TransformName);
|
---|
| 3245 | cd(current_dir)
|
---|
[994] | 3246 | Field.Action.RUN=0;% indicate that the transform fct is called only to get input param
|
---|
| 3247 | SeriesData=get(handles.series,'UserData');
|
---|
| 3248 | ParamIn=[];
|
---|
| 3249 | if isfield(SeriesData,'TransformInput')
|
---|
| 3250 | ParamIn.TransformInput=SeriesData.TransformInput;
|
---|
| 3251 | end
|
---|
| 3252 | DataOut=feval(transform_handle,Field,ParamIn);% execute the transform fct to get the required conditions
|
---|
[992] | 3253 | Field.Action.RUN=0; % indicate that the transform fct is called only to get input param
|
---|
| 3254 | DataOut=feval(transform_handle,Field,[]); % execute the transform fct to get the required conditions
|
---|
[883] | 3255 | if isfield(DataOut,'TransformInput')% used to add transform parameters at selection of the transform fct
|
---|
| 3256 | SeriesData.TransformInput=DataOut.TransformInput;
|
---|
| 3257 | set(handles.series,'UserData',SeriesData)
|
---|
| 3258 | end
|
---|
| 3259 | end
|
---|
| 3260 |
|
---|
[867] | 3261 | %------------------------------------------------------------------------
|
---|
| 3262 | % --- fct activated by the upper bar menu ExportConfig
|
---|
| 3263 | %------------------------------------------------------------------------
|
---|
| 3264 | function MenuDisplayConfig_Callback(hObject, eventdata, handles)
|
---|
| 3265 |
|
---|
| 3266 | global Param
|
---|
| 3267 | Param=read_GUI_series(handles);
|
---|
| 3268 | evalin('base','global Param')%make CurData global in the workspace
|
---|
| 3269 | display('current series config :')
|
---|
| 3270 | evalin('base','Param') %display CurData in the workspace
|
---|
[992] | 3271 | commandwindow; % brings the Matlab command window to the front
|
---|
[867] | 3272 |
|
---|
| 3273 | %------------------------------------------------------------------------
|
---|
| 3274 | % --- fct activated by the upper bar menu InportConfig: import
|
---|
| 3275 | % menu settings from an xml file (stored in /0_XML for each run)
|
---|
| 3276 | %------------------------------------------------------------------------
|
---|
| 3277 | function MenuImportConfig_Callback(hObject, eventdata, handles)
|
---|
| 3278 |
|
---|
| 3279 | %% use a browser to choose the xml file containing the processing config
|
---|
| 3280 | InputTable=get(handles.InputTable,'Data');
|
---|
[992] | 3281 | oldfile=InputTable{1,1}; % current path in InputTable
|
---|
[867] | 3282 | if isempty(oldfile)
|
---|
| 3283 | % use a file name stored in prefdir
|
---|
| 3284 | dir_perso=prefdir;
|
---|
| 3285 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
|
---|
| 3286 | if exist(profil_perso,'file')
|
---|
| 3287 | h=load (profil_perso);
|
---|
| 3288 | if isfield(h,'RootPath') && ischar(h.RootPath)
|
---|
| 3289 | oldfile=h.RootPath;
|
---|
| 3290 | end
|
---|
| 3291 | end
|
---|
| 3292 | end
|
---|
[992] | 3293 | filexml=uigetfile_uvmat('pick a xml parameter file',oldfile,'.xml'); % get the xml file containing processing parameters
|
---|
[867] | 3294 | if isempty(filexml), return, end % quit function if an xml file has not been opened
|
---|
| 3295 |
|
---|
| 3296 | %% fill the GUI series with the content of the xml file
|
---|
[992] | 3297 | Param=xml2struct(filexml); % read the input xml file as a Matlab structure
|
---|
[867] | 3298 |
|
---|
| 3299 | % ask to stop current Action if button RUN is in action (another process is already running)
|
---|
| 3300 | if isequal(get(handles.RUN,'Value'),1)
|
---|
| 3301 | answer= msgbox_uvmat('INPUT_Y-N','stop current Action process?');
|
---|
| 3302 | if strcmp(answer,'Yes')
|
---|
| 3303 | STOP_Callback(hObject, eventdata, handles)
|
---|
| 3304 | else
|
---|
| 3305 | return
|
---|
| 3306 | end
|
---|
| 3307 | end
|
---|
[992] | 3308 | Param.Action.RUN=0; % desactivate the input RUN=1
|
---|
[867] | 3309 |
|
---|
| 3310 | fill_GUI(Param,handles.series)% fill the elements of the GUI series with the input parameters
|
---|
| 3311 | SeriesData=get(handles.series,'UserData');
|
---|
| 3312 | if isfield(Param,'InputFields')
|
---|
| 3313 | ListField=Param.InputFields.FieldName;
|
---|
| 3314 | if ischar(ListField),ListField={ListField}; end
|
---|
| 3315 | set(handles.FieldName,'String',[ListField;{'get-field...'}])
|
---|
| 3316 | set(handles.FieldName,'Value',1:numel(ListField))
|
---|
| 3317 | set(handles.FieldName,'Visible','on')
|
---|
| 3318 | end
|
---|
| 3319 | if isfield(Param,'ActionInput')% introduce parameters specific to an Action fct, for instance PIV parameters
|
---|
[996] | 3320 | % set(handles.ActionInput,'Visible','on')
|
---|
| 3321 | % set(handles.ActionInput,'Value',0)
|
---|
[992] | 3322 | Param.ActionInput.ConfigSource=filexml; % record the source of config for future info
|
---|
[867] | 3323 | SeriesData.ActionInput=Param.ActionInput;
|
---|
| 3324 | end
|
---|
[883] | 3325 | if isfield(Param,'TransformInput')% introduce parameters specific to a transform fct
|
---|
| 3326 | SeriesData.TransformInput=Param.TransformInput;
|
---|
| 3327 | end
|
---|
[867] | 3328 | if isfield(Param,'ProjObject') %introduce projection object if relevant
|
---|
| 3329 | SeriesData.ProjObject=Param.ProjObject;
|
---|
| 3330 | end
|
---|
| 3331 | set(handles.series,'UserData',SeriesData)
|
---|
| 3332 | if isfield(Param,'CheckObject') && isequal(Param.CheckObject,1)
|
---|
| 3333 | set(handles.ProjObject,'String',Param.ProjObject.Name)
|
---|
| 3334 | set(handles.ViewObject,'Visible','on')
|
---|
| 3335 | set(handles.EditObject,'Visible','on')
|
---|
| 3336 | set(handles.DeleteObject,'Visible','on')
|
---|
| 3337 | else
|
---|
| 3338 | set(handles.ProjObject,'String','')
|
---|
| 3339 | set(handles.ProjObject,'Visible','off')
|
---|
| 3340 | set(handles.ViewObject,'Visible','off')
|
---|
| 3341 | set(handles.EditObject,'Visible','off')
|
---|
| 3342 | set(handles.DeleteObject,'Visible','off')
|
---|
| 3343 | end
|
---|
[992] | 3344 | set(handles.REFRESH,'BackgroundColor',[1 0 1]); % paint REFRESH button in magenta to indicate that it should be activated
|
---|
[867] | 3345 |
|
---|
| 3346 |
|
---|
| 3347 | %------------------------------------------------------------------------
|
---|
| 3348 | % --- Executes when the GUI series is resized.
|
---|
| 3349 | %------------------------------------------------------------------------
|
---|
| 3350 | function series_ResizeFcn(hObject, eventdata, handles)
|
---|
| 3351 |
|
---|
| 3352 | %% input table
|
---|
| 3353 | set(handles.InputTable,'Unit','pixel')
|
---|
| 3354 | Pos=get(handles.InputTable,'Position');
|
---|
| 3355 | set(handles.InputTable,'Unit','normalized')
|
---|
| 3356 | ColumnWidth=round([0.5 0.14 0.14 0.14 0.08]*(Pos(3)-52));
|
---|
| 3357 | ColumnWidth=num2cell(ColumnWidth);
|
---|
| 3358 | set(handles.InputTable,'ColumnWidth',ColumnWidth)
|
---|
| 3359 |
|
---|
| 3360 | %% MinIndex_j and MaxIndex_i
|
---|
| 3361 | unit=get(handles.MinIndex_i,'Unit');
|
---|
| 3362 | set(handles.MinIndex_i,'Unit','pixel')
|
---|
| 3363 | Pos=get(handles.MinIndex_i,'Position');
|
---|
| 3364 | set(handles.MinIndex_i,'Unit',unit)
|
---|
| 3365 | set(handles.MinIndex_i,'ColumnWidth',{Pos(3)-18})
|
---|
| 3366 | set(handles.MaxIndex_i,'ColumnWidth',{Pos(3)-18})
|
---|
| 3367 | set(handles.MinIndex_j,'ColumnWidth',{Pos(3)-18})
|
---|
| 3368 | set(handles.MaxIndex_j,'ColumnWidth',{Pos(3)-18})
|
---|
| 3369 |
|
---|
| 3370 | %% TimeTable
|
---|
| 3371 | set(handles.TimeTable,'Unit','pixel')
|
---|
| 3372 | Pos=get(handles.TimeTable,'Position');
|
---|
| 3373 | set(handles.TimeTable,'Unit','normalized')
|
---|
| 3374 | % ColumnWidth=get(handles.TimeTable,'ColumnWidth');
|
---|
| 3375 | ColumnWidth=num2cell(floor([0.2 0.2 0.2 0.2 0.2]*(Pos(3)-20)));
|
---|
| 3376 | set(handles.TimeTable,'ColumnWidth',ColumnWidth)
|
---|
| 3377 |
|
---|
| 3378 |
|
---|
| 3379 | %% PairString
|
---|
| 3380 | set(handles.PairString,'Unit','pixel')
|
---|
| 3381 | Pos=get(handles.PairString,'Position');
|
---|
| 3382 | set(handles.PairString,'Unit','normalized')
|
---|
| 3383 | set(handles.PairString,'ColumnWidth',{Pos(3)-5})
|
---|
| 3384 |
|
---|
| 3385 | %% MaskTable
|
---|
| 3386 | set(handles.MaskTable,'Unit','pixel')
|
---|
| 3387 | Pos=get(handles.MaskTable,'Position');
|
---|
| 3388 | set(handles.MaskTable,'Unit','normalized')
|
---|
| 3389 | set(handles.MaskTable,'ColumnWidth',{Pos(3)-5})
|
---|
| 3390 |
|
---|
| 3391 | %------------------------------------------------------------------------
|
---|
| 3392 | % --- Executes on button press in status.
|
---|
| 3393 | %------------------------------------------------------------------------
|
---|
| 3394 | function status_Callback(hObject, eventdata, handles)
|
---|
| 3395 |
|
---|
| 3396 | if get(handles.status,'Value')
|
---|
| 3397 | set(handles.status,'BackgroundColor',[1 1 0])
|
---|
| 3398 | drawnow
|
---|
| 3399 | Param=read_GUI(handles.series);
|
---|
| 3400 | RootPath=Param.InputTable{1,1};
|
---|
| 3401 | if ~isfield(Param,'OutputSubDir')
|
---|
| 3402 | msgbox_uvmat('ERROR','no standard sub-directory definition for output files, use a browser to check the output')
|
---|
| 3403 | set(handles.status,'BackgroundColor',[0 1 0])
|
---|
| 3404 | return
|
---|
| 3405 | end
|
---|
[992] | 3406 | OutputSubDir=[Param.OutputSubDir Param.OutputDirExt]; % subdirectory for output files
|
---|
[867] | 3407 | OutputDir=fullfile(RootPath,OutputSubDir);
|
---|
| 3408 | if exist(OutputDir,'dir')
|
---|
| 3409 | uigetfile_uvmat('status_display',OutputDir)
|
---|
| 3410 | else
|
---|
| 3411 | msgbox_uvmat('ERROR','output folder not created yet: calculation did not start')
|
---|
| 3412 | set(handles.status,'BackgroundColor',[0 1 0])
|
---|
| 3413 | end
|
---|
| 3414 | else
|
---|
| 3415 | %% delete current display fig if selection is off
|
---|
| 3416 | set(handles.status,'BackgroundColor',[0 1 0])
|
---|
| 3417 | hfig=findobj(allchild(0),'name','status_display');
|
---|
| 3418 | if ~isempty(hfig)
|
---|
| 3419 | delete(hfig)
|
---|
| 3420 | end
|
---|
| 3421 | return
|
---|
| 3422 | end
|
---|
| 3423 |
|
---|
| 3424 |
|
---|
| 3425 | %------------------------------------------------------------------------
|
---|
| 3426 | % launched by selecting a file on the list
|
---|
| 3427 | %------------------------------------------------------------------------
|
---|
| 3428 | function view_file(hObject, eventdata)
|
---|
| 3429 |
|
---|
| 3430 | list=get(hObject,'String');
|
---|
| 3431 | index=get(hObject,'Value');
|
---|
| 3432 | rootroot=get(hObject,'UserData');
|
---|
| 3433 | selectname=list{index};
|
---|
| 3434 | ind_dot=regexp(selectname,'\.\.\.');
|
---|
| 3435 | if ~isempty(ind_dot)
|
---|
| 3436 | selectname=selectname(1:ind_dot-1);
|
---|
| 3437 | end
|
---|
| 3438 | FullSelectName=fullfile(rootroot,selectname);
|
---|
| 3439 | if exist(FullSelectName,'dir')% a directory has been selected
|
---|
| 3440 | ListFiles=dir(FullSelectName);
|
---|
| 3441 | ListDisplay=cell(numel(ListFiles),1);
|
---|
| 3442 | for ilist=2:numel(ListDisplay)% suppress the first line '.'
|
---|
| 3443 | ListDisplay{ilist-1}=ListFiles(ilist).name;
|
---|
| 3444 | end
|
---|
| 3445 | set(hObject,'Value',1)
|
---|
| 3446 | set(hObject,'String',ListDisplay)
|
---|
| 3447 | if strcmp(selectname,'..')
|
---|
| 3448 | FullSelectName=fileparts(fileparts(FullSelectName));
|
---|
| 3449 | end
|
---|
| 3450 | set(hObject,'UserData',FullSelectName)
|
---|
| 3451 | hfig=get(hObject,'parent');
|
---|
| 3452 | htitlebox=findobj(hfig,'tag','titlebox');
|
---|
| 3453 | set(htitlebox,'String',FullSelectName)
|
---|
| 3454 | elseif exist(FullSelectName,'file')%visualise the vel field if it exists
|
---|
| 3455 | FileInfo=get_file_info(FullSelectName);
|
---|
| 3456 | if strcmp(FileInfo.FileType,'txt')
|
---|
| 3457 | edit(FullSelectName)
|
---|
| 3458 | elseif strcmp(FileInfo.FileType,'xml')
|
---|
| 3459 | editxml(FullSelectName)
|
---|
| 3460 | else
|
---|
| 3461 | uvmat(FullSelectName)
|
---|
| 3462 | end
|
---|
| 3463 | set(gcbo,'Value',1)
|
---|
| 3464 | end
|
---|
| 3465 |
|
---|
| 3466 |
|
---|
| 3467 | %------------------------------------------------------------------------
|
---|
| 3468 | % launched by refreshing the status figure
|
---|
| 3469 | %------------------------------------------------------------------------
|
---|
| 3470 | function refresh_GUI(hfig)
|
---|
| 3471 |
|
---|
| 3472 | htitlebox=findobj(hfig,'tag','titlebox');
|
---|
| 3473 | hlist=findobj(hfig,'tag','list');
|
---|
| 3474 | hseries=findobj(allchild(0),'tag','series');
|
---|
| 3475 | hstatus=findobj(hseries,'tag','status');
|
---|
| 3476 | StatusData=get(hstatus,'UserData');
|
---|
| 3477 | OutputDir=get(htitlebox,'String');
|
---|
| 3478 | if ischar(OutputDir),OutputDir={OutputDir};end
|
---|
| 3479 | ListFiles=dir(OutputDir{1});
|
---|
| 3480 | if numel(ListFiles)<1
|
---|
| 3481 | return
|
---|
| 3482 | end
|
---|
[992] | 3483 | ListFiles(1)=[]; % removes the first line ='.'
|
---|
[867] | 3484 | ListDisplay=cell(numel(ListFiles),1);
|
---|
| 3485 | testrecent=0;
|
---|
| 3486 | datnum=zeros(numel(ListDisplay),1);
|
---|
| 3487 | for ilist=1:numel(ListDisplay)
|
---|
| 3488 | ListDisplay{ilist}=ListFiles(ilist).name;
|
---|
| 3489 | if ~ListFiles(ilist).isdir && isfield(ListFiles(ilist),'datenum')
|
---|
[992] | 3490 | datnum(ilist)=ListFiles(ilist).datenum; % only available in recent matlab versions
|
---|
[867] | 3491 | testrecent=1;
|
---|
| 3492 | end
|
---|
| 3493 | end
|
---|
| 3494 | set(hlist,'String',ListDisplay)
|
---|
| 3495 |
|
---|
| 3496 | %% Look at date of creation
|
---|
| 3497 | ListDisplay=ListDisplay(datnum~=0);
|
---|
[992] | 3498 | datnum=datnum(datnum~=0); % keep the non zero values corresponding to existing files
|
---|
[867] | 3499 | NbOutputFile=[];
|
---|
| 3500 | if isempty(datnum)
|
---|
| 3501 | if testrecent
|
---|
| 3502 | message='no civ result created yet';
|
---|
| 3503 | else
|
---|
| 3504 | message='';
|
---|
| 3505 | end
|
---|
| 3506 | else
|
---|
| 3507 | [first,indfirst]=min(datnum);
|
---|
| 3508 | [last,indlast]=max(datnum);
|
---|
| 3509 | NbOutputFile_str='?';
|
---|
| 3510 | NbOutputFile=[];
|
---|
| 3511 | if isfield(StatusData,'NbOutputFile')
|
---|
| 3512 | NbOutputFile=StatusData.NbOutputFile;
|
---|
| 3513 | NbOutputFile_str=num2str(NbOutputFile);
|
---|
| 3514 | end
|
---|
| 3515 | message={[num2str(numel(datnum)) ' file(s) done over ' NbOutputFile_str] ;['oldest modification: ' ListDisplay{indfirst} ' : ' datestr(first)];...
|
---|
| 3516 | ['latest modification: ' ListDisplay{indlast} ' : ' datestr(last)]};
|
---|
| 3517 | end
|
---|
| 3518 | set(htitlebox,'String', [OutputDir{1};message])
|
---|
| 3519 |
|
---|
| 3520 | %% update the waitbar
|
---|
| 3521 | hwaitbar=findobj(hfig,'tag','waitbar');
|
---|
| 3522 | if ~isempty(NbOutputFile)
|
---|
| 3523 | BarPosition=get(hwaitbar,'Position');
|
---|
| 3524 | BarPosition(3)=0.9*numel(datnum)/NbOutputFile;
|
---|
| 3525 | set(hwaitbar,'Position',BarPosition)
|
---|
| 3526 | end
|
---|
| 3527 |
|
---|
| 3528 | %------------------------------------------------------------------------
|
---|
| 3529 | % --- Executes on selection change in ActionExt.
|
---|
| 3530 | %------------------------------------------------------------------------
|
---|
| 3531 | function ActionExt_Callback(hObject, eventdata, handles)
|
---|
| 3532 |
|
---|
| 3533 | ActionExtList=get(handles.ActionExt,'String');
|
---|
| 3534 | ActionExt=ActionExtList{get(handles.ActionExt,'Value')};
|
---|
| 3535 | if strcmp(ActionExt,'.py (in dev.)')
|
---|
| 3536 | set(handles.RunMode,'Value',2)
|
---|
| 3537 | end
|
---|
| 3538 |
|
---|
[897] | 3539 | %function num_NbProcess_Callback(hObject, eventdata, handles)
|
---|
[867] | 3540 |
|
---|
| 3541 |
|
---|
| 3542 | function num_NbSlice_Callback(hObject, eventdata, handles)
|
---|
| 3543 | NbSlice=str2num(get(handles.num_NbSlice,'String'));
|
---|
[897] | 3544 | %set(handles.num_NbProcess,'String',num2str(NbSlice))
|
---|
[867] | 3545 |
|
---|
| 3546 | %------------------------------------------------------------------------
|
---|
| 3547 | % --- set the visibility of relevant velocity type menus:
|
---|
| 3548 | function menu=set_veltype_display(Civ,FileType)
|
---|
| 3549 | %------------------------------------------------------------------------
|
---|
| 3550 | if ~exist('FileType','var')
|
---|
| 3551 | FileType='civx';
|
---|
| 3552 | end
|
---|
| 3553 | switch FileType
|
---|
| 3554 | case 'civx'
|
---|
| 3555 | menu={'civ1';'interp1';'filter1';'civ2';'interp2';'filter2'};
|
---|
| 3556 | if isequal(Civ,0)
|
---|
| 3557 | imax=0;
|
---|
| 3558 | elseif isequal(Civ,1) || isequal(Civ,2)
|
---|
| 3559 | imax=1;
|
---|
| 3560 | elseif isequal(Civ,3)
|
---|
| 3561 | imax=3;
|
---|
| 3562 | elseif isequal(Civ,4) || isequal(Civ,5)
|
---|
| 3563 | imax=4;
|
---|
| 3564 | elseif isequal(Civ,6) %patch2
|
---|
| 3565 | imax=6;
|
---|
| 3566 | end
|
---|
| 3567 | case 'civdata'
|
---|
| 3568 | menu={'civ1';'filter1';'civ2';'filter2'};
|
---|
| 3569 | if isequal(Civ,0)
|
---|
| 3570 | imax=0;
|
---|
| 3571 | elseif isequal(Civ,1) || isequal(Civ,2)
|
---|
| 3572 | imax=1;
|
---|
| 3573 | elseif isequal(Civ,3)
|
---|
| 3574 | imax=2;
|
---|
| 3575 | elseif isequal(Civ,4) || isequal(Civ,5)
|
---|
| 3576 | imax=3;
|
---|
[912] | 3577 | else%if isequal(Civ,6) %patch2
|
---|
[867] | 3578 | imax=4;
|
---|
| 3579 | end
|
---|
| 3580 | end
|
---|
| 3581 | menu=menu(1:imax);
|
---|
| 3582 |
|
---|
| 3583 |
|
---|
| 3584 | % --- Executes on mouse motion over figure - except title and menu.
|
---|
| 3585 | function series_WindowButtonMotionFcn(hObject, eventdata, handles)
|
---|
| 3586 | set(hObject,'Pointer','arrow');
|
---|
| 3587 |
|
---|
| 3588 |
|
---|
| 3589 | % --- Executes on button press in SetPairs.
|
---|
[972] | 3590 | function SetPairs_Callback(hObject, eventdata, handles)
|
---|
[867] | 3591 |
|
---|
| 3592 | %% delete previous occurrence of 'set_pairs'
|
---|
| 3593 | hfig=findobj(allchild(0),'Tag','set_pairs');
|
---|
| 3594 | if ~isempty(hfig)
|
---|
| 3595 | delete(hfig)
|
---|
| 3596 | end
|
---|
| 3597 |
|
---|
| 3598 | %% create the GUI set_pairs
|
---|
| 3599 | set(0,'Unit','points')
|
---|
[992] | 3600 | ScreenSize=get(0,'ScreenSize'); % get the size of the screen, to put the fig on the upper right
|
---|
| 3601 | Width=220; % fig width in points (1/72 inch)
|
---|
[867] | 3602 | Height=min(0.8*ScreenSize(4),300);
|
---|
[992] | 3603 | Left=ScreenSize(3)- Width-40; % right edge close to the right, with margin=40
|
---|
| 3604 | Bottom=ScreenSize(4)-Height-40; % put fig at top right
|
---|
[867] | 3605 | hfig=findobj(allchild(0),'Tag','set_slice');
|
---|
[992] | 3606 | if ~isempty(hfig),delete(hfig), end; % delete existing version of the GUI
|
---|
[867] | 3607 | hfig=figure('name','set_pairs','tag','set_pairs','MenuBar','none','NumberTitle','off','Unit','points','Position',[Left,Bottom,Width,Height]);
|
---|
| 3608 | BackgroundColor=get(hfig,'Color');
|
---|
| 3609 | SeriesData=get(handles.series,'UserData');
|
---|
| 3610 | TimeUnit=get(handles.TimeUnit,'String');
|
---|
| 3611 | PairString=get(handles.PairString,'Data');
|
---|
[992] | 3612 | ListViewLines=find(cellfun('isempty',PairString)==0); % find list of non empty pairs
|
---|
[867] | 3613 | ListViewMenu=cell(numel(ListViewLines),1);
|
---|
[1011] | 3614 | %iview=get(handles.PairString,'Value');
|
---|
| 3615 | iview=[];
|
---|
[867] | 3616 | for ilist=1:numel(ListViewLines)
|
---|
| 3617 | ListViewMenu{ilist}=num2str(ListViewLines(ilist));
|
---|
| 3618 | end
|
---|
| 3619 | if isempty(iview)
|
---|
[992] | 3620 | ListViewValue=numel(ListViewLines); % we work by default on the pair option for the last line which requires pairs
|
---|
[867] | 3621 | iview=ListViewLines(end);
|
---|
| 3622 | else
|
---|
| 3623 | ListViewValue=find(ListViewLines==iview);
|
---|
| 3624 | end
|
---|
| 3625 | ref_i=str2num(get(handles.num_first_i,'String'));
|
---|
[992] | 3626 | ref_j=1; % default
|
---|
[867] | 3627 | if strcmp(get(handles.num_first_j,'String'),'Visible')
|
---|
| 3628 | ref_j=str2num(get(handles.num_first_j,'String'));
|
---|
| 3629 | end
|
---|
| 3630 | [ModeMenu,ModeValue]=update_mode(SeriesData.i1_series{iview},SeriesData.i2_series{iview},SeriesData.j2_series{iview});
|
---|
| 3631 | displ_pair=update_listpair(SeriesData.i1_series{iview},SeriesData.i2_series{iview},SeriesData.j1_series{iview},SeriesData.j2_series{iview},ModeMenu{ModeValue},...
|
---|
| 3632 | SeriesData.Time{iview},TimeUnit,ref_i,ref_j,SeriesData.FileInfo{iview});
|
---|
| 3633 | % first raw of the GUI
|
---|
| 3634 | uicontrol('Style','text','Units','normalized', 'Position', [0.05 0.88 0.5 0.1],'BackgroundColor',BackgroundColor,...
|
---|
[992] | 3635 | 'String','row to edit #','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','right'); % title
|
---|
[867] | 3636 | uicontrol('Style','popupmenu','Units','normalized', 'Position', [0.54 0.8 0.3 0.2],'BackgroundColor',[1 1 1],...
|
---|
| 3637 | 'Callback',@(hObject,eventdata)ListView_Callback(hObject,eventdata),'String',ListViewMenu,'Value',ListViewValue,'FontUnits','points','FontSize',12,'FontWeight','bold',...
|
---|
| 3638 | 'Tag','ListView','TooltipString','''ListView'':choice of the file series w for pair display');
|
---|
| 3639 | % second raw of the GUI
|
---|
| 3640 | uicontrol('Style','text','Units','normalized', 'Position', [0.05 0.79 0.7 0.1],'BackgroundColor',BackgroundColor,...
|
---|
[992] | 3641 | 'String','mode of index pairing:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left'); % title
|
---|
[867] | 3642 | uicontrol('Style','popupmenu','Units','normalized', 'Position', [0.05 0.62 0.9 0.2],'BackgroundColor',[1 1 1],...
|
---|
| 3643 | 'Callback',@(hObject,eventdata)Mode_Callback(hObject,eventdata),'String',ModeMenu,'Value',ModeValue,'FontUnits','points','FontSize',12,'FontWeight','bold',...
|
---|
| 3644 | 'Tag','Mode','TooltipString','''Mode'': choice of the image pair mode');
|
---|
| 3645 | % third raw
|
---|
| 3646 | uicontrol('Style','text','Units','normalized', 'Position', [0.05 0.6 0.7 0.1],'BackgroundColor',BackgroundColor,...
|
---|
[992] | 3647 | 'String','pair choice:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left'); % title
|
---|
[867] | 3648 | uicontrol('Style','listbox','Units','normalized', 'Position', [0.05 0.42 0.9 0.2],'BackgroundColor',[1 1 1],...
|
---|
| 3649 | 'Callback',@(hObject,eventdata)ListPair_Callback(hObject,eventdata),'String',displ_pair,'Value',1,'FontUnits','points','FontSize',12,'FontWeight','bold',...
|
---|
| 3650 | 'Tag','ListPair','TooltipString','''ListPair'': menu for selecting the image pair');
|
---|
| 3651 | uicontrol('Style','text','Units','normalized', 'Position', [0.1 0.22 0.8 0.1],'BackgroundColor',BackgroundColor,...
|
---|
[992] | 3652 | 'String','ref_i ref_j','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center'); % title
|
---|
[867] | 3653 | uicontrol('Style','edit','Units','normalized', 'Position', [0.15 0.17 0.3 0.08],'BackgroundColor',[1 1 1],...
|
---|
| 3654 | 'Callback',@(hObject,eventdata)num_ref_i_Callback(hObject,eventdata),'String',num2str(ref_i),'FontUnits','points','FontSize',12,'FontWeight','bold',...
|
---|
| 3655 | 'Tag','num_ref_i','TooltipString','''num_ref_i'': reference field index i used to display dt in ''list_pair_civ''');
|
---|
| 3656 | uicontrol('Style','edit','Units','normalized', 'Position', [0.55 0.17 0.3 0.08],'BackgroundColor',[1 1 1],...
|
---|
| 3657 | 'Callback',@(hObject,eventdata)num_ref_j_Callback(hObject,eventdata),'String',num2str(ref_j),'FontUnits','points','FontSize',12,'FontWeight','bold',...
|
---|
| 3658 | 'Tag','num_ref_j','TooltipString','''num_ref_j'': reference field index i used to display dt in ''list_pair_civ''');
|
---|
[880] | 3659 | uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.01 0.01 0.3 0.12],'BackgroundColor',[0 1 0],...
|
---|
| 3660 | 'Callback',@(hObject,eventdata)OK_Callback(hObject,eventdata),'String','OK','FontUnits','points','FontSize',12,'FontWeight','bold',...
|
---|
| 3661 | 'Tag','OK','TooltipString','''OK'': validate the choice');
|
---|
[867] | 3662 | % last raw of the GUI: pushbuttons
|
---|
| 3663 | % uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.35 0.01 0.3 0.15],'BackgroundColor',[0 1 0],'String','OK','Callback',@(hObject,eventdata)OK_Callback(hObject,eventdata),...
|
---|
| 3664 | % 'FontWeight','bold','FontUnits','points','FontSize',12,'TooltipString','''OK'': apply the output to the current field series in uvmat');
|
---|
| 3665 | drawnow
|
---|
| 3666 |
|
---|
| 3667 | %------------------------------------------------------------------------
|
---|
| 3668 | function ListView_Callback(hObject,eventdata)
|
---|
| 3669 | Mode_Callback(hObject,eventdata)
|
---|
| 3670 |
|
---|
| 3671 | %------------------------------------------------------------------------
|
---|
| 3672 | function Mode_Callback(hObject,eventdata)
|
---|
| 3673 | %% get input info
|
---|
[992] | 3674 | hseries=findobj(allchild(0),'tag','series'); % handles of the GUI series
|
---|
| 3675 | hhseries=guidata(hseries); % handles of the elements in the GUI series
|
---|
[867] | 3676 | TimeUnit=get(hhseries.TimeUnit,'String');
|
---|
| 3677 | SeriesData=get(hseries,'UserData');
|
---|
| 3678 | mode_list=get(hObject,'String');
|
---|
| 3679 | mode=mode_list{get(hObject,'Value')};
|
---|
| 3680 | hListView=findobj(get(hObject,'parent'),'Tag','ListView');
|
---|
| 3681 | iview=get(hListView,'Value');
|
---|
| 3682 | i1_series=SeriesData.i1_series{iview};
|
---|
| 3683 | i2_series=SeriesData.i2_series{iview};
|
---|
| 3684 | j1_series=SeriesData.j1_series{iview};
|
---|
| 3685 | j2_series=SeriesData.j2_series{iview};
|
---|
| 3686 |
|
---|
| 3687 | %% enable j index visibility after the new choice
|
---|
[992] | 3688 | status_j='on'; % default
|
---|
[867] | 3689 | if isempty(find(~cellfun(@isempty,SeriesData.j1_series), 1)); % case of empty j indices
|
---|
| 3690 | status_j='off'; % no j index needed
|
---|
| 3691 | elseif strcmp(get(handles.PairString,'Visible'),'on')
|
---|
[992] | 3692 | check_burst=cellfun(@isempty,regexp(PairString,'^j')); % =0 for burst case, 1 otherwise
|
---|
[867] | 3693 | if isempty(find(check_burst, 1))% if all pair string begins by j (burst)
|
---|
| 3694 | status_j='off'; % no j index needed for bust case
|
---|
| 3695 | end
|
---|
| 3696 | end
|
---|
| 3697 | enable_j(handles,status_j) % no j index needed
|
---|
| 3698 |
|
---|
| 3699 | %% get the reference indices for the time interval Dt
|
---|
| 3700 | href_i=findobj(get(hObject,'parent'),'Tag','ref_i');
|
---|
| 3701 | ref_i=[];ref_j=[];
|
---|
| 3702 | if strcmp(get(href_i,'Visible'),'on')
|
---|
| 3703 | ref_i=str2num(get(href_i,'String'));
|
---|
| 3704 | end
|
---|
| 3705 | if isempty(ref_i)
|
---|
| 3706 | ref_i=1;
|
---|
| 3707 | end
|
---|
| 3708 | if isempty(ref_j)
|
---|
| 3709 | ref_j=1;
|
---|
| 3710 | end
|
---|
| 3711 |
|
---|
| 3712 | %% update the menu ListPair
|
---|
| 3713 | Menu=update_listpair(i1_series,i2_series,j1_series,j2_series,mode,SeriesData.Time{iview},TimeUnit,ref_i,ref_j,FileInfo);
|
---|
| 3714 | hlist_pairs=findobj(get(hObject,'parent'),'Tag','ListPair');
|
---|
| 3715 | set(hlist_pairs,'Value',1)% set the first choice by default in ListPair
|
---|
| 3716 | set(hlist_pairs,'String',Menu)% set the menu in ListPair
|
---|
| 3717 | ListPair_Callback(hlist_pairs,[])% apply the default choice in ListPair
|
---|
| 3718 |
|
---|
| 3719 | %-------------------------------------------------------------
|
---|
| 3720 | % --- Executes on selection in ListPair.
|
---|
| 3721 | function ListPair_Callback(hObject,eventdata)
|
---|
| 3722 | %------------------------------------------------------------
|
---|
[992] | 3723 | list_pair=get(hObject,'String'); % get the menu of image pairs
|
---|
[867] | 3724 | if isempty(list_pair)
|
---|
| 3725 | string='';
|
---|
| 3726 | else
|
---|
| 3727 | string=list_pair{get(hObject,'Value')};
|
---|
[992] | 3728 | % string=regexprep(string,',.*',''); % removes time indication (after ',')
|
---|
[867] | 3729 | end
|
---|
| 3730 | hseries=findobj(allchild(0),'tag','series');
|
---|
| 3731 | hPairString=findobj(hseries,'tag','PairString');
|
---|
| 3732 | PairString=get(hPairString,'Data');
|
---|
| 3733 | hListView=findobj(get(hObject,'parent'),'Tag','ListView');
|
---|
| 3734 | iview=get(hListView,'Value');
|
---|
| 3735 | PairString{iview,1}=string;
|
---|
| 3736 | % report the selected pair string to the table PairString
|
---|
| 3737 | set(hPairString,'Data',PairString)
|
---|
| 3738 |
|
---|
| 3739 |
|
---|
| 3740 | %------------------------------------------------------------------------
|
---|
| 3741 | function num_ref_i_Callback(hObject, eventdata)
|
---|
| 3742 | %------------------------------------------------------------------------
|
---|
| 3743 | Mode_Callback([],[])
|
---|
| 3744 |
|
---|
| 3745 | %------------------------------------------------------------------------
|
---|
| 3746 | function num_ref_j_Callback(hObject, eventdata)
|
---|
| 3747 | %------------------------------------------------------------------------
|
---|
| 3748 | Mode_Callback([],[])
|
---|
| 3749 |
|
---|
| 3750 | %------------------------------------------------------------------------
|
---|
[880] | 3751 | function OK_Callback(hObject, eventdata)
|
---|
| 3752 | %------------------------------------------------------------------------
|
---|
| 3753 | delete(get(hObject,'parent'))
|
---|
| 3754 |
|
---|
| 3755 |
|
---|
| 3756 | %------------------------------------------------------------------------
|
---|
[867] | 3757 | % --- Executes on button press in ClearLine.
|
---|
| 3758 | %------------------------------------------------------------------------
|
---|
| 3759 | function ClearLine_Callback(hObject, eventdata, handles)
|
---|
| 3760 | InputTable=get(handles.InputTable,'Data');
|
---|
| 3761 | iline=str2double(get(handles.InputLine,'String'));
|
---|
| 3762 | if size(InputTable,1)>1
|
---|
[992] | 3763 | InputTable(iline,:)=[]; % suppress the current line if not the first
|
---|
[867] | 3764 | set(handles.InputTable,'Data',InputTable);
|
---|
| 3765 | end
|
---|
[883] | 3766 | set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color to indicate that input refr
|
---|
[880] | 3767 |
|
---|
| 3768 |
|
---|
| 3769 | % --- Executes on button press in MonitorCluster.
|
---|
| 3770 | function MonitorCluster_Callback(hObject, eventdata, handles)
|
---|
[991] | 3771 | disp('format: R/W=run/wait, time lapsed, R=nbre of cores,W=walltime')
|
---|
| 3772 | system('oarstat |grep N=UVmat')% check the list of jobs launched with uvmat
|
---|
[880] | 3773 |
|
---|
[991] | 3774 |
|
---|
[880] | 3775 | function OutputSubDir_Callback(hObject, eventdata, handles)
|
---|
| 3776 | set(handles.OutputSubDir,'BackgroundColor',[1 1 1])
|
---|
[904] | 3777 |
|
---|
| 3778 |
|
---|
| 3779 | % --- Executes on button press in CheckOverwrite.
|
---|
| 3780 | function CheckOverwrite_Callback(hObject, eventdata, handles)
|
---|
[880] | 3781 |
|
---|
[904] | 3782 | % --- Executes on button press in TestCPUTime.
|
---|
| 3783 | function TestCPUTime_Callback(hObject, eventdata, handles)
|
---|
| 3784 | % hObject handle to TestCPUTime (see GCBO)
|
---|
| 3785 | % eventdata reserved - to be defined in a future version of MATLAB
|
---|
| 3786 | % handles structure with handles and user data (see GUIDATA)
|
---|
| 3787 |
|
---|
| 3788 |
|
---|
[994] | 3789 | % --- Executes on button press in DiskQuota.
|
---|
| 3790 | function DiskQuota_Callback(hObject, eventdata, handles)
|
---|
[996] | 3791 | SeriesData=get(handles.series,'UserData');
|
---|
| 3792 | system(SeriesData.SeriesParam.DiskQuotaCmd)
|
---|
| 3793 |
|
---|
| 3794 |
|
---|
| 3795 |
|
---|