[2] | 1 | %'series': master function associated to the GUI series.m for analysis field series |
---|
| 2 | %------------------------------------------------------------------------ |
---|
| 3 | % function varargout = series(varargin) |
---|
| 4 | % associated with the GUI series.fig |
---|
| 5 | % |
---|
| 6 | %INPUT |
---|
| 7 | % param: structure with input parameters (link with the GUI uvmat) |
---|
| 8 | % .menu_coord_str: string for the CoordType (menu for coordinate transforms) |
---|
| 9 | % .menu_coord_val: value for CoordType (menu for coordinate transforms) |
---|
| 10 | % .FileName: input file name |
---|
| 11 | % .FileName_1: second input file name |
---|
| 12 | % .list_field: menu of input fields |
---|
| 13 | % .index_fields: chosen index |
---|
| 14 | % .civ1=0 or 1, .interp1, ... : input civ field type |
---|
| 15 | % |
---|
| 16 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
| 17 | % Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org. |
---|
| 18 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
| 19 | % This file is part of the toolbox UVMAT. |
---|
| 20 | % |
---|
| 21 | % UVMAT is free software; you can redistribute it and/or modify |
---|
| 22 | % it under the terms of the GNU General Public License as published by |
---|
| 23 | % the Free Software Foundation; either version 2 of the License, or |
---|
| 24 | % (at your option) any later version. |
---|
| 25 | % |
---|
| 26 | % UVMAT is distributed in the hope that it will be useful, |
---|
| 27 | % but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 28 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 29 | % GNU General Public License (file UVMAT/COPYING.txt) for more details. |
---|
| 30 | %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
| 31 | |
---|
| 32 | function varargout = series(varargin) |
---|
| 33 | |
---|
| 34 | % Begin initialization code - DO NOT EDIT |
---|
| 35 | gui_Singleton = 1; |
---|
| 36 | gui_State = struct('gui_Name', mfilename, ... |
---|
| 37 | 'gui_Singleton', gui_Singleton, ... |
---|
| 38 | 'gui_OpeningFcn', @series_OpeningFcn, ... |
---|
| 39 | 'gui_OutputFcn', @series_OutputFcn, ... |
---|
| 40 | 'gui_LayoutFcn', [] , ... |
---|
| 41 | 'gui_Callback', []); |
---|
| 42 | if nargin && ischar(varargin{1}) |
---|
| 43 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
| 44 | end |
---|
| 45 | |
---|
| 46 | if nargout |
---|
| 47 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
| 48 | else |
---|
| 49 | gui_mainfcn(gui_State, varargin{:}); |
---|
| 50 | end |
---|
| 51 | % End initialization code - DO NOT EDIT |
---|
| 52 | |
---|
| 53 | %-------------------------------------------------------------------------- |
---|
| 54 | % --- Executes just before series is made visible. |
---|
| 55 | %-------------------------------------------------------------------------- |
---|
| 56 | function series_OpeningFcn(hObject, eventdata, handles,param) |
---|
[29] | 57 | global nb_builtin |
---|
[2] | 58 | % Choose default command line output for series |
---|
| 59 | handles.output = hObject; |
---|
| 60 | % Update handles structure |
---|
| 61 | guidata(hObject, handles); |
---|
| 62 | %default initial parameters |
---|
| 63 | |
---|
| 64 | %load the list of previously browsed files in menus Open and Open_1 |
---|
| 65 | dir_perso=prefdir; |
---|
| 66 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
| 67 | if exist(profil_perso,'file') |
---|
| 68 | h=load (profil_perso); |
---|
| 69 | if isfield(h,'MenuFile_1') |
---|
| 70 | set(handles.MenuFile_1,'Label',h.MenuFile_1); |
---|
| 71 | set(handles.MenuFile_insert_1,'Label',h.MenuFile_1); |
---|
| 72 | end |
---|
| 73 | if isfield(h,'MenuFile_1') |
---|
| 74 | set(handles.MenuFile_2,'Label',h.MenuFile_2); |
---|
| 75 | set(handles.MenuFile_insert_2,'Label',h.MenuFile_2); |
---|
| 76 | end |
---|
| 77 | if isfield(h,'MenuFile_1') |
---|
| 78 | set(handles.MenuFile_3,'Label',h.MenuFile_3); |
---|
| 79 | set(handles.MenuFile_insert_3,'Label',h.MenuFile_3); |
---|
| 80 | end |
---|
| 81 | if isfield(h,'MenuFile_1') |
---|
| 82 | set(handles.MenuFile_4,'Label',h.MenuFile_4); |
---|
| 83 | set(handles.MenuFile_insert_4,'Label',h.MenuFile_4); |
---|
| 84 | end |
---|
| 85 | if isfield(h,'MenuFile_1') |
---|
| 86 | set(handles.MenuFile_5,'Label',h.MenuFile_5); |
---|
| 87 | set(handles.MenuFile_insert_5,'Label',h.MenuFile_5); |
---|
| 88 | end |
---|
| 89 | end |
---|
| 90 | |
---|
| 91 | %check default input data |
---|
| 92 | if ~exist('param','var') |
---|
| 93 | param=[]; %default |
---|
| 94 | end |
---|
| 95 | |
---|
| 96 | %file name and browser initialisation |
---|
| 97 | if isfield(param,'menu_coord_str') |
---|
| 98 | set(handles.CoordType,'String',param.menu_coord_str) |
---|
| 99 | end |
---|
| 100 | if isfield(param,'menu_coord_val') |
---|
| 101 | set(handles.CoordType,'Value',param.menu_coord_val); |
---|
| 102 | else |
---|
| 103 | set(handles.CoordType,'Value',1);%default |
---|
| 104 | end |
---|
| 105 | |
---|
| 106 | if isfield(param,'FileName') |
---|
| 107 | if isfield(param,'FileName_1') |
---|
| 108 | update_file(hObject, eventdata, handles,param.FileName_1,0) |
---|
| 109 | update_file(hObject, eventdata, handles,param.FileName,1) |
---|
| 110 | else |
---|
| 111 | update_file(hObject, eventdata, handles,param.FileName,0) |
---|
| 112 | end |
---|
| 113 | end |
---|
| 114 | |
---|
| 115 | %fields input initialisation |
---|
| 116 | if isfield(param,'list_fields')&& isfield(param,'index_fields') &&~isempty(param.list_fields) &&~isempty(param.index_fields) |
---|
| 117 | set(handles.FieldMenu,'String',param.list_fields);% list menu fields |
---|
| 118 | set(handles.FieldMenu,'Value',param.index_fields);% selected string index |
---|
| 119 | FieldCell{1}=param.list_fields{param.index_fields}; |
---|
| 120 | end |
---|
| 121 | if isfield(param,'civ1')&& islogical(param.civ1) && isfield(param,'civ2')&& islogical(param.civ2)&... |
---|
| 122 | isfield(param,'interp1')&& islogical(param.interp1)&&isfield(param,'interp2')&& islogical(param.interp2)&... |
---|
| 123 | isfield(param,'filter1')&& islogical(param.filter1)&&isfield(param,'filter2')&& islogical(param.filter2) |
---|
| 124 | set(handles.civ1,'Value',param.civ1); |
---|
| 125 | set(handles.civ2,'Value',param.civ1); |
---|
| 126 | set(handles.interp1,'Value',param.interp1); |
---|
| 127 | set(handles.interp2,'Value',param.interp2); |
---|
| 128 | set(handles.filter1,'Value',param.filter1); |
---|
| 129 | set(handles.filter2,'Value',param.filter2); |
---|
| 130 | end |
---|
| 131 | set(hObject,'WindowButtonUpFcn',{@mouse_up_gui,handles}) |
---|
| 132 | NomType_Callback(hObject, eventdata, handles) |
---|
| 133 | |
---|
| 134 | %loads the information stored in prefdir to initiate the browser and the list of functions |
---|
[26] | 135 | menu_str={'check_files';'aver_stat';'time_series';'merge_proj';'clean_civ_cmx'}; |
---|
[29] | 136 | nb_builtin=numel(menu_str); %number of functions |
---|
[26] | 137 | |
---|
| 138 | %remove from the list the last option 'more...' |
---|
| 139 | [path_series,name,ext]=fileparts(which('series')); |
---|
| 140 | path_series=fullfile(path_series,'/series');%path of the function 'series' |
---|
| 141 | |
---|
[2] | 142 | for ilist=1:length(menu_str) |
---|
| 143 | fct_path{ilist,1}=path_series;%paths of the fuctions buil-in in 'series.m' |
---|
| 144 | end |
---|
| 145 | dir_perso=prefdir; |
---|
| 146 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
| 147 | if exist(profil_perso,'file') |
---|
| 148 | h=load (profil_perso); |
---|
| 149 | if isfield(h,'series_fct') && iscell(h.series_fct) |
---|
| 150 | for ilist=1:length(h.series_fct) |
---|
| 151 | [path,file]=fileparts(h.series_fct{ilist}); |
---|
| 152 | fct_path=[fct_path; {path}];%concatene the list of paths |
---|
| 153 | menu_str=[menu_str; {file}]; |
---|
| 154 | end |
---|
| 155 | end |
---|
| 156 | end |
---|
[26] | 157 | |
---|
| 158 | menu_str=[menu_str;{'more...'}]; |
---|
| 159 | set(handles.ACTION,'String',menu_str) |
---|
[2] | 160 | set(handles.ACTION,'UserData',fct_path)% store the list of path in UserData of ACTION |
---|
| 161 | |
---|
| 162 | % display the GUI for the default action 'check_files' |
---|
| 163 | ACTION_Callback(hObject, eventdata, handles) |
---|
| 164 | |
---|
| 165 | %-------------------------------------------------------------- |
---|
| 166 | % --- Outputs from this function are returned to the command line. |
---|
| 167 | %----------------------------------------------------------------- |
---|
| 168 | function varargout = series_OutputFcn(hObject, eventdata, handles) |
---|
| 169 | % varargout cell array for returning output args (see VARARGOUT); |
---|
| 170 | % hObject handle to figure |
---|
| 171 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
| 172 | % handles structure with handles and user data (see GUIDATA) |
---|
| 173 | % Get default command line output from handles structure |
---|
| 174 | varargout{1} = handles.output; |
---|
| 175 | |
---|
| 176 | |
---|
| 177 | % -------------------------------------------------------------------- |
---|
| 178 | function MenuBrowse_Callback(hObject, eventdata, handles) |
---|
| 179 | |
---|
| 180 | RootPathCell=get(handles.RootPath,'String'); |
---|
| 181 | SubDirCell=get(handles.SubDir,'String'); |
---|
| 182 | RootFileCell=get(handles.RootFile,'String'); |
---|
| 183 | oldfile=''; %default |
---|
| 184 | if isempty(RootPathCell)|isequal(RootPathCell,{''})%loads the previously stored file name and set it as default in the file_input box |
---|
| 185 | dir_perso=prefdir; |
---|
| 186 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
| 187 | if exist(profil_perso,'file') |
---|
| 188 | h=load (profil_perso); |
---|
| 189 | if isfield(h,'filebase')&ischar(h.filebase) |
---|
| 190 | oldfile=h.filebase; |
---|
| 191 | end |
---|
| 192 | if isfield(h,'RootPath')&ischar(h.RootPath) |
---|
| 193 | oldfile=h.RootPath; |
---|
| 194 | end |
---|
| 195 | end |
---|
| 196 | else |
---|
| 197 | oldfile=fullfile(RootPathCell{1},SubDirCell{1},RootFileCell{1}); |
---|
| 198 | end |
---|
| 199 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
| 200 | {'*.xml;*.xls;*.png;*.tif;*.avi;*.AVI;*.nc', ' (*.xml,*.xls, *.png,*.tif, *.avi,*.nc)'; |
---|
| 201 | '*.xml', '.xml files '; ... |
---|
| 202 | '*.xls', '.xls files '; ... |
---|
| 203 | '*.png','.png image files'; ... |
---|
| 204 | '*.tif','.tif image files'; ... |
---|
| 205 | '*.avi;*.AVI','.avi movie files'; ... |
---|
| 206 | '*.nc','.netcdf files'; ... |
---|
| 207 | '*.*', 'All Files (*.*)'}, ... |
---|
| 208 | 'Pick a file',oldfile); |
---|
| 209 | fileinput=[PathName FileName];%complete file name |
---|
| 210 | testblank=findstr(fileinput,' ');%look for blanks |
---|
| 211 | if ~isempty(testblank) |
---|
| 212 | errordlg('forbidden input file name: contain blanks') |
---|
| 213 | return |
---|
| 214 | end |
---|
| 215 | sizf=size(fileinput); |
---|
| 216 | if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end |
---|
| 217 | [path,name,ext]=fileparts(fileinput); |
---|
| 218 | SeriesData=[];%dfault |
---|
| 219 | if isequal(ext,'.xml') |
---|
| 220 | errordlg('input file type not implemented')%A Faire: ouvrir le fichier pour naviguer |
---|
| 221 | elseif isequal(ext,'.xls') |
---|
| 222 | errordlg('input file type not implemented')%A Faire: ouvrir le fichier pour naviguer |
---|
| 223 | else |
---|
| 224 | update_file(hObject, eventdata, handles,fileinput,0) |
---|
| 225 | %update list of recent files in the menubar |
---|
| 226 | MenuFile_1=fileinput; |
---|
| 227 | MenuFile_2=get(handles.MenuFile_1,'Label'); |
---|
| 228 | MenuFile_3=get(handles.MenuFile_2,'Label'); |
---|
| 229 | MenuFile_4=get(handles.MenuFile_3,'Label'); |
---|
| 230 | MenuFile_5=get(handles.MenuFile_4,'Label'); |
---|
| 231 | set(handles.MenuFile_1,'Label',MenuFile_1) |
---|
| 232 | set(handles.MenuFile_2,'Label',MenuFile_2) |
---|
| 233 | set(handles.MenuFile_3,'Label',MenuFile_3) |
---|
| 234 | set(handles.MenuFile_4,'Label',MenuFile_4) |
---|
| 235 | set(handles.MenuFile_5,'Label',MenuFile_5) |
---|
| 236 | set(handles.MenuFile_insert_1,'Label',MenuFile_1) |
---|
| 237 | set(handles.MenuFile_insert_2,'Label',MenuFile_2) |
---|
| 238 | set(handles.MenuFile_insert_3,'Label',MenuFile_3) |
---|
| 239 | set(handles.MenuFile_insert_4,'Label',MenuFile_4) |
---|
| 240 | set(handles.MenuFile_insert_5,'Label',MenuFile_5) |
---|
| 241 | dir_perso=prefdir; |
---|
| 242 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
| 243 | if exist(profil_perso,'file') |
---|
| 244 | save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-append'); %store the file names for future opening of uvmat |
---|
| 245 | else |
---|
| 246 | txt=ver; |
---|
| 247 | Release=txt(1).Release; |
---|
| 248 | relnumb=str2num(Release(3:4)); |
---|
| 249 | if relnumb >= 14 |
---|
| 250 | save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-V6'); %store the file names for future opening of uvmat |
---|
| 251 | else |
---|
| 252 | save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5'); %store the file names for future opening of uvmat |
---|
| 253 | end |
---|
| 254 | end |
---|
| 255 | end |
---|
| 256 | % set(hseries,'UserData',SeriesData); |
---|
| 257 | % RootFile_Callback(hObject, eventdata, handles); |
---|
| 258 | % FileExt_Callback(hObject, eventdata, handles); |
---|
| 259 | % NomType_Callback(hObject, eventdata, handles) |
---|
| 260 | % mode_Callback(hObject, eventdata, handles) |
---|
| 261 | |
---|
| 262 | |
---|
| 263 | % -------------------------------------------------------------------- |
---|
| 264 | function MenuFile_1_Callback(hObject, eventdata, handles) |
---|
| 265 | fileinput=get(handles.MenuFile_1,'Label'); |
---|
| 266 | update_file(hObject, eventdata, handles,fileinput,0) |
---|
| 267 | |
---|
| 268 | % -------------------------------------------------------------------- |
---|
| 269 | function MenuFile_2_Callback(hObject, eventdata, handles) |
---|
| 270 | fileinput=get(handles.MenuFile_2,'Label'); |
---|
| 271 | update_file(hObject, eventdata, handles,fileinput,0) |
---|
| 272 | |
---|
| 273 | % -------------------------------------------------------------------- |
---|
| 274 | function MenuFile_3_Callback(hObject, eventdata, handles) |
---|
| 275 | fileinput=get(handles.MenuFile_3,'Label'); |
---|
| 276 | update_file(hObject, eventdata, handles,fileinput,0) |
---|
| 277 | |
---|
| 278 | % -------------------------------------------------------------------- |
---|
| 279 | function MenuFile_4_Callback(hObject, eventdata, handles) |
---|
| 280 | fileinput=get(handles.MenuFile_4,'Label'); |
---|
| 281 | update_file(hObject, eventdata, handles,fileinput,0) |
---|
| 282 | |
---|
| 283 | % -------------------------------------------------------------------- |
---|
| 284 | function MenuFile_5_Callback(hObject, eventdata, handles) |
---|
| 285 | fileinput=get(handles.MenuFile_5,'Label'); |
---|
| 286 | update_file(hObject, eventdata, handles,fileinput,0) |
---|
| 287 | |
---|
| 288 | % -------------------------------------------------------------------- |
---|
| 289 | function MenuBrowse_insert_Callback(hObject, eventdata, handles) |
---|
| 290 | |
---|
[29] | 291 | RootPathCell=get(handles.RootPath,'String'); |
---|
[2] | 292 | RootFileCell=get(handles.RootFile,'String'); |
---|
| 293 | oldfile=''; %default |
---|
| 294 | if isempty(RootPathCell)|isequal(RootPathCell,{''})%loads the previously stored file name and set it as default in the file_input box |
---|
| 295 | dir_perso=prefdir; |
---|
| 296 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
| 297 | if exist(profil_perso,'file') |
---|
| 298 | h=load (profil_perso); |
---|
| 299 | if isfield(h,'filebase')&ischar(h.filebase) |
---|
| 300 | oldfile=h.filebase; |
---|
| 301 | end |
---|
| 302 | if isfield(h,'RootPath')&ischar(h.RootPath) |
---|
| 303 | oldfile=h.RootPath; |
---|
| 304 | end |
---|
| 305 | end |
---|
| 306 | else |
---|
| 307 | oldfile=fullfile(RootPathCell{1},RootFileCell{1}); |
---|
| 308 | end |
---|
| 309 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
| 310 | {'*.xml;*.xls;*.png;*.avi;*.AVI;*.nc', ' (*.xml,*.xls, *.png, *.avi,*.nc)'; |
---|
| 311 | '*.xml', '.xml files '; ... |
---|
| 312 | '*.xls', '.xls files '; ... |
---|
| 313 | '*.png','.png image files'; ... |
---|
| 314 | '*.avi;*.AVI','.avi movie files'; ... |
---|
| 315 | '*.nc','.netcdf files'; ... |
---|
| 316 | '*.*', 'All Files (*.*)'}, ... |
---|
| 317 | 'Pick a file',oldfile); |
---|
| 318 | fileinput=[PathName FileName];%complete file name |
---|
| 319 | testblank=findstr(fileinput,' ');%look for blanks |
---|
| 320 | if ~isempty(testblank) |
---|
| 321 | errordlg('forbidden input file name: contain blanks') |
---|
| 322 | return |
---|
| 323 | end |
---|
| 324 | sizf=size(fileinput); |
---|
| 325 | if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end |
---|
| 326 | [path,name,ext]=fileparts(fileinput); |
---|
| 327 | SeriesData=[];%dfault |
---|
| 328 | if isequal(ext,'.xml') |
---|
| 329 | errordlg('input file type not implemented')%A Faire: ouvrir le fichier pour naviguer |
---|
| 330 | elseif isequal(ext,'.xls') |
---|
| 331 | errordlg('input file type not implemented')%A Faire: ouvrir le fichier pour naviguer |
---|
| 332 | else |
---|
| 333 | update_file(hObject, eventdata, handles,fileinput,1) |
---|
| 334 | %update list of recent files in the menubar |
---|
| 335 | MenuFile_1=fileinput; |
---|
| 336 | MenuFile_2=get(handles.MenuFile_1,'Label'); |
---|
| 337 | MenuFile_3=get(handles.MenuFile_2,'Label'); |
---|
| 338 | MenuFile_4=get(handles.MenuFile_3,'Label'); |
---|
| 339 | MenuFile_5=get(handles.MenuFile_4,'Label'); |
---|
| 340 | set(handles.MenuFile_1,'Label',MenuFile_1) |
---|
| 341 | set(handles.MenuFile_2,'Label',MenuFile_2) |
---|
| 342 | set(handles.MenuFile_3,'Label',MenuFile_3) |
---|
| 343 | set(handles.MenuFile_4,'Label',MenuFile_4) |
---|
| 344 | set(handles.MenuFile_5,'Label',MenuFile_5) |
---|
| 345 | set(handles.MenuFile_insert_1,'Label',MenuFile_1) |
---|
| 346 | set(handles.MenuFile_insert_2,'Label',MenuFile_2) |
---|
| 347 | set(handles.MenuFile_insert_3,'Label',MenuFile_3) |
---|
| 348 | set(handles.MenuFile_insert_4,'Label',MenuFile_4) |
---|
| 349 | set(handles.MenuFile_insert_5,'Label',MenuFile_5) |
---|
| 350 | dir_perso=prefdir; |
---|
| 351 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
| 352 | if exist(profil_perso,'file') |
---|
| 353 | save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-append'); %store the file names for future opening of uvmat |
---|
| 354 | else |
---|
| 355 | txt=ver; |
---|
| 356 | Release=txt(1).Release; |
---|
| 357 | relnumb=str2num(Release(3:4)); |
---|
| 358 | if relnumb >= 14 |
---|
| 359 | save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-V6'); %store the file names for future opening of uvmat |
---|
| 360 | else |
---|
| 361 | save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5'); %store the file names for future opening of uvmat |
---|
| 362 | end |
---|
| 363 | end |
---|
| 364 | end |
---|
| 365 | %------------------------------------------------ |
---|
| 366 | |
---|
| 367 | % -------------------------------------------------------------------- |
---|
| 368 | function MenuFile_insert_1_Callback(hObject, eventdata, handles) |
---|
| 369 | fileinput=get(handles.MenuFile_insert_1,'Label'); |
---|
| 370 | update_file(hObject, eventdata, handles,fileinput,1) |
---|
| 371 | |
---|
| 372 | % -------------------------------------------------------------------- |
---|
| 373 | function MenuFile_insert_2_Callback(hObject, eventdata, handles) |
---|
| 374 | fileinput=get(handles.MenuFile_insert_2,'Label'); |
---|
| 375 | update_file(hObject, eventdata, handles,fileinput,1) |
---|
| 376 | |
---|
| 377 | % -------------------------------------------------------------------- |
---|
| 378 | function MenuFile_insert_3_Callback(hObject, eventdata, handles) |
---|
| 379 | fileinput=get(handles.MenuFile_insert_3,'Label'); |
---|
| 380 | update_file(hObject, eventdata, handles,fileinput,1) |
---|
| 381 | |
---|
| 382 | % -------------------------------------------------------------------- |
---|
| 383 | function MenuFile_insert_4_Callback(hObject, eventdata, handles) |
---|
| 384 | fileinput=get(handles.MenuFile_insert_4,'Label'); |
---|
| 385 | update_file(hObject, eventdata, handles,fileinput,1) |
---|
| 386 | |
---|
| 387 | % -------------------------------------------------------------------- |
---|
| 388 | function MenuFile_insert_5_Callback(hObject, eventdata, handles) |
---|
| 389 | fileinput=get(handles.MenuFile_insert_5,'Label'); |
---|
| 390 | update_file(hObject, eventdata, handles,fileinput,1) |
---|
| 391 | |
---|
| 392 | % -------------------------------------------------------------------- |
---|
| 393 | % refresh the GUI data after introduction of a new file series |
---|
| 394 | function update_file(hObject, eventdata, handles,fileinput,addtest) |
---|
[29] | 395 | %hseries=get(handles.RootPath,'parent'); |
---|
| 396 | if ~exist(fileinput,'file') |
---|
| 397 | msgbox_uvmat('ERROR',['input file ' fileinput ' does not exist']) |
---|
| 398 | return |
---|
| 399 | end |
---|
| 400 | hseries=handles.figure1; |
---|
[2] | 401 | % refresh input root name, indices, file extension and nomenclature |
---|
| 402 | [RootPath,RootFile,field_count,str2,str_a,str_b,FileExt,NomType,SubDir]=name2display(fileinput); |
---|
| 403 | %check for movie image files |
---|
[29] | 404 | if ~isempty(FileExt) |
---|
[2] | 405 | if ~isempty(imformats(FileExt(2:end))) |
---|
| 406 | imainfo=imfinfo(fileinput); |
---|
| 407 | if length(imainfo) >1 %case of image with multiple frames |
---|
| 408 | NomType='*'; |
---|
| 409 | [RootPath,RootFile]=fileparts(fileinput); |
---|
| 410 | end |
---|
| 411 | end |
---|
[29] | 412 | end |
---|
[2] | 413 | NcType='none';%default |
---|
| 414 | if isequal(FileExt,'.nc') |
---|
| 415 | Data=nc2struct(fileinput,[]); |
---|
| 416 | if isfield(Data,'absolut_time_T0') |
---|
| 417 | NcType='civx'; % test for civx velocity fields |
---|
| 418 | end |
---|
| 419 | end |
---|
| 420 | |
---|
| 421 | set(handles.RootPath,'Value',1) |
---|
| 422 | set(handles.SubDir,'Value',1) |
---|
| 423 | set(handles.RootFile,'Value',1) |
---|
| 424 | set(handles.NomType,'Value',1) |
---|
| 425 | set(handles.FileExt,'Value',1) |
---|
| 426 | set(handles.nb_field,'Value',1) |
---|
| 427 | set(handles.nb_field2,'Value',1) |
---|
| 428 | if addtest |
---|
| 429 | SeriesData=get(hseries,'UserData'); |
---|
| 430 | SeriesData.displ_num=[0 0 0 0;SeriesData.displ_num]; |
---|
| 431 | SeriesData.CurrentInputFile_1=SeriesData.CurrentInputFile; |
---|
| 432 | RootPathCell=[{RootPath}; get(handles.RootPath,'String')] ; |
---|
| 433 | SubDirCell=[{SubDir}; get(handles.SubDir,'String')]; |
---|
| 434 | RootFileCell=[{RootFile}; get(handles.RootFile,'String')]; |
---|
| 435 | NomTypeCell=[{NomType}; SeriesData.NomType]; |
---|
| 436 | FileExtCell=[{FileExt}; get(handles.FileExt,'String')]; |
---|
| 437 | NcTypeCell=[{NcType};SeriesData.NcType]; |
---|
| 438 | set(handles.NomType,'String',[{};get(handles.NomType,'String')]) |
---|
| 439 | else |
---|
| 440 | SeriesData=[];%re-initialisation |
---|
| 441 | SeriesData.displ_num=[0 0 0 0]; |
---|
| 442 | RootPathCell={RootPath}; |
---|
| 443 | SubDirCell={SubDir}; |
---|
| 444 | RootFileCell={RootFile}; |
---|
| 445 | NomTypeCell={NomType}; |
---|
| 446 | FileExtCell={FileExt}; |
---|
| 447 | NcTypeCell={NcType}; |
---|
| 448 | end |
---|
| 449 | |
---|
| 450 | SeriesData.NomType=NomTypeCell; |
---|
| 451 | SeriesData.NcType=NcTypeCell; |
---|
| 452 | SeriesData.CurrentInputFile=fileinput; |
---|
| 453 | set(handles.RootPath,'String',RootPathCell); |
---|
| 454 | set(handles.SubDir,'String',SubDirCell); |
---|
| 455 | set(handles.RootFile,'String',RootFileCell); |
---|
| 456 | set(handles.NomType,'String',NomTypeCell); |
---|
| 457 | set(handles.FileExt,'String',FileExtCell); |
---|
| 458 | |
---|
| 459 | %determine field indices |
---|
| 460 | ref_i=1; %default ref_i is a reference frame index used to find existing pairs from PIV |
---|
| 461 | if ~isempty(str2num(field_count)) |
---|
| 462 | ref_i=str2num(field_count); |
---|
| 463 | if ~isempty(str2num(str2)) |
---|
| 464 | ref_i=floor((ref_i+str2num(str2))/2);% reference image number corresponding to the file |
---|
| 465 | SeriesData.browse_Di=str2num(str2)-str2num(field_count); |
---|
| 466 | end |
---|
| 467 | end |
---|
| 468 | set(handles.ref_i,'String',num2str(ref_i)); |
---|
| 469 | set(handles.first_i,'String',num2str(ref_i)); |
---|
| 470 | set(handles.last_i,'String',num2str(ref_i)); |
---|
| 471 | ref_j=1; %default ref_j is a reference frame index used to find existing pairs from PIV |
---|
| 472 | if ~isempty(str2num(str_a)) |
---|
| 473 | ref_j=str2num(str_a); |
---|
| 474 | if ~isempty(str2num(str_b)) |
---|
| 475 | ref_j=floor((str2num(str_a)+str2num(str_b))/2); |
---|
| 476 | SeriesData.browse_Dj=str2num(str_b)-str2num(str_a); |
---|
| 477 | end |
---|
| 478 | end |
---|
| 479 | set(handles.ref_j,'String',num2str(ref_j)); |
---|
| 480 | set(handles.first_j,'String',num2str(ref_j)) |
---|
| 481 | set(handles.last_j,'String',num2str(ref_j)); |
---|
| 482 | %set(hseries,'UserData',SeriesData); |
---|
| 483 | |
---|
| 484 | %enable other menus and uicontrols |
---|
| 485 | set(handles.MenuOpen_insert,'Enable','on') |
---|
| 486 | set(handles.MenuFile_insert_1,'Enable','on') |
---|
| 487 | set(handles.MenuFile_insert_2,'Enable','on') |
---|
| 488 | set(handles.MenuFile_insert_3,'Enable','on') |
---|
| 489 | set(handles.MenuFile_insert_4,'Enable','on') |
---|
| 490 | set(handles.MenuFile_insert_5,'Enable','on') |
---|
| 491 | set(handles.RUN, 'Enable','On') |
---|
| 492 | set(handles.RUN,'BackgroundColor',[1 0 0])% set RUN button to red |
---|
| 493 | set(handles.RootPath,'BackgroundColor',[1 1 0]) % set RootPath edit box to yellow |
---|
| 494 | drawnow |
---|
| 495 | |
---|
| 496 | TimeUnit=''; %default |
---|
| 497 | time=[];%default |
---|
| 498 | GeometryCalib=[];%default |
---|
| 499 | nb_field=[];%default |
---|
| 500 | nb_field2=[];%default |
---|
| 501 | SeriesData.PathCampaign=get(handles.PathCampaign,'String'); |
---|
| 502 | |
---|
| 503 | % read timing and total frame number from the current file (movie files) !! may be overrid by xml file |
---|
| 504 | FileBase=fullfile(RootPath,RootFile); |
---|
| 505 | |
---|
| 506 | % nb_field{icell,1}='?';%default |
---|
| 507 | % nb_field2{icell,1}='?';%default |
---|
| 508 | testima=0; %test for image input |
---|
| 509 | if isequal(lower(FileExt),'.avi') %.avi file |
---|
| 510 | testima=1; |
---|
| 511 | info=aviinfo([FileBase FileExt]); |
---|
| 512 | time=[0:1/info.FramesPerSecond:(info.NumFrames-1)/info.FramesPerSecond]'; |
---|
| 513 | nb_field=info.NumFrames; |
---|
| 514 | nb_field2=1; |
---|
| 515 | elseif ~isempty(imformats(FileExt(2:end))) |
---|
| 516 | testima=1; |
---|
| 517 | if isequal(NomType,'*')% multi-frame image |
---|
| 518 | imainfo=imfinfo([FileBase FileExt]); |
---|
| 519 | if length(imainfo) >1 %case of image with multiple frames |
---|
| 520 | nb_field=length(imainfo); |
---|
| 521 | nb_field2=1; |
---|
| 522 | end |
---|
| 523 | end |
---|
| 524 | elseif isequal(FileExt,'.vol') |
---|
| 525 | testima=1; |
---|
| 526 | end |
---|
| 527 | |
---|
| 528 | % enable field and veltype menus |
---|
| 529 | testfield=isequal(get(handles.FieldMenu,'enable'),'on'); |
---|
| 530 | testfield_1=isequal(get(handles.FieldMenu_1,'enable'),'on'); |
---|
| 531 | testveltype=isequal(get(handles.VelTypeMenu,'enable'),'on'); |
---|
| 532 | testveltype_1=isequal(get(handles.VelTypeMenu_1,'enable'),'on'); |
---|
| 533 | testtransform=isequal(get(handles.CoordType,'Enable'),'on'); |
---|
| 534 | testnc=0; |
---|
| 535 | testnc_1=0; |
---|
| 536 | testcivx=0; |
---|
| 537 | testcivx_1=0; |
---|
| 538 | if length(FileExtCell)==1 || length(FileExtCell)>2 |
---|
| 539 | for iview=1:length(FileExtCell) |
---|
| 540 | if isequal(FileExtCell{iview},'.nc') |
---|
| 541 | testnc=1; |
---|
| 542 | end |
---|
| 543 | if isequal(NcTypeCell{iview},'civx') |
---|
| 544 | testcivx=1; |
---|
| 545 | end |
---|
| 546 | end |
---|
| 547 | elseif length(FileExtCell)==2 |
---|
| 548 | testnc=isequal(FileExtCell{1},'.nc'); |
---|
| 549 | testnc_1=isequal(FileExtCell{2},'.nc'); |
---|
| 550 | testcivx=isequal(NcTypeCell{1},'civx'); |
---|
| 551 | testcivx_1=isequal(NcTypeCell{2},'civx'); |
---|
| 552 | end |
---|
| 553 | if testfield && testnc |
---|
| 554 | view_FieldMenu(handles,'on') |
---|
| 555 | if testcivx |
---|
| 556 | menustr=get(handles.FieldMenu,'String'); |
---|
| 557 | if isequal(menustr,{'get_field...'}) |
---|
| 558 | set(handles.FieldMenu,'String',{'get_field...';'velocity';'vort';'div';'more...'}) |
---|
| 559 | end |
---|
| 560 | else |
---|
| 561 | set(handles.FieldMenu,'Value',1) |
---|
| 562 | set(handles.FieldMenu,'String',{'get_field...'}) |
---|
| 563 | end |
---|
| 564 | else |
---|
| 565 | view_FieldMenu(handles,'off') |
---|
| 566 | end |
---|
| 567 | if testfield_1 && testnc_1 |
---|
| 568 | view_FieldMenu_1(handles,'on') |
---|
| 569 | if testcivx_1 |
---|
| 570 | menustr=get(handles.FieldMenu_1,'String'); |
---|
| 571 | if isequal(menustr,{'get_field...'}) |
---|
| 572 | set(handles.FieldMenu_1,'String',{'get_field...';'velocity';'vort';'div';'more...'}) |
---|
| 573 | end |
---|
| 574 | else |
---|
| 575 | set(handles.FieldMenu_1,'Value',1) |
---|
| 576 | set(handles.FieldMenu_1,'String',{'get_field...'}) |
---|
| 577 | end |
---|
| 578 | else |
---|
| 579 | view_FieldMenu_1(handles,'off') |
---|
| 580 | end |
---|
| 581 | if testveltype && testcivx |
---|
| 582 | set(handles.VelTypeMenu,'Visible','on') |
---|
| 583 | set(handles.VelType_text,'Visible','on'); |
---|
| 584 | else |
---|
| 585 | set(handles.VelTypeMenu,'Visible','off') |
---|
| 586 | set(handles.VelType_text,'Visible','off'); |
---|
| 587 | end |
---|
| 588 | if testveltype_1 && testcivx_1 |
---|
| 589 | set(handles.VelTypeMenu_1,'Visible','on') |
---|
| 590 | set(handles.VelType_text_1,'Visible','on'); |
---|
| 591 | else |
---|
| 592 | set(handles.VelTypeMenu_1,'Visible','off') |
---|
| 593 | set(handles.VelType_text_1,'Visible','off'); |
---|
| 594 | end |
---|
| 595 | if testtransform && (testcivx || testima) |
---|
| 596 | view_TRANSFORM(handles,'on') |
---|
| 597 | else |
---|
| 598 | view_TRANSFORM(handles,'off') |
---|
| 599 | end |
---|
| 600 | if ~isequal(FileExt,'.nc') && ~isequal(FileExt,'.cdf') && ~testima |
---|
| 601 | msgbox_uvmat('ERROR',['invalid input file extension ' FileExt]) |
---|
| 602 | return |
---|
| 603 | end |
---|
| 604 | |
---|
| 605 | %%%%%%%% read image documentation file if found%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
| 606 | %look for the file existence |
---|
| 607 | ext_imadoc=''; |
---|
| 608 | if isequal(FileExt,'.xml')||isequal(FileExt,'.civ') |
---|
| 609 | ext_imadoc=FileExt; |
---|
| 610 | elseif exist([FileBase '.xml'],'file') |
---|
| 611 | ext_imadoc='.xml'; |
---|
| 612 | elseif exist([FileBase '.civ'],'file') |
---|
| 613 | ext_imadoc='.civ'; |
---|
| 614 | end |
---|
| 615 | %read the ImaDoc file |
---|
| 616 | % mode=''; %default |
---|
| 617 | % testheading=0; |
---|
| 618 | XmlData=[]; |
---|
| 619 | NbSlice_calib={}; |
---|
| 620 | if isequal(ext_imadoc,'.xml') |
---|
| 621 | [XmlData,warntext]=imadoc2struct([FileBase '.xml']); |
---|
| 622 | if isfield(XmlData,'Heading') && isfield(XmlData.Heading,'ImageName') |
---|
| 623 | [PP,FF,ext_ima_read]=fileparts(XmlData.Heading.ImageName); |
---|
| 624 | end |
---|
| 625 | if isfield(XmlData,'Time') |
---|
| 626 | time=XmlData.Time; |
---|
| 627 | end |
---|
| 628 | if isfield(XmlData,'Camera') |
---|
| 629 | if isfield(XmlData.Camera,'NbSlice')&& ~isempty(XmlData.Camera.NbSlice) |
---|
| 630 | NbSlice_calib{iview}=XmlData.Camera.NbSlice;% Nbre of slices for Zindex in phys transform |
---|
| 631 | if ~isequal(NbSlice_calib{iview},NbSlice_calib{1}) |
---|
| 632 | msgbox_uvmat('WARNING','inconsistent number of Z indices for the two field series'); |
---|
| 633 | end |
---|
| 634 | end |
---|
| 635 | if isfield(XmlData.Camera,'TimeUnit')&& ~isempty(XmlData.Camera.TimeUnit) |
---|
| 636 | TimeUnit=XmlData.Camera.TimeUnit; |
---|
| 637 | end |
---|
| 638 | end |
---|
| 639 | if ~isempty(warntext) |
---|
| 640 | msgbox_uvmat('WARNING',warntext) |
---|
| 641 | end |
---|
| 642 | elseif isequal(ext_imadoc,'.civ') |
---|
| 643 | [error,XmlData.Time,TimeUnit,mode,npx,npy,pxcmx,pxcmy]=read_imatext([FileBase '.civ']); |
---|
| 644 | time=XmlData.Time; |
---|
| 645 | size(time) |
---|
| 646 | GeometryCalib.R=[pxcmx 0 0; 0 pxcmy 0;0 0 0]; |
---|
| 647 | GeometryCalib.Tx=0; |
---|
| 648 | GeometryCalib.Ty=0; |
---|
| 649 | GeometryCalib.Tz=1; |
---|
| 650 | GeometryCalib.dpx=1; |
---|
| 651 | GeometryCalib.dpy=1; |
---|
| 652 | GeometryCalib.sx=1; |
---|
| 653 | GeometryCalib.Cx=0; |
---|
| 654 | GeometryCalib.Cy=0; |
---|
| 655 | GeometryCalib.f=1; |
---|
| 656 | GeometryCalib.kappa1=0; |
---|
| 657 | GeometryCalib.CoordUnit='cm'; |
---|
| 658 | XmlData.GeometryCalib=GeometryCalib; |
---|
| 659 | if error==2, warntext=['no file ' FileBase '.civ']; |
---|
| 660 | elseif error==1, warntext='inconsistent number of fields in the .civ file'; |
---|
| 661 | end |
---|
| 662 | % set(handles.npx,'String',num2str(npx));%fills nbre of pixels x box |
---|
| 663 | % set(handles.npy,'String',num2str(npy));%fills nbre of pixels y box |
---|
| 664 | % set(handles.pxcm,'String',num2str(pxcmx));%fills scale x (pixel/cm) box |
---|
| 665 | % set(handles.pycm,'String',num2str(pxcmy));%fills scale y (pixel/cm) box |
---|
| 666 | % set(handles.pxcm,'Visible','on');%fills scale x (pixel/cm) box |
---|
| 667 | % set(handles.pycm,'Visible','on');%fills scale y (pixel/cm) box |
---|
| 668 | % set(handles.view_xml,'Visible','on') |
---|
| 669 | % set(handles.view_xml,'String','view .civ') |
---|
| 670 | end |
---|
| 671 | if addtest |
---|
| 672 | SeriesData.Time=[{time} SeriesData.Time]; |
---|
| 673 | else |
---|
| 674 | SeriesData.Time={time}; |
---|
| 675 | end |
---|
| 676 | |
---|
| 677 | if ~isempty(time) |
---|
| 678 | siztime=size(time); |
---|
| 679 | nb_field=siztime(1); |
---|
| 680 | nb_field2=siztime(2); |
---|
| 681 | end |
---|
| 682 | set(handles.TimeUnit,'String',TimeUnit) |
---|
| 683 | if isempty(nb_field) |
---|
| 684 | nb_field_str='?'; |
---|
| 685 | nb_field_str2='?'; |
---|
| 686 | else |
---|
| 687 | nb_field_str=num2str(nb_field); |
---|
| 688 | nb_field_str2=num2str(nb_field2); |
---|
| 689 | end |
---|
| 690 | if addtest |
---|
| 691 | nb_field_cell=[{nb_field_str} ;get(handles.nb_field,'String')]; |
---|
| 692 | nb_field2_cell=[{nb_field_str2} ;get(handles.nb_field2,'String')]; |
---|
| 693 | else |
---|
| 694 | nb_field_cell={nb_field_str}; |
---|
| 695 | nb_field2_cell={nb_field_str2}; |
---|
| 696 | end |
---|
| 697 | set(handles.nb_field,'String',nb_field_cell); |
---|
| 698 | set(handles.nb_field2,'String',nb_field2_cell); |
---|
| 699 | set(hseries,'UserData',SeriesData); |
---|
| 700 | |
---|
| 701 | %number of slices |
---|
| 702 | if isfield(XmlData,'GeometryCalib') && isfield(XmlData.GeometryCalib,'SliceCoord') |
---|
| 703 | siz=size(XmlData.GeometryCalib.SliceCoord); |
---|
| 704 | if siz(1)>1 |
---|
| 705 | NbSlice=siz(1); |
---|
| 706 | else |
---|
| 707 | NbSlice=1; |
---|
| 708 | end |
---|
| 709 | set(handles.NbSlice,'String',num2str(NbSlice)) |
---|
| 710 | end |
---|
| 711 | |
---|
| 712 | % set menus of index pairs |
---|
| 713 | NomType_Callback(hObject, eventdata, handles) |
---|
| 714 | |
---|
| 715 | dir_perso=prefdir; |
---|
| 716 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
| 717 | % save(profil_perso, 'FileBase'); %store the root name for future opening of uvmat |
---|
| 718 | if exist(profil_perso,'file') |
---|
| 719 | save (profil_perso,'RootPath','SubDir','RootFile','NomType', '-append'); %store the root name for future opening of uvmat |
---|
| 720 | else |
---|
| 721 | txt=ver; |
---|
| 722 | Release=txt(1).Release; |
---|
| 723 | relnumb=str2num(Release(3:4)); |
---|
| 724 | if relnumb >= 14 |
---|
| 725 | save (profil_perso,'RootPath','SubDir','RootFile','NomType','-V6') %store the root name for future opening of uvmat |
---|
| 726 | else |
---|
| 727 | save(profil_perso,'RootPath','SubDir','RootFile','NomType') |
---|
| 728 | end |
---|
| 729 | end |
---|
| 730 | set(handles.RootPath,'BackgroundColor',[1 1 1]) |
---|
| 731 | set(handles.PathCampaign,'String',SeriesData.PathCampaign) |
---|
| 732 | last_j_Callback(hObject, eventdata, handles) |
---|
| 733 | last_i_Callback(hObject, eventdata, handles) |
---|
| 734 | |
---|
| 735 | %------------------------------------------------------------ |
---|
| 736 | function RootPath_Callback(hObject, eventdata, handles) |
---|
| 737 | Val=get(handles.RootPath,'Value'); |
---|
| 738 | synchronise_view(handles,Val) |
---|
| 739 | NomType_Callback(hObject, eventdata, handles) |
---|
| 740 | %------------------------------------------------------------ |
---|
| 741 | |
---|
| 742 | function synchronise_view(handles,Val) |
---|
| 743 | set(handles.RootPath,'Value',Val) |
---|
| 744 | set(handles.SubDir,'Value',Val) |
---|
| 745 | set(handles.RootFile,'Value',Val) |
---|
| 746 | set(handles.NomType,'Value',Val) |
---|
| 747 | set(handles.FileExt,'Value',Val) |
---|
| 748 | set(handles.nb_field,'Value',Val) |
---|
| 749 | set(handles.nb_field2,'Value',Val) |
---|
| 750 | set(handles.time_first,'Value',Val) |
---|
| 751 | set(handles.time_last,'Value',Val) |
---|
| 752 | |
---|
| 753 | |
---|
| 754 | %--------------------------------------------------------- |
---|
| 755 | % Executes on carriage return on the subdir civ1 edit window |
---|
| 756 | %-------------------------------------------------------- |
---|
| 757 | function SubDir_Callback(hObject, eventdata, handles) |
---|
| 758 | |
---|
| 759 | Val=get(handles.SubDir,'Value'); |
---|
| 760 | synchronise_view(handles,Val) |
---|
| 761 | NomType_Callback(hObject, eventdata, handles) |
---|
| 762 | |
---|
| 763 | %-------------------------------------------------------------- |
---|
| 764 | %function activated when a new filebase (image series) is introduced |
---|
| 765 | %------------------------------------------------------------ |
---|
| 766 | function RootFile_Callback(hObject, eventdata, handles) |
---|
| 767 | Val=get(handles.RootFile,'Value'); |
---|
| 768 | synchronise_view(handles,Val) |
---|
| 769 | NomType_Callback(hObject, eventdata, handles) |
---|
| 770 | |
---|
| 771 | %-------------------------------------------------------------- |
---|
| 772 | %function activated when a new filebase (image series) is introduced |
---|
| 773 | %------------------------------------------------------------ |
---|
| 774 | function FileExt_Callback(hObject, eventdata, handles) |
---|
| 775 | Val=get(handles.FileExt,'Value'); |
---|
| 776 | synchronise_view(handles,Val) |
---|
| 777 | |
---|
| 778 | %-------------------------------------------------------------- |
---|
| 779 | %function activated when a new filebase (image series) is introduced |
---|
| 780 | %------------------------------------------------------------ |
---|
| 781 | function nb_field_Callback(hObject, eventdata, handles) |
---|
| 782 | Val=get(handles.nb_field,'Value'); |
---|
| 783 | synchronise_view(handles,Val) |
---|
| 784 | |
---|
| 785 | %-------------------------------------------------------------- |
---|
| 786 | %function activated when a new filebase (image series) is introduced |
---|
| 787 | %------------------------------------------------------------ |
---|
| 788 | function nb_field2_Callback(hObject, eventdata, handles) |
---|
| 789 | Val=get(handles.nb_field2,'Value'); |
---|
| 790 | synchronise_view(handles,Val) |
---|
| 791 | |
---|
| 792 | %-------------------------------------------------------------- |
---|
| 793 | %function activated when a new filebase (image series) is introduced |
---|
| 794 | %------------------------------------------------------------ |
---|
| 795 | function time_first_Callback(hObject, eventdata, handles) |
---|
| 796 | Val=get(handles.time_first,'Value'); |
---|
| 797 | synchronise_view(handles,Val) |
---|
| 798 | |
---|
| 799 | %-------------------------------------------------------------- |
---|
| 800 | %function activated when a new filebase (image series) is introduced |
---|
| 801 | %------------------------------------------------------------ |
---|
| 802 | function time_last_Callback(hObject, eventdata, handles) |
---|
| 803 | Val=get(handles.time_last,'Value'); |
---|
| 804 | synchronise_view(handles,Val) |
---|
| 805 | |
---|
| 806 | %-------------------------------------------------------------- |
---|
| 807 | %function activated by NomType |
---|
| 808 | %------------------------------------------------------------ |
---|
| 809 | NomType_Callback(hObject, eventdata, handles) |
---|
| 810 | |
---|
| 811 | function NomType_Callback(hObject, eventdata, handles) |
---|
| 812 | hseries=get(handles.ProjObject,'Parent'); |
---|
| 813 | SeriesData=get(hseries,'UserData'); |
---|
| 814 | if isfield(SeriesData,'NomType') |
---|
| 815 | NomTypeCell=SeriesData.NomType; |
---|
| 816 | else |
---|
| 817 | NomTypeCell={}; |
---|
| 818 | end |
---|
| 819 | nbfield2_cell=get(handles.nb_field2,'String'); |
---|
| 820 | val=get(handles.nb_field2,'Value'); |
---|
| 821 | if iscell(nbfield2_cell) |
---|
| 822 | nbfield2=str2num(nbfield2_cell{val}); |
---|
| 823 | else |
---|
| 824 | nbfield2=str2num(nbfield2_cell); |
---|
| 825 | end |
---|
| 826 | nbfield_cell=get(handles.nb_field,'String'); |
---|
| 827 | if iscell(nbfield_cell) |
---|
| 828 | nbfield=str2num(nbfield_cell{val}); |
---|
| 829 | else |
---|
| 830 | nbfield=str2num(nbfield_cell); |
---|
| 831 | end |
---|
| 832 | |
---|
| 833 | set(handles.mode,'Visible','off') % do not show index pairs by default |
---|
| 834 | set(handles.list_pair_civ,'Visible','off') |
---|
| 835 | set(handles.ref_i,'Visible','off') |
---|
| 836 | set(handles.ref_i_text,'Visible','off') |
---|
| 837 | testpair=0; |
---|
| 838 | state_j='off'; |
---|
| 839 | %set the menus of image pairs and default selection for series |
---|
| 840 | %list pairs if relevant |
---|
| 841 | Val=get(handles.NomType,'Value'); |
---|
| 842 | synchronise_view(handles,Val) |
---|
| 843 | if ~isempty(NomTypeCell) |
---|
| 844 | NomType=NomTypeCell{Val}; |
---|
| 845 | switch NomType |
---|
| 846 | case {'_i1-i2_j', '_i1-i2'} |
---|
| 847 | set(handles.mode,'String',{'series(Di)'}) |
---|
| 848 | set(handles.mode,'Value',1); |
---|
| 849 | set(handles.mode,'Visible','on') |
---|
| 850 | testpair=1; |
---|
| 851 | case {'#_ab'} |
---|
| 852 | set(handles.mode,'String',{'bursts'}) |
---|
| 853 | set(handles.mode,'Value',1); |
---|
| 854 | testpair=1; |
---|
| 855 | case '_i_j1-j2' |
---|
| 856 | set(handles.mode,'String',{'bursts';'series(Dj)'})%multiple choice |
---|
| 857 | if ~isempty(nbfield) && ~isempty(nbfield2) && ((nbfield2>10) || (nbfield==1)) |
---|
| 858 | set(handles.mode,'Value',2); |
---|
| 859 | else |
---|
| 860 | set(handles.mode,'Value',1);% advice 'bursts' for small bursts |
---|
| 861 | end |
---|
| 862 | set(handles.mode,'Visible','on') |
---|
| 863 | testpair=1; |
---|
| 864 | end |
---|
| 865 | switch NomType |
---|
| 866 | case {'_i_j','_i_j1-j2','_i1-i2_j','#_ab'},% two navigation indices |
---|
| 867 | state_j='on'; |
---|
| 868 | end |
---|
| 869 | end |
---|
| 870 | if testpair |
---|
| 871 | mode_Callback(hObject, eventdata, handles) |
---|
| 872 | else |
---|
| 873 | set(handles.NomType,'String',NomTypeCell) |
---|
| 874 | end |
---|
| 875 | set(handles.first_j,'Visible',state_j) |
---|
| 876 | set(handles.incr_j,'Visible',state_j) |
---|
| 877 | set(handles.last_j,'Visible',state_j) |
---|
| 878 | set(handles.nb_field2,'Visible',state_j) |
---|
| 879 | |
---|
| 880 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%???????????? |
---|
| 881 | % --- Executes on button press in mode. |
---|
| 882 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
| 883 | function mode_Callback(hObject, eventdata, handles) |
---|
[29] | 884 | %hseries=get(handles.mode,'parent'); |
---|
| 885 | hseries=handles.figure1; |
---|
[2] | 886 | SeriesData=get(hseries,'UserData'); |
---|
| 887 | mode_list=get(handles.mode,'String'); |
---|
| 888 | mode_value=get(handles.mode,'Value'); |
---|
| 889 | mode=mode_list{mode_value}; |
---|
| 890 | NomType=[]; |
---|
| 891 | test_find_pair=0; |
---|
| 892 | if isfield(SeriesData,'NomType') |
---|
| 893 | NomTypeCell=SeriesData.NomType; |
---|
| 894 | Val=get(handles.NomType,'Value'); |
---|
| 895 | NomType=NomTypeCell{Val}; |
---|
| 896 | test_find_pair=isequal(NomType,'_i_j1-j2')|| isequal(NomType,'_i1-i2_j')|| isequal(NomType,'_i1-i2')|| isequal(NomType,'#_ab'); |
---|
| 897 | end |
---|
| 898 | % displ_num=[];%default |
---|
| 899 | % first_i=str2num(get(handles.first_i,'String')); |
---|
| 900 | % last_i=str2num(get(handles.last_i,'String')); |
---|
| 901 | time=[]; |
---|
| 902 | if isfield(SeriesData,'Time') |
---|
| 903 | time=SeriesData.Time{1}; %get the set of times |
---|
| 904 | end |
---|
| 905 | siztime=size(time); |
---|
| 906 | nbfield=siztime(1); |
---|
| 907 | nbfield2=siztime(2); |
---|
| 908 | indchosen=1; %%first pair selected by default |
---|
| 909 | if isequal(mode,'bursts') |
---|
| 910 | enable_i(handles,'On') |
---|
| 911 | enable_j(handles,'Off') |
---|
| 912 | elseif isequal(NomType,'_i_j1-j2')|| isequal(NomType,'_i1-i2_j') |
---|
| 913 | enable_i(handles,'On') |
---|
| 914 | enable_j(handles,'On') |
---|
| 915 | else |
---|
| 916 | enable_i(handles,'On') |
---|
| 917 | enable_j(handles,'Off') |
---|
| 918 | end |
---|
| 919 | |
---|
| 920 | |
---|
| 921 | % elseif isequal(mode,'series(Dj)') |
---|
| 922 | % enable_j(handles,'On') |
---|
| 923 | % if nbfield==1 |
---|
| 924 | % enable_i(handles,'Off') |
---|
| 925 | % else |
---|
| 926 | % enable_i(handles,'On') |
---|
| 927 | % end |
---|
| 928 | % elseif isequal(mode,'series(Di)') |
---|
| 929 | % if nbfield2 > 1 |
---|
| 930 | % enable_j(handles,'On') |
---|
| 931 | % else |
---|
| 932 | % enable_j(handles,'Off') |
---|
| 933 | % end |
---|
| 934 | % end |
---|
| 935 | set(handles.list_pair_civ,'Value',indchosen);%set the default choice of image pairs for civ1 |
---|
| 936 | % SetSeries.displ_num=displ_num; |
---|
| 937 | set(hseries,'UserData',SeriesData) |
---|
| 938 | |
---|
| 939 | %list pairs if relevant |
---|
| 940 | if test_find_pair |
---|
| 941 | find_netcpair_civ(hObject, eventdata, handles,Val) |
---|
| 942 | end |
---|
| 943 | |
---|
| 944 | %------------------------------------- |
---|
| 945 | function enable_i(handles,state) |
---|
| 946 | set(handles.i_txt,'Visible',state) |
---|
| 947 | set(handles.first_i,'Visible',state) |
---|
| 948 | set(handles.last_i,'Visible',state) |
---|
| 949 | set(handles.incr_i,'Visible',state) |
---|
| 950 | set(handles.nb_field,'Visible',state) |
---|
| 951 | set(handles.ref_i,'Visible',state) |
---|
| 952 | set(handles.ref_i_text,'Visible',state) |
---|
| 953 | |
---|
| 954 | %----------------------------------- |
---|
| 955 | function enable_j(handles,state) |
---|
| 956 | set(handles.j_txt,'Visible',state) |
---|
| 957 | set(handles.first_j,'Visible',state) |
---|
| 958 | set(handles.last_j,'Visible',state) |
---|
| 959 | set(handles.incr_j,'Visible',state) |
---|
| 960 | set(handles.nb_field2,'Visible',state) |
---|
| 961 | set(handles.ref_j,'Visible',state) |
---|
| 962 | set(handles.ref_j_text,'Visible',state) |
---|
| 963 | |
---|
| 964 | %----------------------------------- |
---|
| 965 | function view_FieldMenu(handles,state) |
---|
| 966 | set(handles.FieldMenu,'Visible',state) |
---|
| 967 | set(handles.Field_text,'Visible',state) |
---|
| 968 | set(handles.Field_frame,'Visible',state) |
---|
| 969 | |
---|
| 970 | %----------------------------------- |
---|
| 971 | function view_FieldMenu_1(handles,state) |
---|
| 972 | set(handles.FieldMenu_1,'Visible',state) |
---|
| 973 | set(handles.Field_text_1,'Visible',state) |
---|
| 974 | |
---|
| 975 | %----------------------------------- |
---|
| 976 | function view_TRANSFORM(handles,state) |
---|
| 977 | set(handles.TRANSFORM_frame,'Visible',state) |
---|
| 978 | set(handles.CoordType,'Visible',state); |
---|
| 979 | set(handles.TRANSFORM_title,'Visible',state) |
---|
| 980 | |
---|
| 981 | %-------------------------------------------------------------- |
---|
| 982 | % determine the menu for civ1 pairs depending on existing netcdf file at the middle of |
---|
| 983 | % the field series set by first_i, incr, last_i |
---|
| 984 | %---------------------------------------------------------------- |
---|
| 985 | function find_netcpair_civ(hObject, eventdata, handles,Val) |
---|
[29] | 986 | %hseries=get(handles.list_pair_civ,'parent'); |
---|
| 987 | SeriesData=get(handles.figure1,'UserData'); |
---|
[2] | 988 | % NomTypeCell=get(handles.NomType,'String'); |
---|
| 989 | NomTypeCell=SeriesData.NomType; |
---|
| 990 | NomType=NomTypeCell{Val}; |
---|
| 991 | set(handles.list_pair_civ,'Visible','on') |
---|
| 992 | %nomenclature types |
---|
| 993 | RootPathCell=get(handles.RootPath,'String'); |
---|
| 994 | filepath=RootPathCell{Val}; |
---|
| 995 | RootFileCell=get(handles.RootFile,'String'); |
---|
| 996 | filename=RootFileCell{Val}; |
---|
| 997 | filebase=fullfile(filepath,filename); |
---|
| 998 | SubDirCell=get(handles.SubDir,'String'); |
---|
| 999 | subdir=SubDirCell{Val}; |
---|
| 1000 | if ~exist(fullfile(filepath,subdir),'dir') |
---|
| 1001 | msgbox_uvmat('ERROR',['no civ file available: subdirectory ' subdir ' does not exist']) |
---|
| 1002 | set(handles.list_pair_civ,'String',{''}); |
---|
| 1003 | return |
---|
| 1004 | end |
---|
| 1005 | mode_list=get(handles.mode,'String'); |
---|
| 1006 | mode_value=get(handles.mode,'Value'); |
---|
| 1007 | mode=mode_list{mode_value}; |
---|
| 1008 | |
---|
| 1009 | %reads image numbers from the interface |
---|
| 1010 | ref_i=str2num(get(handles.ref_i,'String')); |
---|
| 1011 | ref_j=str2num(get(handles.ref_j,'String')); |
---|
| 1012 | % time=[]; |
---|
| 1013 | % ref_time=[]; |
---|
| 1014 | ref_time=0; |
---|
| 1015 | if isfield(SeriesData,'Time')&~isempty(SeriesData.Time{Val})&~isequal(SeriesData.Time{Val},0) |
---|
| 1016 | time=SeriesData.Time{Val}; %get the set of times |
---|
| 1017 | siztime=size(time); |
---|
| 1018 | nbfield=siztime(1); |
---|
| 1019 | nbfield2=siztime(2); |
---|
| 1020 | % test_imadoc=1; |
---|
| 1021 | else |
---|
| 1022 | % test_imadoc=0;%no image documentation file |
---|
| 1023 | nbfield=50; |
---|
| 1024 | nbfield2=50;%default max number of pairs |
---|
| 1025 | end |
---|
| 1026 | %look for existing processed pairs involving the field at the middle of the series if civ1 will not |
---|
| 1027 | % be performed, while the result is needed for next steps. |
---|
| 1028 | displ_pair={''}; |
---|
| 1029 | displ_num=[]; |
---|
| 1030 | ind_exist=0; |
---|
| 1031 | TimeUnit=get(handles.TimeUnit,'String'); |
---|
| 1032 | if length(TimeUnit)>=1 |
---|
| 1033 | dtunit=['m' TimeUnit]; |
---|
| 1034 | else |
---|
| 1035 | dtunit='e-03'; |
---|
| 1036 | end |
---|
| 1037 | if isequal(mode,'series(Di)') |
---|
| 1038 | for index=1:min(nbfield-1,50) |
---|
| 1039 | filename=name_generator(filebase,ref_i-floor(index/2),ref_j,'.nc',NomType,1,ref_i+ceil(index/2),ref_j,subdir); |
---|
| 1040 | select=(exist(filename,'file')==2); |
---|
| 1041 | if select==1 |
---|
| 1042 | ind_exist=ind_exist+1; |
---|
| 1043 | displ_num(1,ind_exist)=0; |
---|
| 1044 | displ_num(2,ind_exist)=0; |
---|
| 1045 | displ_num(3,ind_exist)=-floor(index/2); |
---|
| 1046 | displ_num(4,ind_exist)=ceil(index/2); |
---|
| 1047 | %[cte_detect,vdt,cte_read]=read_netcdf(filename,{'dt','dt2','absolut_time_T0','absolute_time_TO_2'}); |
---|
| 1048 | [Cte,var_detect,ichoice]=nc2struct(filename,{}); |
---|
| 1049 | if isfield(Cte,'dt2') |
---|
| 1050 | dt=Cte.dt2; |
---|
| 1051 | elseif isfield(Cte,'dt') |
---|
| 1052 | dt=Cte.dt; |
---|
| 1053 | end |
---|
| 1054 | if isfield(Cte,'absolut_time_TO_2') |
---|
| 1055 | ref_time(ind_exist)=Cte.absolut_time_TO_2;%civ2 data used in priority |
---|
| 1056 | elseif isfield(Cte,'absolut_time_TO') |
---|
| 1057 | ref_time(ind_exist)=Cte.absolut_time_TO;%civ2 data used in priorit |
---|
| 1058 | elseif isfield(Cte,'Time') |
---|
| 1059 | ref_time(ind_exist)=Cte.Time; |
---|
| 1060 | end |
---|
| 1061 | displ_pair{ind_exist}=['Di= ' num2str(-floor(index/2)) '|' num2str(ceil(index/2)) ' :dt= ' num2str(dt*1000) dtunit]; |
---|
| 1062 | end |
---|
| 1063 | end |
---|
| 1064 | set(handles.list_pair_civ,'String',[displ_pair';{'Di=*|*'}]); |
---|
| 1065 | elseif isequal(mode,'series(Dj)')% series on the j index |
---|
| 1066 | for index=1:min(nbfield2-1,50) |
---|
| 1067 | filename=name_generator(filebase,ref_i,ref_j-floor(index/2),'.nc',NomType,1,ref_i,ref_j+ceil(index/2),subdir); |
---|
| 1068 | select=(exist(filename,'file')==2); |
---|
| 1069 | if select==1 |
---|
| 1070 | ind_exist=ind_exist+1; |
---|
| 1071 | displ_num(1,ind_exist)=-floor(index/2); |
---|
| 1072 | displ_num(2,ind_exist)=ceil(index/2); |
---|
| 1073 | displ_num(3,ind_exist)=0; |
---|
| 1074 | displ_num(4,ind_exist)=0; |
---|
| 1075 | %[cte_detect,vdt,cte_read]=read_netcdf(filename,{'dt','dt2','absolut_time_T0','absolute_time_TO_2'}); |
---|
| 1076 | [Cte,var_detect,ichoice]=nc2struct(nc,{}); |
---|
| 1077 | if isfield(Cte,'dt2') |
---|
| 1078 | dt=Cte.dt2; |
---|
| 1079 | elseif isfield(Cte,'dt') |
---|
| 1080 | dt=Cte.dt; |
---|
| 1081 | end |
---|
| 1082 | if isfield(Cte,'absolut_time_TO_2') |
---|
| 1083 | ref_time(ind_exist)=Cte.absolut_time_TO_2;%civ2 data used in priority |
---|
| 1084 | elseif isfield(Cte,'absolut_time_TO') |
---|
| 1085 | ref_time(ind_exist)=Cte.absolut_time_TO;%civ2 data used in priorit |
---|
| 1086 | elseif isfield(Cte,'Time') |
---|
| 1087 | ref_time(ind_exist)=Cte.Time; |
---|
| 1088 | end |
---|
| 1089 | % if cte_detect(2)==1; |
---|
| 1090 | % dt=cte_read(2); |
---|
| 1091 | % ref_time(ind_exist)=cte_read(4);%civ2 data used in priority |
---|
| 1092 | % else |
---|
| 1093 | % dt=cte_read(1); |
---|
| 1094 | % ref_time(ind_exist)=cte_read(3); |
---|
| 1095 | % end |
---|
| 1096 | displ_pair{ind_exist}=['Dj= ' num2str(-floor(index/2)) '|' num2str(ceil(index/2)) ' :dt= ' num2str(dt*1000) dtunit]; |
---|
| 1097 | end |
---|
| 1098 | end |
---|
| 1099 | set(handles.list_pair_civ,'String',[displ_pair';{'Dj=*|*'}]); |
---|
| 1100 | elseif isequal(mode,'bursts') %case of bursts |
---|
| 1101 | for numod_a=1:nbfield2-1 %nbfield2 always >=2 for 'bursts' mode |
---|
| 1102 | for numod_b=(numod_a+1):nbfield2 |
---|
| 1103 | [filename]=name_generator(filebase,ref_i,numod_a,'.nc',NomType,1,ref_i,numod_b,subdir); |
---|
| 1104 | select=(exist(filename,'file')==2); |
---|
| 1105 | if select==1 |
---|
| 1106 | ind_exist=ind_exist+1; |
---|
| 1107 | numlist_a(ind_exist)=numod_a; |
---|
| 1108 | numlist_b(ind_exist)=numod_b; |
---|
| 1109 | Attr=nc2struct(filename,[]); |
---|
| 1110 | isfield(Attr,'absolut_time_T0_2') |
---|
| 1111 | if isfield(Attr,'dt2') |
---|
| 1112 | dt(ind_exist)=Attr.dt2; |
---|
| 1113 | ref_time(ind_exist)=Attr.absolut_time_T0_2; |
---|
| 1114 | elseif isfield(Attr,'dt')& isfield(Attr,'absolut_time_T0') |
---|
| 1115 | dt(ind_exist)=Attr.dt; |
---|
| 1116 | ref_time(ind_exist)=Attr.absolut_time_T0; |
---|
| 1117 | else |
---|
| 1118 | dt(ind_exist)=NaN;%no information on dt |
---|
| 1119 | end |
---|
| 1120 | %determine nom_type_ima for pair display (used in num2stra.m) |
---|
| 1121 | switch NomType |
---|
| 1122 | case {'#ab'} |
---|
| 1123 | nom_type_ima='#a'; |
---|
| 1124 | case {'#AB'} |
---|
| 1125 | nom_type_ima='#A'; |
---|
| 1126 | otherwise |
---|
| 1127 | nom_type_ima='_i_j'; |
---|
| 1128 | end |
---|
| 1129 | displ_pair{ind_exist}=['j= ' num2stra(numod_a,nom_type_ima,2) '-' num2stra(numod_b,nom_type_ima,2) ... |
---|
| 1130 | ' :dt= ' num2str(dt(ind_exist)*1000)]; |
---|
| 1131 | end |
---|
| 1132 | end |
---|
| 1133 | set(handles.list_pair_civ,'String',[displ_pair';{'j=*-*'}]); |
---|
| 1134 | end |
---|
| 1135 | if exist('dt','var') & ~isempty(dt) |
---|
| 1136 | [dtsort,indsort]=sort(dt); |
---|
| 1137 | displ_num(1,:)=numlist_a(indsort); |
---|
| 1138 | displ_num(2,:)=numlist_b(indsort); |
---|
| 1139 | displ_num(3,:)=0; |
---|
| 1140 | displ_num(4,:)=0; |
---|
| 1141 | displ_pair=displ_pair(indsort); |
---|
| 1142 | ref_time=ref_time(indsort); |
---|
| 1143 | end |
---|
| 1144 | end |
---|
| 1145 | if ind_exist==0 |
---|
| 1146 | if isequal(mode,'series(Dj)') | isequal(mode,'st_series(Dj)') |
---|
| 1147 | msgbox_uvmat('ERROR',['no .nc file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir]) |
---|
| 1148 | else |
---|
| 1149 | msgbox_uvmat('ERROR',['no .nc file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir]) |
---|
| 1150 | end |
---|
| 1151 | if isequal(mode,'bursts') %case of bursts |
---|
| 1152 | set(handles.list_pair_civ,'String',{'j=*-*'}); |
---|
| 1153 | elseif isequal(mode,'series(Di)') %case of bursts |
---|
| 1154 | set(handles.list_pair_civ,'String',{'Di=*|*'}); |
---|
| 1155 | elseif isequal(mode,'series(Dj)') %case of bursts |
---|
| 1156 | set(handles.list_pair_civ,'String',{'Dj=*|*'}); |
---|
| 1157 | end |
---|
| 1158 | end |
---|
| 1159 | |
---|
| 1160 | val=get(handles.list_pair_civ,'Value'); |
---|
| 1161 | if val > length(displ_pair) |
---|
| 1162 | set(handles.list_pair_civ,'Value',1);% first pair proposed by default in the menu |
---|
| 1163 | val=1; |
---|
| 1164 | end |
---|
| 1165 | iview=get(handles.NomType,'Value'); |
---|
| 1166 | SeriesData.displ_num(iview,:)=(displ_num(:,val))'; |
---|
| 1167 | SeriesData.ref_time=ref_time; |
---|
[29] | 1168 | set(handles.figure1,'UserData',SeriesData) |
---|
[2] | 1169 | list_pair_civ_Callback(hObject, eventdata, handles) |
---|
| 1170 | |
---|
| 1171 | %------------------------------------------------------------- |
---|
| 1172 | % --- Executes on selection in list_pair_civ. |
---|
| 1173 | function list_pair_civ_Callback(hObject, eventdata, handles) |
---|
| 1174 | %------------------------------------------------------------ |
---|
| 1175 | |
---|
| 1176 | %update first_i and last_i according to the chosen image pairs |
---|
| 1177 | testupdate=0; |
---|
| 1178 | Val=get(handles.RootPath,'Value'); |
---|
| 1179 | IndexCell=get(handles.NomType,'String'); |
---|
[29] | 1180 | %hseries=get(handles.list_pair_civ,'parent'); |
---|
| 1181 | SeriesData=get(handles.figure1,'UserData'); |
---|
[2] | 1182 | NomType=SeriesData.NomType{Val}; |
---|
| 1183 | list_pair=get(handles.list_pair_civ,'String');%get the menu of image pairs |
---|
| 1184 | index_pair=get(handles.list_pair_civ,'Value'); |
---|
| 1185 | str_pair=list_pair{index_pair}; |
---|
| 1186 | ind_equ=strfind(str_pair,'=');%find '=' |
---|
| 1187 | ind_sep=strfind(str_pair,'|');%find pair separator '|' |
---|
| 1188 | ind_com=strfind(str_pair,':');%find ':' |
---|
| 1189 | test_bursts=0; |
---|
| 1190 | if isempty(ind_sep) |
---|
| 1191 | ind_sep=strfind(str_pair,'-');%find pair separator if it is not '|' |
---|
| 1192 | test_bursts=1;% we are in the case of bursts |
---|
| 1193 | end |
---|
| 1194 | displ_num=[0 0 0 0]; %default |
---|
| 1195 | if ~isempty(ind_sep)&& ~strcmp(str_pair(ind_sep-1),'*')% if there is a pair separator ('|' or '-') |
---|
| 1196 | num1_str=str_pair(ind_equ(1)+1:ind_sep-1); |
---|
| 1197 | num2_str=str_pair(ind_sep+1:ind_com-1); |
---|
| 1198 | num1=str2double(num1_str); |
---|
| 1199 | num2=str2double(num2_str); |
---|
| 1200 | if isequal(num1_str(1),' ') |
---|
| 1201 | num1_str(1)=[]; |
---|
| 1202 | end |
---|
| 1203 | if isequal(num2_str(end),' ') |
---|
| 1204 | num2_str(end)=[]; |
---|
| 1205 | end |
---|
| 1206 | switch NomType |
---|
| 1207 | case {'_i1-i2_j'} |
---|
| 1208 | if isequal(num1_str(1),'0') |
---|
| 1209 | IndexCell{Val}=['_(i-(i+' num2_str ')_j']; |
---|
| 1210 | else |
---|
| 1211 | IndexCell{Val}=['_(i' num1_str ')-(i+' num2_str ')_j']; |
---|
| 1212 | end |
---|
| 1213 | displ_num(3)=num1; |
---|
| 1214 | displ_num(4)=num2; |
---|
| 1215 | case {'_i1-i2'} |
---|
| 1216 | if isequal(num1_str(1),'0') |
---|
| 1217 | IndexCell{Val}=['_(i' num1_str ')-(i+' num2_str ')']; |
---|
| 1218 | else |
---|
| 1219 | IndexCell{Val}=['_(i' num1_str ')-(i+' num2_str ')']; |
---|
| 1220 | end |
---|
| 1221 | displ_num(3)=num1; |
---|
| 1222 | displ_num(4)=num2; |
---|
| 1223 | case '_i_j1-j2' |
---|
| 1224 | if test_bursts |
---|
| 1225 | IndexCell{Val}=['_i_' num1_str '-' num2_str ]; |
---|
| 1226 | else |
---|
| 1227 | if isequal(num1_str(1),'0') |
---|
| 1228 | IndexCell{Val}=['_i_j-(j+' num2_str ')']; |
---|
| 1229 | else |
---|
| 1230 | IndexCell{Val}=['_i_(j' num1_str ')-(j+' num2_str ')']; |
---|
| 1231 | end |
---|
| 1232 | end |
---|
| 1233 | displ_num(1)=num1; |
---|
| 1234 | displ_num(2)=num2; |
---|
| 1235 | case {'#_ab'} %TO COMPLETE |
---|
| 1236 | IndexCell{Val}=['_i_' num1_str '-' num2_str ]; |
---|
| 1237 | |
---|
| 1238 | end |
---|
| 1239 | end |
---|
| 1240 | set(handles.NomType,'String',IndexCell) |
---|
| 1241 | SeriesData.displ_num(Val,:)=displ_num; |
---|
[29] | 1242 | set(handles.figure1,'UserData',SeriesData) |
---|
[2] | 1243 | % set(handles.NomType,'Value',Val) |
---|
| 1244 | |
---|
| 1245 | if ~isequal(str_pair,'Dj=*|*')&~isequal(str_pair,'Di=*|*') |
---|
| 1246 | mode_list=get(handles.mode,'String'); |
---|
| 1247 | mode_value=get(handles.mode,'Value'); |
---|
| 1248 | mode=mode_list{mode_value}; |
---|
| 1249 | if isequal(mode,'series(Di)') |
---|
| 1250 | first_i=str2num(get(handles.first_i,'String')); |
---|
| 1251 | last_i=str2num(get(handles.last_i,'String')); |
---|
| 1252 | incr_i=str2num(get(handles.incr_i,'String')); |
---|
| 1253 | num1=first_i:incr_i:last_i; |
---|
| 1254 | lastfieldCell=get(handles.nb_field,'String'); |
---|
| 1255 | lastfield=str2num(lastfieldCell{1}); |
---|
| 1256 | if ~isempty(lastfield) |
---|
| 1257 | ind=find((num1-floor(index_pair/2)*ones(size(num1))>0)& (num1+ceil(index_pair/2)*ones(size(num1))<=lastfield)); |
---|
| 1258 | num1=num1(ind); |
---|
| 1259 | end |
---|
| 1260 | set(handles.first_i,'String',num2str(num1(1))); |
---|
| 1261 | set(handles.last_i,'String',num2str(num1(end))); |
---|
| 1262 | testupdate=1; |
---|
| 1263 | elseif isequal(mode,'series(Dj)') |
---|
| 1264 | first_j=str2num(get(handles.first_j,'String')); |
---|
| 1265 | last_j=str2num(get(handles.last_j,'String')); |
---|
| 1266 | incr_j=str2num(get(handles.incr_j,'String')); |
---|
| 1267 | num_j=first_j:incr_j:last_j; |
---|
| 1268 | lastfieldCell=get(handles.nb_field2,'String'); |
---|
| 1269 | if ~isempty(lastfieldCell) |
---|
| 1270 | lastfield2=lastfieldCell{1}; |
---|
| 1271 | ind=find((num_j-floor(index_pair/2)*ones(size(num_j))>0)& ... |
---|
| 1272 | (num_j+ceil(index_pair/2)*ones(size(num_j))<=lastfield2)); |
---|
| 1273 | end |
---|
| 1274 | testupdate=1; |
---|
| 1275 | end |
---|
| 1276 | |
---|
| 1277 | %update the first and last times of the series |
---|
| 1278 | if testupdate & isfield(SeriesData,'Time') |
---|
| 1279 | if ~isempty(SeriesData.Time{1}) |
---|
| 1280 | displ_time(handles,SeriesData.Time{1}); |
---|
| 1281 | end |
---|
| 1282 | end |
---|
| 1283 | end |
---|
| 1284 | %--------------------------------------------------- |
---|
| 1285 | % --- Executes on button press in RUN. |
---|
| 1286 | %------------------------------------------------------ |
---|
| 1287 | function RUN_Callback(hObject, eventdata, handles) |
---|
| 1288 | |
---|
| 1289 | %read root name and field type |
---|
| 1290 | set(handles.RUN,'BusyAction','queue'); |
---|
[29] | 1291 | %hseries=get(handles.RUN,'parent'); |
---|
| 1292 | set(0,'CurrentFigure',handles.figure1) |
---|
[2] | 1293 | if isequal(get(handles.GetObject,'Value'),1) |
---|
| 1294 | Series.GetObject=1; |
---|
| 1295 | GetObject_Callback(hObject, eventdata, handles) |
---|
| 1296 | else |
---|
| 1297 | Series.GetObject=0; |
---|
| 1298 | end |
---|
[29] | 1299 | SeriesData=get(handles.figure1,'UserData'); |
---|
[2] | 1300 | if isfield(SeriesData,'sethandles') |
---|
| 1301 | if iscell(SeriesData.sethandles) |
---|
| 1302 | Series.sethandles=SeriesData.sethandles{1}; |
---|
| 1303 | else |
---|
| 1304 | Series.sethandles=SeriesData.sethandles;%retrieve the handles of the set_object interface (to define projection objects) |
---|
| 1305 | end |
---|
| 1306 | end |
---|
| 1307 | |
---|
| 1308 | %reinitiate waitbar position |
---|
| 1309 | Series.WaitbarPos=get(handles.waitbar_frame,'Position');%TO SUPPRESS |
---|
| 1310 | waitbarpos=Series.WaitbarPos; |
---|
| 1311 | waitbarpos(4)=0.005;%reinitialize waitbar to zero height |
---|
| 1312 | waitbarpos(2)=Series.WaitbarPos(2)+Series.WaitbarPos(4)-0.005; |
---|
| 1313 | set(handles.waitbar,'Position',waitbarpos) |
---|
| 1314 | |
---|
| 1315 | % read input file parameters and set menus |
---|
| 1316 | Series.PathProject=get(handles.PathCampaign,'String'); |
---|
| 1317 | RootPath=get(handles.RootPath,'String');% path of the root name of the first field series |
---|
| 1318 | RootFile=get(handles.RootFile,'String');% root name of the first field series |
---|
| 1319 | SubDir=get(handles.SubDir,'String');% subdirectory for netcdf files |
---|
| 1320 | FileExt=get(handles.FileExt,'String');%file extension |
---|
| 1321 | if isempty(SeriesData) |
---|
| 1322 | msgbox_uvmat('ERROR','no input file series') |
---|
| 1323 | return |
---|
| 1324 | end |
---|
| 1325 | NomType=SeriesData.NomType; |
---|
| 1326 | if length(RootPath)==1 %string character input for user fct |
---|
| 1327 | Series.RootPath=RootPath{1}; |
---|
| 1328 | Series.RootFile=RootFile{1}; |
---|
| 1329 | Series.SubDir=SubDir{1}; |
---|
| 1330 | Series.FileExt=FileExt{1}; |
---|
| 1331 | Series.NomType=NomType{1}; |
---|
| 1332 | else %cell input for user fct |
---|
| 1333 | Series.RootPath=RootPath; |
---|
| 1334 | Series.RootFile=RootFile; |
---|
| 1335 | Series.SubDir=SubDir; |
---|
| 1336 | Series.FileExt=FileExt; |
---|
| 1337 | Series.NomType=NomType; |
---|
| 1338 | end |
---|
| 1339 | if isequal(get(handles.FieldMenu,'Visible'),'on') |
---|
| 1340 | FieldMenu=get(handles.FieldMenu,'String'); |
---|
| 1341 | FieldValue=get(handles.FieldMenu,'Value'); |
---|
| 1342 | Series.Field=FieldMenu(FieldValue); |
---|
| 1343 | end |
---|
| 1344 | menu_coord_state=get(handles.CoordType,'Visible'); |
---|
| 1345 | Series.CoordType='';%default |
---|
| 1346 | if isequal(menu_coord_state,'on') |
---|
| 1347 | menu_coord=get(handles.CoordType,'String'); |
---|
| 1348 | menu_index=get(handles.CoordType,'Value'); |
---|
| 1349 | Series.CoordType=menu_coord{menu_index}; |
---|
| 1350 | end |
---|
| 1351 | Series.hseries=get(hObject,'Parent'); |
---|
| 1352 | if isequal(get(handles.ParamVal,'Visible'),'on') |
---|
| 1353 | ParamKey=get(handles.ParamKey,'String'); |
---|
| 1354 | if ischar(ParamKey) |
---|
| 1355 | ParamKey{1}=ParamKey; |
---|
| 1356 | end |
---|
| 1357 | ParamString=get(handles.ParamVal,'String'); |
---|
| 1358 | if ischar(ParamString) |
---|
| 1359 | for ilist=1:size(ParamString,1) |
---|
| 1360 | ParamVal{ilist}=ParamString(ilist,:); |
---|
| 1361 | end |
---|
| 1362 | else |
---|
| 1363 | ParamVal=ParamString; |
---|
| 1364 | end |
---|
| 1365 | end |
---|
| 1366 | |
---|
| 1367 | %read the set of field numbers |
---|
| 1368 | first_i=str2num(get(handles.first_i,'String')); |
---|
| 1369 | last_i=str2num(get(handles.last_i,'String')); |
---|
| 1370 | incr_i=str2num(get(handles.incr_i,'String')); |
---|
| 1371 | first_j=str2num(get(handles.first_j,'String')); |
---|
| 1372 | last_j=str2num(get(handles.last_j,'String')); |
---|
| 1373 | incr_j=str2num(get(handles.incr_j,'String')); |
---|
| 1374 | if ~isequal(get(handles.first_i,'Visible'),'on') |
---|
| 1375 | first_i=1; |
---|
| 1376 | last_i=1; |
---|
| 1377 | incr_i=1; |
---|
| 1378 | end |
---|
| 1379 | if ~isequal(get(handles.first_j,'Visible'),'on') |
---|
| 1380 | first_j=1; |
---|
| 1381 | last_j=1; |
---|
| 1382 | incr_j=1; |
---|
| 1383 | end |
---|
| 1384 | Series.NbSlice=str2num(get(handles.NbSlice,'String')); |
---|
| 1385 | if isequal(first_i,[])|isequal(first_j,[]), msgbox_uvmat('ERROR','first field number not defined'),... |
---|
| 1386 | set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end; |
---|
| 1387 | if isequal(last_i,[])| isequal(last_j,[]),msgbox_uvmat('ERROR','last field number not defined'),... |
---|
| 1388 | set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end; |
---|
| 1389 | if isequal(incr_i,[])| isequal(incr_j,[]),msgbox_uvmat('ERROR','increment in field number not defined'),... |
---|
| 1390 | set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end; |
---|
| 1391 | if last_i < first_i | last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),... |
---|
| 1392 | set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end; |
---|
| 1393 | num_i=[first_i:incr_i:last_i]; |
---|
| 1394 | num_j=[first_j:incr_j:last_j]; |
---|
| 1395 | nbfield_cell=get(handles.nb_field,'String'); |
---|
| 1396 | nbfield=[]; %default |
---|
| 1397 | for iview=1:length(nbfield_cell) |
---|
| 1398 | nb=str2num(nbfield_cell{iview}); |
---|
| 1399 | if ~isempty(nb) |
---|
| 1400 | nbfield=[nbfield nb]; |
---|
| 1401 | end |
---|
| 1402 | end |
---|
| 1403 | nbfield=min(nbfield); |
---|
| 1404 | nbfield2_cell=get(handles.nb_field2,'String'); |
---|
| 1405 | nbfield2=[]; %default |
---|
| 1406 | for iview=1:length(nbfield2_cell) |
---|
| 1407 | nb=str2num(nbfield2_cell{iview}); |
---|
| 1408 | if ~isempty(nb) |
---|
| 1409 | nbfield2=[nbfield2 nb]; |
---|
| 1410 | end |
---|
| 1411 | end |
---|
| 1412 | nbfield2=min(nbfield2); |
---|
| 1413 | |
---|
| 1414 | %get complementary information from the 'series' interface |
---|
| 1415 | list_action=get(handles.ACTION,'String');% list menu action |
---|
| 1416 | index_action=get(handles.ACTION,'Value');% selected string index |
---|
| 1417 | action= list_action{index_action}; % selected string |
---|
| 1418 | mode_list=get(handles.mode,'String'); |
---|
| 1419 | index_mode=get(handles.mode,'Value'); |
---|
| 1420 | mode=mode_list{index_mode}; |
---|
| 1421 | ind_shift=0;%default |
---|
| 1422 | |
---|
| 1423 | %determine the list of input file names |
---|
| 1424 | nbmissing=0; |
---|
| 1425 | for iview=1:length(RootPath) |
---|
| 1426 | %case of pairs (.nc files) |
---|
| 1427 | |
---|
| 1428 | if isequal(NomType{iview},'_i_j1-j2')| isequal(NomType{iview},'_i1-i2_j')| isequal(NomType{iview},'_i1-i2')| isequal(NomType{iview},'#_ab') |
---|
| 1429 | ind_shift=SeriesData.displ_num(iview,:); |
---|
| 1430 | if isequal(ind_shift,[0 0 0 0]) % undefined pairs |
---|
| 1431 | if isequal(NomType{iview},'#_ab') |
---|
| 1432 | mode='#_ab'; |
---|
| 1433 | end |
---|
| 1434 | [num_i1,num_i2,num_j1,num_j2,nbmissing]=netseries_generator(fullfile(RootPath{iview},RootFile{iview}),SubDir{iview},mode,first_i,incr_i,last_i,first_j,incr_j,last_j); |
---|
| 1435 | else |
---|
| 1436 | [num_i1,num_i2,num_j1,num_j2,num_i,num_j]=find_file_indices(num_i,num_j,ind_shift,NomType{iview},mode); |
---|
| 1437 | if isempty(num_i) |
---|
| 1438 | msgbox_uvmat('ERROR','ERROR: empty set of input files chosen') |
---|
| 1439 | return |
---|
| 1440 | end |
---|
| 1441 | if num_i(1)>first_i |
---|
| 1442 | set(handles.first_i,'String',num2str(num_i(1)))%update the display of first field |
---|
| 1443 | last_i_Callback(hObject, eventdata, handles) |
---|
| 1444 | end |
---|
| 1445 | if num_i(end)<last_i |
---|
| 1446 | set(handles.last_i,'String',num2str(num_i(end)))%update the display of last field |
---|
| 1447 | last_i_Callback(hObject, eventdata, handles) |
---|
| 1448 | end |
---|
| 1449 | if num_j(1)>first_j |
---|
| 1450 | set(handles.first_j,'String',num2str(num_j(1)))%update the display of first field |
---|
| 1451 | last_j_Callback(hObject, eventdata, handles) |
---|
| 1452 | end |
---|
| 1453 | if num_j(end)<last_j |
---|
| 1454 | set(handles.last_j,'String',num2str(num_j(end)))%update the display of last field |
---|
| 1455 | last_j_Callback(hObject, eventdata, handles) |
---|
| 1456 | end |
---|
| 1457 | end |
---|
| 1458 | else%case of images |
---|
| 1459 | [num_i1,num_j1]=meshgrid(num_i,num_j); |
---|
| 1460 | num_i2=num_i1; |
---|
| 1461 | num_j2=num_j1; |
---|
| 1462 | end |
---|
| 1463 | if length(RootPath)>1 |
---|
| 1464 | num_i1_cell{iview}=num_i1; |
---|
| 1465 | num_i2_cell{iview}=num_i2; |
---|
| 1466 | num_j1_cell{iview}=num_j1; |
---|
| 1467 | num_j2_cell{iview}=num_j2; |
---|
| 1468 | end |
---|
| 1469 | end |
---|
| 1470 | |
---|
| 1471 | % RUN RUN' |
---|
| 1472 | path_series=which('series'); |
---|
| 1473 | list_path=get(handles.ACTION,'UserData'); |
---|
| 1474 | index=get(handles.ACTION,'Value'); |
---|
| 1475 | fct_path=list_path{index}; %path stored for the function ACTION |
---|
| 1476 | if ~isequal(fct_path,path_series) |
---|
| 1477 | eval(['spath=which(''' action ''');']) %spath = current path of the selected function ACTION |
---|
| 1478 | if ~isequal(spath,fct_path)& exist(fct_path,'dir') |
---|
| 1479 | addpath(fct_path)% add the prescribed path if not the current one |
---|
| 1480 | end |
---|
| 1481 | end |
---|
[26] | 1482 | % fct_path |
---|
[29] | 1483 | eval(['h_fun=@' action ';']) |
---|
[26] | 1484 | if ~isequal(fct_path,path_series) |
---|
| 1485 | rmpath(fct_path)% add the prescribed path if not the current one |
---|
| 1486 | end |
---|
| 1487 | |
---|
[2] | 1488 | Series.Action=action;%name of the processing programme |
---|
| 1489 | set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) |
---|
| 1490 | drawnow |
---|
| 1491 | if length(RootPath)>1 |
---|
[26] | 1492 | % feval(action,num_i1_cell,num_i2_cell,num_j1_cell,num_j2_cell,Series); |
---|
| 1493 | h_fun(num_i1_cell,num_i2_cell,num_j1_cell,num_j2_cell,Series); |
---|
[2] | 1494 | else |
---|
[26] | 1495 | h_fun(num_i1,num_i2,num_j1,num_j2,Series); |
---|
| 1496 | % feval(action,num_i1,num_i2,num_j1,num_j2,Series); |
---|
[2] | 1497 | end |
---|
| 1498 | set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
| 1499 | |
---|
| 1500 | % %save the current interface setting as figure namefig, append .0 to the name if it already exists |
---|
| 1501 | % detect=1; |
---|
| 1502 | % while detect==1 |
---|
| 1503 | % namefigfull=[namedoc '.fig']; |
---|
| 1504 | % hh=dir(namefigfull); |
---|
| 1505 | % if ~isempty(hh) |
---|
| 1506 | % detect=1; |
---|
| 1507 | % namedoc=[namedoc '.0']; |
---|
| 1508 | % else |
---|
| 1509 | % detect=0; |
---|
| 1510 | % end |
---|
| 1511 | % end |
---|
| 1512 | % saveas(gcbf,namefigfull);%save the interface with name namefigfull (A CHANGER EN FICHIER .xml) |
---|
| 1513 | |
---|
| 1514 | %---------------------------------------------------- |
---|
| 1515 | function STOP_Callback(hObject, eventdata, handles) |
---|
| 1516 | set(handles.RUN, 'BusyAction','cancel') |
---|
| 1517 | set(handles.RUN,'BackgroundColor',[1 0 0]) |
---|
| 1518 | |
---|
| 1519 | %---------------------------------------------- |
---|
| 1520 | |
---|
| 1521 | %---------------------------------------------------- |
---|
| 1522 | function first_i_Callback(hObject, eventdata, handles) |
---|
| 1523 | last_i_Callback(hObject, eventdata, handles) |
---|
| 1524 | |
---|
| 1525 | %---------------------------------------------- |
---|
| 1526 | function last_i_Callback(hObject, eventdata, handles) |
---|
[29] | 1527 | % hseries=get(handles.last_i,'parent'); |
---|
[2] | 1528 | first_i=str2num(get(handles.first_i,'String')); |
---|
| 1529 | last_i=str2num(get(handles.last_i,'String')); |
---|
| 1530 | ref_i=ceil((first_i+last_i)/2); |
---|
| 1531 | set(handles.ref_i,'String', num2str(ref_i)) |
---|
| 1532 | ref_i_Callback(hObject, eventdata, handles) |
---|
[29] | 1533 | SeriesData=get(handles.figure1,'UserData'); |
---|
[2] | 1534 | if ~isfield(SeriesData,'Time') |
---|
| 1535 | SeriesData.Time{1}=[]; |
---|
| 1536 | end |
---|
| 1537 | displ_time(handles,SeriesData.Time{1}); |
---|
| 1538 | |
---|
| 1539 | %------------------------------------------------------- |
---|
| 1540 | function first_j_Callback(hObject, eventdata, handles) |
---|
| 1541 | last_j_Callback(hObject, eventdata, handles) |
---|
| 1542 | |
---|
| 1543 | %------------------------------------------------------- |
---|
| 1544 | function last_j_Callback(hObject, eventdata, handles) |
---|
[29] | 1545 | % hseries=get(handles.last_i,'parent'); |
---|
[2] | 1546 | first_j=str2num(get(handles.first_j,'String')); |
---|
| 1547 | last_j=str2num(get(handles.last_j,'String')); |
---|
| 1548 | ref_j=ceil((first_j+last_j)/2); |
---|
| 1549 | set(handles.ref_j,'String', num2str(ref_j)) |
---|
| 1550 | |
---|
| 1551 | ref_j_Callback(hObject, eventdata, handles) |
---|
[29] | 1552 | SeriesData=get(handles.figure1,'UserData'); |
---|
[2] | 1553 | if ~isfield(SeriesData,'Time') |
---|
| 1554 | SeriesData.Time{1}=[]; |
---|
| 1555 | end |
---|
| 1556 | displ_time(handles,SeriesData.Time{1}); |
---|
| 1557 | |
---|
| 1558 | |
---|
| 1559 | |
---|
| 1560 | |
---|
| 1561 | %------------------------------------------------------- |
---|
| 1562 | function ref_i_Callback(hObject, eventdata, handles) |
---|
| 1563 | mode_list=get(handles.mode,'String'); |
---|
| 1564 | mode_value=get(handles.mode,'Value'); |
---|
| 1565 | mode=mode_list{mode_value}; |
---|
[29] | 1566 | %hseries=get(handles.ref_i,'parent'); |
---|
| 1567 | SeriesData=get(handles.figure1,'UserData'); |
---|
[2] | 1568 | %NomTypeCell=get(handles.NomType,'String'); |
---|
| 1569 | NomTypeCell=SeriesData.NomType; |
---|
| 1570 | if ~isempty(NomTypeCell) |
---|
| 1571 | Val=get(handles.NomType,'Value'); |
---|
| 1572 | NomType=NomTypeCell{Val}; |
---|
| 1573 | % for ilist=1:length(NomType) |
---|
| 1574 | if isequal(NomType,'_i_j1-j2')|| isequal(NomType,'_i1-i2_j')|| isequal(NomType,'_i1-i2') |
---|
| 1575 | if isequal(mode,'series(Di)') |
---|
| 1576 | find_netcpair_civ(hObject, eventdata, handles,Val);% update the menu of pairs depending on the available netcdf files |
---|
| 1577 | % break |
---|
| 1578 | end |
---|
| 1579 | end |
---|
| 1580 | end |
---|
| 1581 | |
---|
| 1582 | %---------------------------------------------------- |
---|
| 1583 | function ref_j_Callback(hObject, eventdata, handles) |
---|
| 1584 | mode_list=get(handles.mode,'String'); |
---|
| 1585 | mode_value=get(handles.mode,'Value'); |
---|
| 1586 | mode=mode_list{mode_value}; |
---|
[29] | 1587 | %hseries=get(handles.ref_i,'parent'); |
---|
| 1588 | SeriesData=get(handles.figure1,'UserData'); |
---|
[2] | 1589 | NomTypeCell=SeriesData.NomType; |
---|
| 1590 | if ~isempty(NomTypeCell) |
---|
[29] | 1591 | Val=get(handles.NomType,'Value'); |
---|
| 1592 | NomType=NomTypeCell{Val}; |
---|
[2] | 1593 | if isequal(NomType,'_i_j1-j2')|| isequal(NomType,'_i1-i2_j')|| isequal(NomType,'_i1-i2') |
---|
| 1594 | if isequal(mode,'series(Dj)') |
---|
| 1595 | find_netcpair_civ(hObject, eventdata, handles,Val);% update the menu of pairs depending on the available netcdf files |
---|
| 1596 | end |
---|
| 1597 | end |
---|
| 1598 | end |
---|
| 1599 | |
---|
| 1600 | %---------------------------------------------------- |
---|
| 1601 | % --- Executes on selection change in ACTION. |
---|
| 1602 | function ACTION_Callback(hObject, eventdata, handles) |
---|
[29] | 1603 | global nb_builtin |
---|
[2] | 1604 | list_ACTION=get(handles.ACTION,'String');% list menu fields |
---|
| 1605 | index_ACTION=get(handles.ACTION,'Value');% selected string index |
---|
| 1606 | ACTION= list_ACTION{index_ACTION}; % selected function name |
---|
| 1607 | path_series=which('series');%path to series.m |
---|
| 1608 | list_path=get(handles.ACTION,'UserData');%list of recorded paths to functions of the list ACTION |
---|
| 1609 | |
---|
[29] | 1610 | % add a new function to the menu if the selected item is 'more...' |
---|
[2] | 1611 | if isequal(ACTION,'more...') |
---|
| 1612 | pathfct=fileparts(path_series); |
---|
[29] | 1613 | % browse_name=fullfile(path_series,'series');%go to UVMAT/series by default |
---|
| 1614 | % if length(list_path)>nb_builtin |
---|
| 1615 | % browse_name=list_path{end};% initialize browser with the path of the last introduced function |
---|
| 1616 | % end |
---|
[2] | 1617 | [FileName, PathName, filterindex] = uigetfile( ... |
---|
| 1618 | {'*.m', ' (*.m)'; |
---|
| 1619 | '*.m', '.m files '; ... |
---|
| 1620 | '*.*', 'All Files (*.*)'}, ... |
---|
[29] | 1621 | 'Pick a file',list_path{end}); |
---|
[2] | 1622 | if length(FileName)<2 |
---|
| 1623 | return |
---|
[29] | 1624 | end |
---|
| 1625 | [pp,ACTION,ext_fct]=fileparts(FileName);%(end-1:end); |
---|
[2] | 1626 | if ~isequal(ext_fct,'.m') |
---|
| 1627 | msgbox_uvmat('ERROR','a Matlab function .m must be introduced'); |
---|
| 1628 | return |
---|
| 1629 | end |
---|
| 1630 | |
---|
| 1631 | % insert the choice in the action menu |
---|
| 1632 | menu_str=update_menu(handles.ACTION,ACTION);%new action menu in which the new item has been appended if needed |
---|
| 1633 | index_ACTION=get(handles.ACTION,'Value');% currently selected index in the list |
---|
| 1634 | list_path{index_ACTION}=PathName; |
---|
[29] | 1635 | if length(menu_str)>nb_builtin+5; %nb_builtin=nbre of functions always remaining in the initial menu |
---|
[2] | 1636 | nbremove=length(menu_str)-nb_builtin-5; |
---|
| 1637 | menu_str(nb_builtin+1:end-5)=[]; |
---|
| 1638 | list_path(nb_builtin+1:end-4)=[]; |
---|
| 1639 | index_ACTION=index_ACTION-nbremove; |
---|
| 1640 | set(handles.ACTION,'Value',index_ACTION) |
---|
| 1641 | set(handles.ACTION,'String',menu_str) |
---|
| 1642 | end |
---|
| 1643 | list_path{index_ACTION}=PathName; |
---|
| 1644 | set(handles.ACTION,'UserData',list_path); |
---|
| 1645 | set(handles.path,'enable','inactive')% indicate that the current path is accessible (not 'off') |
---|
| 1646 | |
---|
| 1647 | %record the current menu in personal file profil_perso |
---|
| 1648 | dir_perso=prefdir; |
---|
| 1649 | profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); |
---|
| 1650 | for ilist=nb_builtin+1:length(menu_str)-1 |
---|
| 1651 | series_fct{ilist-nb_builtin}=fullfile(list_path{ilist},[menu_str{ilist} '.m']); |
---|
| 1652 | end |
---|
| 1653 | if exist(profil_perso,'file') |
---|
| 1654 | save(profil_perso,'series_fct','-append') |
---|
| 1655 | else |
---|
| 1656 | txt=ver; |
---|
| 1657 | Release=txt(1).Release; |
---|
| 1658 | relnumb=str2num(Release(3:4)); |
---|
| 1659 | if relnumb >= 14 |
---|
| 1660 | save(profil_perso,'series_fct','-V6') |
---|
| 1661 | else |
---|
| 1662 | save(profil_perso, 'series_fct') |
---|
| 1663 | end |
---|
| 1664 | end |
---|
| 1665 | end |
---|
| 1666 | |
---|
| 1667 | %check the current path to the selected function |
---|
| 1668 | PathName=list_path{index_ACTION};%current recorded path |
---|
[29] | 1669 | % if ~isequal(path_series,PathName) |
---|
| 1670 | % CurrentPath=fileparts(which(ACTION)); |
---|
| 1671 | % if ~isequal(CurrentPath,PathName) |
---|
| 1672 | % addpath(PathName) |
---|
| 1673 | % errormsg=check_functions; |
---|
| 1674 | % msgbox_uvmat('CONFIRMATION',[['path ' PathName ' added to the current Matlab pathes'];errormsg]) |
---|
| 1675 | % end |
---|
| 1676 | % end |
---|
[2] | 1677 | set(handles.path,'String',PathName); %show the path to the senlected function |
---|
| 1678 | |
---|
| 1679 | %default setting for the visibility of the GUI elements |
---|
| 1680 | %set( handles.Field,'Visible','off')%default |
---|
| 1681 | set(handles.RootPath,'UserData','many') |
---|
| 1682 | set(handles.SubDir,'Visible','on') |
---|
| 1683 | set(handles.RootFile,'Visible','on') |
---|
| 1684 | set(handles.NomType,'Visible','on') |
---|
| 1685 | set(handles.FileExt,'Visible','on') |
---|
| 1686 | set(handles.NbSlice,'Visible','off') |
---|
| 1687 | set(handles.NbSlice_title,'Visible','off') |
---|
| 1688 | set(handles.VelTypeMenu,'Visible','off'); |
---|
| 1689 | set(handles.VelType_text,'Visible','off'); |
---|
| 1690 | set(handles.VelTypeMenu_1,'Visible','off'); |
---|
| 1691 | set(handles.VelType_text_1,'Visible','off'); |
---|
| 1692 | view_FieldMenu(handles,'off') |
---|
| 1693 | view_FieldMenu_1(handles,'off') |
---|
| 1694 | view_TRANSFORM(handles,'off') |
---|
| 1695 | set(handles.ProjObject_frame,'Visible','off'); |
---|
| 1696 | set(handles.GetMask,'Visible','off') |
---|
| 1697 | set(handles.Mask,'Visible','off') |
---|
| 1698 | set(handles.GetObject,'Visible','off'); |
---|
| 1699 | set(handles.ProjObject,'Visible','off'); |
---|
| 1700 | set(handles.OutputDir,'Visible','off'); |
---|
| 1701 | set(handles.PARAMETERS_frame,'Visible','off'); |
---|
| 1702 | set(handles.PARAMETERS_title,'Visible','off'); |
---|
| 1703 | set(handles.ParamKey,'Visible','off') |
---|
| 1704 | set(handles.ParamVal,'Visible','off') |
---|
| 1705 | ParamKey={}; |
---|
| 1706 | set(handles.FieldMenu,'Enable','off') |
---|
| 1707 | set(handles.VelTypeMenu,'Enable','off') |
---|
| 1708 | set(handles.FieldMenu_1,'Enable','off') |
---|
| 1709 | set(handles.VelTypeMenu_1,'Enable','off') |
---|
| 1710 | set(handles.CoordType,'Enable','off') |
---|
| 1711 | %set the displayed GUI item needed for input parameters |
---|
| 1712 | %list_input=feval(ACTION);% input list asked by the selected function |
---|
[29] | 1713 | if ~isequal(path_series,PathName) |
---|
| 1714 | addpath(PathName) |
---|
| 1715 | end |
---|
| 1716 | eval(['h_function=@' ACTION ';']); |
---|
| 1717 | if ~isequal(path_series,PathName) |
---|
| 1718 | rmpath(PathName) |
---|
| 1719 | end |
---|
| 1720 | |
---|
| 1721 | varargout=h_function(); |
---|
| 1722 | %varargout=feval(ACTION);% input list asked by the selected function |
---|
[2] | 1723 | Param_list={}; |
---|
| 1724 | % RootPath=get(handles.RootPath,'String'); |
---|
| 1725 | % RootFile=get(handles.RootFile,'String'); |
---|
| 1726 | |
---|
| 1727 | %nb_series=length(RootFile); |
---|
| 1728 | FileExt=get(handles.FileExt,'String'); |
---|
| 1729 | nb_series=length(FileExt); |
---|
| 1730 | testima_series=1; %test for a list of images only |
---|
| 1731 | testima=1; |
---|
| 1732 | testima_1=1; |
---|
| 1733 | testciv_series=1; |
---|
| 1734 | for iview=1:nb_series |
---|
| 1735 | ext=FileExt{iview}; |
---|
| 1736 | if length(ext)<2 |
---|
| 1737 | ext='.none'; |
---|
| 1738 | end |
---|
| 1739 | testimaview=~isempty(imformats(ext(2:end))) || isequal(lower(ext),'.avi'); |
---|
| 1740 | if ~testimaview |
---|
| 1741 | if iview==1 |
---|
| 1742 | testima=0; |
---|
| 1743 | end |
---|
| 1744 | if iview==2 |
---|
| 1745 | testima_1=0; |
---|
| 1746 | end |
---|
| 1747 | testima_series=0; |
---|
| 1748 | end |
---|
| 1749 | end |
---|
| 1750 | for ilist=1:length(varargout)-1 |
---|
| 1751 | switch varargout{ilist} |
---|
| 1752 | %RootFile always visible |
---|
| 1753 | case 'RootPath' %visible by default |
---|
| 1754 | value=lower(varargout{ilist+1}); |
---|
| 1755 | if isequal(value,'one')||isequal(value,'two')||isequal(value,'many') |
---|
| 1756 | set(handles.RootFile,'UserData',value)% for use in menu Open_insert |
---|
| 1757 | end |
---|
| 1758 | case 'SubDir' %visible by default |
---|
| 1759 | if isequal(lower(varargout{ilist+1}),'off') |
---|
| 1760 | set(handles.SubDir,'Visible','off') |
---|
| 1761 | end |
---|
| 1762 | case 'RootFile' %visible by default |
---|
| 1763 | value=lower(varargout{ilist+1}); |
---|
| 1764 | if isequal(value,'off') |
---|
| 1765 | set(handles.RootFile,'Visible','off') |
---|
| 1766 | elseif isequal(value,'one')||isequal(value,'two')||isequal(value,'many') |
---|
| 1767 | set(handles.RootFile,'Visible','on') |
---|
| 1768 | set(handles.RootFile,'UserData',value)% for use in menu Open_insert |
---|
| 1769 | end |
---|
| 1770 | case 'NomType' %visible by default |
---|
| 1771 | if isequal(lower(varargout{ilist+1}),'off') |
---|
| 1772 | set(handles.NomType,'Visible','off') |
---|
| 1773 | end |
---|
| 1774 | case 'FileExt' %visible by default |
---|
| 1775 | if isequal(lower(varargout{ilist+1}),'off') |
---|
| 1776 | set(handles.FileExt,'Visible','off') |
---|
| 1777 | end |
---|
| 1778 | case 'NbSlice' %hidden by default |
---|
| 1779 | if isequal(lower(varargout{ilist+1}),'on') |
---|
| 1780 | set(handles.NbSlice,'Visible','on') |
---|
| 1781 | set(handles.NbSlice_title,'Visible','on') |
---|
| 1782 | end |
---|
| 1783 | case 'VelTypeMenu' %hidden by default |
---|
| 1784 | if isequal(lower(varargout{ilist+1}),'one') || isequal(lower(varargout{ilist+1}),'two') |
---|
| 1785 | set(handles.VelTypeMenu,'Enable','on') |
---|
| 1786 | if nb_series >=1 && ~testima_series |
---|
| 1787 | set(handles.VelTypeMenu,'Visible','on') |
---|
| 1788 | set(handles.VelType_text,'Visible','on'); |
---|
| 1789 | set(handles.Field_frame,'Visible','on') |
---|
| 1790 | end |
---|
| 1791 | end |
---|
| 1792 | if isequal(lower(varargout{ilist+1}),'two') |
---|
| 1793 | set(handles.VelTypeMenu_1,'Enable','on') |
---|
| 1794 | if nb_series >=2 && ~testima_series |
---|
| 1795 | set(handles.VelTypeMenu_1,'Visible','on') |
---|
| 1796 | set(handles.VelType_text_1,'Visible','on'); |
---|
| 1797 | end |
---|
| 1798 | end |
---|
| 1799 | case 'FieldMenu' %hidden by default |
---|
| 1800 | if isequal(lower(varargout{ilist+1}),'one')||isequal(lower(varargout{ilist+1}),'two') |
---|
| 1801 | set(handles.FieldMenu,'Enable','on') % test for MenuBorser |
---|
| 1802 | if nb_series >=1 && ~testima_series |
---|
| 1803 | view_FieldMenu(handles,'on') |
---|
| 1804 | end |
---|
| 1805 | end |
---|
| 1806 | if isequal(lower(varargout{ilist+1}),'two') |
---|
| 1807 | set(handles.FieldMenu_1,'Enable','on') |
---|
| 1808 | if nb_series >=2 && ~testima_1 |
---|
| 1809 | view_FieldMenu_1(handles,'on') |
---|
| 1810 | end |
---|
| 1811 | end |
---|
| 1812 | case 'CoordType' %hidden by default |
---|
| 1813 | if isequal(lower(varargout{ilist+1}),'on') |
---|
| 1814 | set(handles.CoordType,'Enable','on') |
---|
| 1815 | view_TRANSFORM(handles,'on') |
---|
| 1816 | end |
---|
| 1817 | case 'GetObject' %hidden by default |
---|
| 1818 | if isequal(lower(varargout{ilist+1}),'on') |
---|
| 1819 | set(handles.ProjObject_frame,'Visible','on') |
---|
| 1820 | set(handles.GetObject,'Visible','on'); |
---|
| 1821 | end |
---|
| 1822 | case 'Mask' %hidden by default |
---|
| 1823 | if isequal(lower(varargout{ilist+1}),'on') |
---|
| 1824 | set(handles.ProjObject_frame,'Visible','on') |
---|
| 1825 | set(handles.GetMask,'Visible','on'); |
---|
| 1826 | end |
---|
| 1827 | case 'PARAMETER' |
---|
| 1828 | set(handles.PARAMETERS_frame,'Visible','on') |
---|
| 1829 | set(handles.PARAMETERS_title,'Visible','on') |
---|
| 1830 | set(handles.ParamKey,'Visible','on') |
---|
| 1831 | %set(handles.ParamVal,'Visible','on') |
---|
| 1832 | Param_str=varargout{ilist+1}; |
---|
| 1833 | Param_list=[Param_list; {Param_str}]; |
---|
| 1834 | end |
---|
| 1835 | end |
---|
| 1836 | if ~isempty(Param_list) |
---|
| 1837 | set(handles.ParamKey,'String',Param_list) |
---|
| 1838 | set(handles.ParamVal,'Visible','on') |
---|
| 1839 | end |
---|
| 1840 | |
---|
| 1841 | %------------------------------------------------------------------- |
---|
| 1842 | % --- Executes on selection change in FieldMenu. |
---|
| 1843 | %------------------------------------------------------------------- |
---|
| 1844 | function FieldMenu_Callback(hObject, eventdata, handles) |
---|
| 1845 | |
---|
| 1846 | field_str=get(handles.FieldMenu,'String'); |
---|
| 1847 | field_index=get(handles.FieldMenu,'Value'); |
---|
| 1848 | field=field_str{field_index(1)}; |
---|
| 1849 | if isequal(field,'get_field...') |
---|
| 1850 | hget_field=findobj(allchild(0),'name','get_field'); |
---|
| 1851 | if ~isempty(hget_field) |
---|
| 1852 | delete(hget_field)%delete opened versions of get_field |
---|
| 1853 | end |
---|
[29] | 1854 | %hseries=get(handles.FieldMenu,'parent'); |
---|
| 1855 | SeriesData=get(handles.figure1,'UserData'); |
---|
[2] | 1856 | filename=SeriesData.CurrentInputFile; |
---|
| 1857 | if exist(filename,'file') |
---|
| 1858 | get_field(filename) |
---|
| 1859 | end |
---|
| 1860 | elseif isequal(field,'more...') |
---|
| 1861 | str=calc_field; |
---|
| 1862 | [ind_answer,v] = listdlg('PromptString','Select a file:',... |
---|
| 1863 | 'SelectionMode','single',... |
---|
| 1864 | 'ListString',str); |
---|
| 1865 | % edit the choice in the fields and action menu |
---|
| 1866 | scalar=cell2mat(str(ind_answer)); |
---|
| 1867 | update_menu(handles.FieldMenu,scalar) |
---|
| 1868 | end |
---|
| 1869 | |
---|
| 1870 | %------------------------------------------------------ |
---|
| 1871 | % --- Executes on selection change in FieldMenu_1. |
---|
| 1872 | %----------------------------------------------------- |
---|
| 1873 | function FieldMenu_1_Callback(hObject, eventdata, handles) |
---|
| 1874 | field_str=get(handles.FieldMenu_1,'String'); |
---|
| 1875 | field_index=get(handles.FieldMenu_1,'Value'); |
---|
| 1876 | field=field_str{field_index}; |
---|
| 1877 | if isequal(field,'get_field...') |
---|
| 1878 | hget_field=findobj(allchild(0),'name','get_field_1'); |
---|
| 1879 | if ~isempty(hget_field) |
---|
| 1880 | delete(hget_field) |
---|
| 1881 | end |
---|
[29] | 1882 | %hseries=get(handles.FieldMenu,'parent'); |
---|
| 1883 | SeriesData=get(handles.figure1,'UserData'); |
---|
[2] | 1884 | filename=SeriesData.CurrentInputFile_1; |
---|
| 1885 | if exist(filename,'file') |
---|
| 1886 | hget_field=get_field(filename); |
---|
| 1887 | set(hget_field,'name','get_field_1') |
---|
| 1888 | end |
---|
| 1889 | elseif isequal(field,'more...') |
---|
| 1890 | str=calc_field; |
---|
| 1891 | [ind_answer,v] = listdlg('PromptString','Select a file:',... |
---|
| 1892 | 'SelectionMode','single',... |
---|
| 1893 | 'ListString',str); |
---|
| 1894 | % edit the choice in the fields and action menu |
---|
| 1895 | scalar=cell2mat(str(ind_answer)); |
---|
| 1896 | update_menu(handles.FieldMenu_1,scalar) |
---|
| 1897 | end |
---|
[29] | 1898 | |
---|
| 1899 | |
---|
| 1900 | % %group the variables (fields of 'FieldData') in cells of variables with the same dimensions |
---|
| 1901 | % %%%%%%%%%%%%%%%%%%%%%%% Function independante maintenant |
---|
| 1902 | % %----------------------------------------------------------------- |
---|
| 1903 | % [CellVarIndex,NbDim,VarTypeCell]=find_field_indices(Data{1}); |
---|
| 1904 | % %LOOP ON GROUPS OF VARIABLES SHARING THE SAME DIMENSIONS |
---|
| 1905 | % % CellVarIndex=cells of variable index arrays |
---|
| 1906 | % ivar_new=0; % index of the current variable in the projected field |
---|
| 1907 | % icoord=0; |
---|
| 1908 | % for icell=1:length(CellVarIndex) |
---|
| 1909 | % if NbDim(icell)==1 |
---|
| 1910 | % continue |
---|
[2] | 1911 | % end |
---|
[29] | 1912 | % VarIndex=CellVarIndex{icell};% indices of the selected variables in the list FieldData.ListVarName |
---|
| 1913 | % VarType=VarTypeCell{icell}; |
---|
| 1914 | % ivar_X=VarType.coord_x; |
---|
| 1915 | % ivar_Y=VarType.coord_y; |
---|
| 1916 | % ivar_FF=VarType.errorflag; |
---|
| 1917 | % if isempty(ivar_X) |
---|
| 1918 | % test_grid=1;%test for input data on regular grid (e.g. image)coordinates |
---|
| 1919 | % else |
---|
| 1920 | % if length(ivar_Y)~=1 |
---|
| 1921 | % warndlg_uvmat('y coordinate missing in proj_field.m','ERROR') |
---|
[2] | 1922 | % return |
---|
[29] | 1923 | % end |
---|
| 1924 | % test_grid=0; |
---|
| 1925 | % end |
---|
| 1926 | % % DimIndices=Data{1}.VarDimIndex{VarIndex(1)};%indices of the dimensions of the first variable (common to all variables in the cell) |
---|
| 1927 | % %case of input fields with unstructured coordinates |
---|
| 1928 | % if ~test_grid |
---|
| 1929 | % for ivar=VarIndex |
---|
| 1930 | % VarName=MergeData.ListVarName{ivar}; |
---|
| 1931 | % for iview=1:nbview |
---|
| 1932 | % eval(['MergeData.' VarName '=[MergeData.' VarName '; Data{iview}.' VarName ';']) |
---|
[2] | 1933 | % end |
---|
| 1934 | % end |
---|
[29] | 1935 | % %case of fields defined on a structured grid |
---|
| 1936 | % else |
---|
| 1937 | % % DimValue=MergeData.DimValue(DimIndices);%set of dimension values |
---|
| 1938 | % testFF=0; |
---|
| 1939 | % for iview=2:nbview |
---|
| 1940 | % % if ~isequal(DimValue,Data{iview}.DimValue(DimIndices)) |
---|
| 1941 | % % MergeData.Txt='ERROR: attempt at merging structured fields with different sizes'; |
---|
| 1942 | % % return |
---|
| 1943 | % % end |
---|
| 1944 | % for ivar=VarIndex |
---|
| 1945 | % VarName=MergeData.ListVarName{ivar}; |
---|
| 1946 | % if isfield(MergeData,'VarAttribute') |
---|
| 1947 | % if length(MergeData.VarAttribute)>=ivar && isfield(MergeData.VarAttribute{ivar},'Role') && isequal(MergeData.VarAttribute{ivar}.Role,'errorflag') |
---|
| 1948 | % testFF=1; |
---|
[2] | 1949 | % end |
---|
| 1950 | % end |
---|
[29] | 1951 | % eval(['MergeData.' VarName '=MergeData.' VarName '+ Data{iview}.' VarName ';']) |
---|
[2] | 1952 | % end |
---|
| 1953 | % end |
---|
[29] | 1954 | % if testFF |
---|
| 1955 | % nbaver=nbview-MergeData.FF; |
---|
| 1956 | % indgood=find(nbaver>0); |
---|
| 1957 | % for ivar=VarIndex |
---|
| 1958 | % VarName=MergeData.ListVarName{ivar}; |
---|
| 1959 | % eval(['MergeData.' VarName '(indgood)=double(MergeData.' VarName '(indgood))./nbaver(indgood);']) |
---|
| 1960 | % end |
---|
| 1961 | % else |
---|
| 1962 | % for ivar=VarIndex |
---|
| 1963 | % VarName=MergeData.ListVarName{ivar}; |
---|
| 1964 | % eval(['MergeData.' VarName '=double(MergeData.' VarName ')./nbview;']) |
---|
| 1965 | % end |
---|
[2] | 1966 | % end |
---|
| 1967 | % end |
---|
| 1968 | % end |
---|
[29] | 1969 | % |
---|
[2] | 1970 | |
---|
| 1971 | %----------------------------- |
---|
| 1972 | function mouse_up_gui(ggg,eventdata,handles) |
---|
| 1973 | if isequal(get(ggg,'SelectionType'),'alt') |
---|
| 1974 | display('global CurData, UserData of GUI series') |
---|
| 1975 | global CurData |
---|
| 1976 | CurData=get(ggg,'UserData'); |
---|
| 1977 | evalin('base','global CurData');%make CurData global in the workspace |
---|
| 1978 | evalin('base','CurData'); %display CurData in the workspace |
---|
| 1979 | commandwindow |
---|
| 1980 | % plot_text(CurData) |
---|
| 1981 | end |
---|
| 1982 | |
---|
| 1983 | |
---|
| 1984 | |
---|
| 1985 | % %---------------------------------------------------------------------- |
---|
| 1986 | % % --- display image movie and display time average |
---|
| 1987 | % %OBSOLETE: A SUPPRIMER |
---|
| 1988 | % %---------------------------------------------------------------------- |
---|
| 1989 | % function movie_ima(handles,filecell,filecell_1,num1,num_a,field) |
---|
| 1990 | % |
---|
| 1991 | % global hfig1 hfig2 hfig3 poscolbar |
---|
| 1992 | % global A val HIST |
---|
| 1993 | % |
---|
| 1994 | % A=[];aviobj=[]; |
---|
| 1995 | % % set(hfig1,'UserData','ima')% set the current field state to 'image' |
---|
| 1996 | % set(handles.zoom,'Value',1); %put zoom on |
---|
| 1997 | % nom_type=get(handles.file_input,'UserData'); |
---|
| 1998 | % % field=get(handles.civ1,'UserData'); |
---|
| 1999 | % % fields=field(1).fields; |
---|
| 2000 | % set(handles.speed,'Visible','On')%show slider to set movie speed |
---|
| 2001 | % set(handles.mo_speed_txt,'Visible','On') |
---|
| 2002 | % |
---|
| 2003 | % if ~isempty(filecell_1) |
---|
| 2004 | % file1=get(handles.file1_input,'UserData'); |
---|
| 2005 | % field1=file1.field; |
---|
| 2006 | % scal_type1=field1.fields; |
---|
| 2007 | % vel_type1=field1.vel_type; |
---|
| 2008 | % filename_1=filecell_1(1);% first file name in the series |
---|
| 2009 | % else |
---|
| 2010 | % filename_1=[]; |
---|
| 2011 | % end |
---|
| 2012 | % scal_type{1}=field(1).fields; |
---|
| 2013 | % vel_type{1}=field(1).vel_type; |
---|
| 2014 | % % display the first field |
---|
| 2015 | % [A,time,dt,rangx0,rangy0]=view_ima(handles,cell2mat(filecell(1)),filename_1,num1(1),num_a(1)); |
---|
| 2016 | % |
---|
| 2017 | % % calculate the histogram of the first image |
---|
| 2018 | % nxy=size(A); |
---|
| 2019 | % ndim=length(nxy); |
---|
| 2020 | % if ndim==2 % case of B/W images |
---|
| 2021 | % nxy(3)=1; |
---|
| 2022 | % end |
---|
| 2023 | % C=reshape(A,nxy(1)*nxy(2),nxy(3)); |
---|
| 2024 | % Amaxmax=double(max(max(max(A)))); |
---|
| 2025 | % Aminmin=double(min(min(min(A)))); |
---|
| 2026 | % if isa(C,'uint8')|isa(C,'uint16') |
---|
| 2027 | % C=double(C); |
---|
| 2028 | % dC=1; |
---|
| 2029 | % else |
---|
| 2030 | % dC=(Amaxmax-Aminmin)/100; |
---|
| 2031 | % end |
---|
| 2032 | % val=[Aminmin:dC:Amaxmax];% define bins for histogram |
---|
| 2033 | % HIST=hist(C,val);% initiate the global histogram |
---|
| 2034 | % if ndim==2, HIST=HIST'; end; |
---|
| 2035 | % |
---|
| 2036 | % auto_scale=get(handles.auto_scale,'Value'); |
---|
| 2037 | % min_input=str2num(get(handles.min_input,'String'));% select the minimum |
---|
| 2038 | % max_input=str2num(get(handles.scale_input,'String'));% select the max |
---|
| 2039 | % zoomstate=get(handles.zoom,'Value'); |
---|
| 2040 | % |
---|
| 2041 | % if isequal(get(handles.window_input,'String'),'avi'), |
---|
| 2042 | % basename=get(handles.file_input,'String'); |
---|
| 2043 | % prompt = {'file name';'frames per second';'frame resolution ([nbpixels x y])';'axis position relative to the frame'}; |
---|
| 2044 | % dlg_title = 'select properties of the output avi movie'; |
---|
| 2045 | % num_lines= 1; |
---|
| 2046 | % def = {[basename '_out.avi'];'5';'[1024 768]';'[0.05 0.07 0.87 0.88]'}; |
---|
| 2047 | % answer = inputdlg(prompt,dlg_title,num_lines,def); |
---|
| 2048 | % aviname=answer{1}; |
---|
| 2049 | % fps=str2num(answer{2}); |
---|
| 2050 | % if exist(aviname,'file')==2 |
---|
| 2051 | % delete(aviname); |
---|
| 2052 | % end; |
---|
| 2053 | % aviobj=avifile(aviname,'Compression','None','fps',fps); |
---|
| 2054 | % |
---|
| 2055 | % %display first view for tests |
---|
| 2056 | % figure(2); |
---|
| 2057 | % hh=get(gcf,'CurrentAxes'); |
---|
| 2058 | % if isempty(hh), |
---|
| 2059 | % hfig1=axes; |
---|
| 2060 | % else |
---|
| 2061 | % hfig1=hh; |
---|
| 2062 | % end; |
---|
| 2063 | % if isequal(filecell_1,{}) |
---|
| 2064 | % filename_1=[]; |
---|
| 2065 | % else |
---|
| 2066 | % filename_1=cell2mat(filecell_1(1)); |
---|
| 2067 | % end |
---|
| 2068 | % poscolbar=[0.93 0.15 0.02 0.7]; |
---|
| 2069 | % view_ima(handles,cell2mat(filecell(1)),filename_1,num1(1),num_a(1));% show the first field |
---|
| 2070 | % nbpix=eval(answer{3}); |
---|
| 2071 | % set(gcf,'Position',[1 1 nbpix])% resolution XVGA |
---|
| 2072 | % set(hfig1,'Position',eval(answer{4})); |
---|
| 2073 | % |
---|
| 2074 | % msgbox({'adjust figure 2 with its matlab edit menu ' ;... |
---|
| 2075 | % 'then type any keyboard key to get the avi movie as a copy of figure 2 display'}) |
---|
| 2076 | % pause; |
---|
| 2077 | % hh=colorbar; |
---|
| 2078 | % poscolbar=get(hh,'Position'); |
---|
| 2079 | % end |
---|
| 2080 | % |
---|
| 2081 | % %%%%%%%%%%%%%%%% |
---|
| 2082 | % %mask and usrdfct |
---|
| 2083 | % maskname=[]; %default |
---|
| 2084 | % if isequal(get(handles.mask_test,'Value'),1) |
---|
| 2085 | % maskbase=get(handles.mask_test,'UserData'); |
---|
| 2086 | % end |
---|
| 2087 | % % image or scalar processing programme set by user |
---|
| 2088 | % % if (get(handles.usr_fct,'Value')==1) |
---|
| 2089 | % % usrfct=get(handles.usr_fct,'UserData'); |
---|
| 2090 | % % else |
---|
| 2091 | % % usrfct=''; |
---|
| 2092 | % % end |
---|
| 2093 | % nburst=1; % nburst(1) =nbre of names in filename= nbre of bursts |
---|
| 2094 | % set(handles.text_display_1,'String',['image movie']) |
---|
| 2095 | % nbfield=length(filecell); |
---|
| 2096 | % if nbfield >1 |
---|
| 2097 | % for ifile=2:nbfield |
---|
| 2098 | % stopstate=get(handles.run0,'BusyAction'); |
---|
| 2099 | % if isequal(stopstate,'queue')% enable STOP command |
---|
| 2100 | % pausetime=1.02-get(handles.speed,'Value'); |
---|
| 2101 | % pause(pausetime) |
---|
| 2102 | % if isequal(get(handles.mask_test,'Value'),1) |
---|
| 2103 | % maskname=name_generator(maskbase,num1(ifile),1,'.png','png_series'); |
---|
| 2104 | % end |
---|
| 2105 | % if isequal(AName{1},'image') |
---|
| 2106 | % A=read_image(cell2mat(filecell(ifile)),num1(ifile),maskname);% read the first image, num2 is the counter for avi files |
---|
| 2107 | % else % read the first field from the netcdf file, imposing the pixel positions in the selected domain |
---|
| 2108 | % [A,time(ifile),dtr,rgx,rgy,vt_out,erread]=read_scalar(filecell{ifile},vel_type,scal_type,rangx0,rangy0,nxy,maskname); |
---|
| 2109 | % if erread==1; |
---|
| 2110 | % errordlg({['no spatial derivative in ' filecell{ifile}]; 'run patch first'}); return |
---|
| 2111 | % elseif erread==2; |
---|
| 2112 | % errordlg(['no field ' vel_type{1} ' in ' filecell{ifile}]); return |
---|
| 2113 | % elseif erread==3; |
---|
| 2114 | % errordlg(['scalar ' scal_type{1} ' not found in' filecell{ifile}]); return |
---|
| 2115 | % elseif erread==4; |
---|
| 2116 | % errordlg(['all points aligned in' filecell{ifile}]); return |
---|
| 2117 | % end |
---|
| 2118 | % end |
---|
| 2119 | % |
---|
| 2120 | % % read the second image |
---|
| 2121 | % if ~isempty(filecell_1) |
---|
| 2122 | % if isequal(scal_type{1},'image') |
---|
| 2123 | % A1=read_image(cell2mat(filecell_1(ifile)),num1(ifile),maskname);% read the second image, num2 is the counter for avi files |
---|
| 2124 | % Avalue_1=double(A1(indy,indx,:)); |
---|
| 2125 | % else % read the second field from the netcdf file, imposing the pixel positions in the selected domain |
---|
| 2126 | % [Avalue_1,time1(ifile),dtr,rgx,rgy,vt_out,erread]=read_scalar(filecell_1{ifile},{vel_type1},{scal_type1},rangx0,rangy0,npxy,maskname,usrfct); |
---|
| 2127 | % if erread==1; |
---|
| 2128 | % errordlg({['no spatial derivative in ' filecell_1{ifile}]; 'run patch first'}); return |
---|
| 2129 | % elseif erread==2; |
---|
| 2130 | % errordlg(['no field ' vel_type1 ' in ' filecell_1{ifile}]); return |
---|
| 2131 | % elseif erread==3; |
---|
| 2132 | % errordlg(['scalar ' scal_type1 ' not found in' filecell_1{ifile}]); return |
---|
| 2133 | % elseif erread==4; |
---|
| 2134 | % errordlg(['all points aligned in' filecell_1{ifile}]); return |
---|
| 2135 | % end |
---|
| 2136 | % end |
---|
| 2137 | % time(ifile)=(time(ifile)+time1(ifile))/2; |
---|
| 2138 | % Avalue=Avalue-Avalue_1; |
---|
| 2139 | % end |
---|
| 2140 | % set(handles.abs_time,'String',time); |
---|
| 2141 | % set(handles.field_counter,'String',num2str(num1(ifile))); |
---|
| 2142 | % set(handles.a_input,'String',num2stra(num_a(ifile),nom_type)); |
---|
| 2143 | % C=reshape(A,nxy(1)*nxy(2),nxy(3));% reshape in a vector |
---|
| 2144 | % [val,HIST]=hist_update(val,HIST,C,dC); |
---|
| 2145 | % [h,Amin,Amax]=plot_image(hfig1,rangx0,rangy0,1,scal_type{1},auto_scale,min_input,max_input,poscolbar,A); |
---|
| 2146 | % set(handles.min_input,'String',num2str(Amin));% select the minimum |
---|
| 2147 | % set(handles.scale_input,'String',num2str(Amax));% select the minimum |
---|
| 2148 | % if ~isequal(aviobj,[]), |
---|
| 2149 | % % mov=getframe(hfig1); |
---|
| 2150 | % mov=getframe(gcf); |
---|
| 2151 | % aviobj=addframe(aviobj,mov);end |
---|
| 2152 | % if (get(handles.zoom,'Value') == get(handles.zoom,'Max')),zoom on,end |
---|
| 2153 | % set(handles.field_counter,'String',num2str(num1(ifile))) |
---|
| 2154 | % % end |
---|
| 2155 | % end |
---|
| 2156 | % end |
---|
| 2157 | % end |
---|
| 2158 | % aviobj=close(aviobj); |
---|
| 2159 | % |
---|
| 2160 | % %plot global image histogram |
---|
| 2161 | % HIST=HIST/(nbfield*nxy(1)*nxy(2));% normalized by the number of points |
---|
| 2162 | % axes(hfig2) %in main window |
---|
| 2163 | % if ndim==2 |
---|
| 2164 | % plot(val,HIST) |
---|
| 2165 | % else |
---|
| 2166 | % plot(val,HIST(:,1),'r',val,HIST(:,2),'g',val,HIST(:,3),'b') |
---|
| 2167 | % end |
---|
| 2168 | % residu=1-sum(HIST,1); |
---|
| 2169 | % title(['histo, residu ' num2str(residu)]) |
---|
| 2170 | % grid on |
---|
| 2171 | % axes(hfig3) |
---|
| 2172 | % cla %clear the second histogram window |
---|
| 2173 | % |
---|
| 2174 | |
---|
| 2175 | |
---|
| 2176 | |
---|
| 2177 | |
---|
| 2178 | %%%%%%%%%%%%% |
---|
| 2179 | function [ind_remove]=find_pairs(dirpair,ind_i,last_i) |
---|
| 2180 | |
---|
| 2181 | indsel=ind_i; |
---|
| 2182 | indiff=diff(ind_i); %test index increment to detect multiplets (several pairs with the same index ind_i) and holes in the series |
---|
| 2183 | indiff=[1 indiff last_i-ind_i(end)+1];%for testing gaps with the imposed bounds |
---|
| 2184 | if ~isempty(indiff) |
---|
| 2185 | indiff2=diff(indiff); |
---|
| 2186 | indiffp=[indiff2 1]; |
---|
| 2187 | indiffm=[1 indiff2]; |
---|
| 2188 | ind_multi_m=find((indiff==0)&(indiffm<0))-1;%indices of first members of multiplets |
---|
| 2189 | ind_multi_p=find((indiff==0)&(indiffp>0));%indices of last members of multiplets |
---|
| 2190 | %for each multiplet, select the most recent file |
---|
| 2191 | ind_remove=[]; |
---|
| 2192 | for i=1:length(ind_multi_m) |
---|
| 2193 | ind_pairs=ind_multi_m(i):ind_multi_p(i); |
---|
| 2194 | for imulti=1:length(ind_pairs) |
---|
| 2195 | datepair(imulti)=datenum(dirpair(ind_pairs(imulti)).date);%dates of creation |
---|
| 2196 | end |
---|
| 2197 | [datenew,indsort2]=sort(datepair); %sort the multiplet by creation date |
---|
| 2198 | ind_s=indsort2(1:end-1);% |
---|
| 2199 | ind_remove=[ind_remove ind_pairs(ind_s)];%remove these indices, leave the last one |
---|
| 2200 | end |
---|
| 2201 | end |
---|
| 2202 | |
---|
| 2203 | %-------------------------------------------------------- |
---|
| 2204 | |
---|
| 2205 | |
---|
| 2206 | %----------------------------------------------------------- |
---|
| 2207 | % find the times corresponding to the first and last indices of a series |
---|
| 2208 | % |
---|
| 2209 | function displ_time(handles,times) |
---|
| 2210 | hseries=get(handles.last_i,'parent'); |
---|
| 2211 | SeriesData=get(hseries,'UserData');% |
---|
| 2212 | first_i=str2num(get(handles.first_i,'String')); |
---|
| 2213 | first_j=str2num(get(handles.first_j,'String')); |
---|
| 2214 | last_i=str2num(get(handles.last_i,'String')); |
---|
| 2215 | last_j=str2num(get(handles.last_j,'String')); |
---|
| 2216 | % index_civ=get(handles.list_pair_civ,'Value'); |
---|
| 2217 | % NomType=get(handles.NomType,'String'); |
---|
| 2218 | NomType=SeriesData.NomType; |
---|
| 2219 | mode_list=get(handles.mode,'String'); |
---|
| 2220 | index_mode=get(handles.mode,'Value'); |
---|
| 2221 | mode=mode_list{index_mode}; |
---|
| 2222 | % ind_shift=0;%default |
---|
| 2223 | |
---|
| 2224 | time_first=[]; |
---|
| 2225 | time_last=[]; |
---|
| 2226 | if ~isfield(SeriesData,'Time') |
---|
| 2227 | SeriesData.Time{1}=[]; |
---|
| 2228 | end |
---|
| 2229 | for iview=1:length(NomType) |
---|
| 2230 | time_first_cell{iview}='?'; |
---|
| 2231 | time_last_cell{iview}='?';%default |
---|
| 2232 | time=SeriesData.Time{iview}; |
---|
| 2233 | if isequal(NomType{iview},'_i1-i2_j')|isequal(NomType{iview},'_i_j1-j2')|isequal(NomType{iview},'#_ab')|isequal(NomType{iview},'_i1-i2') |
---|
| 2234 | if isfield(SeriesData,'displ_num')& ~isempty(SeriesData.displ_num) |
---|
| 2235 | ind_shift=SeriesData.displ_num(iview,:); |
---|
| 2236 | if isequal(mode,'bursts') |
---|
| 2237 | first_j=0; |
---|
| 2238 | last_j=0; |
---|
| 2239 | end |
---|
| 2240 | first_i1=first_i +ind_shift(3); |
---|
| 2241 | first_i2 =first_i +ind_shift(4); |
---|
| 2242 | first_j1 =first_j +ind_shift(1); |
---|
| 2243 | first_j2 =first_j +ind_shift(2); |
---|
| 2244 | last_i1=last_i +ind_shift(3); |
---|
| 2245 | last_i2 =last_i +ind_shift(4); |
---|
| 2246 | last_j1 =last_j +ind_shift(1); |
---|
| 2247 | last_j2 =last_j +ind_shift(2); |
---|
| 2248 | siz=size(SeriesData.Time{1}); |
---|
[25] | 2249 | if first_i1>=1 && first_j1>=1 && siz(1)>=last_i2 && siz(2)>=last_j2 |
---|
[2] | 2250 | time_first=(time(first_i1,first_j1)+time(first_i2,first_j2))/2; |
---|
| 2251 | time_last=(time(last_i1,last_j1)+time(last_i2,last_j2))/2; |
---|
| 2252 | else%read the time in the nc files |
---|
| 2253 | RootPath=get(handles.RootPath,'String'); |
---|
| 2254 | RootFile=get(handles.RootFile,'String'); |
---|
| 2255 | SubDir=get(handles.SubDir,'String'); |
---|
| 2256 | %VelType=get(handles.VelType,'String'); |
---|
| 2257 | VelType_str=get(handles.VelTypeMenu,'String'); |
---|
| 2258 | VelType_val=get(handles.VelTypeMenu,'Value'); |
---|
| 2259 | VelType=VelType_str{VelType_val}; |
---|
| 2260 | filebase=fullfile(RootPath{1},RootFile{1}); |
---|
| 2261 | [filefirst]=name_generator(filebase,first_i1,first_j1,'.nc',NomType{iview},1,first_i2,first_j2,SubDir{iview}); |
---|
| 2262 | if exist(filefirst,'file') |
---|
| 2263 | Attrib=nc2struct(filefirst,[]); |
---|
| 2264 | if isfield(Attrib,'Time') |
---|
| 2265 | time_first=Attrib.Time; |
---|
| 2266 | else |
---|
| 2267 | if isfield(Attrib,'absolut_time_T0') |
---|
| 2268 | time_first=Attrib.absolut_time_T0; |
---|
| 2269 | end |
---|
[12] | 2270 | if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1')) |
---|
[2] | 2271 | time_first=Attrib.absolut_time_T0_2; |
---|
| 2272 | end |
---|
| 2273 | end |
---|
| 2274 | end |
---|
| 2275 | [filelast]=name_generator(filebase,last_i1,last_j1,'.nc',NomType{iview},1,last_i2,last_j2,SubDir{iview}); |
---|
| 2276 | if exist(filelast,'file') |
---|
| 2277 | Attrib=nc2struct(filelast,[]); |
---|
| 2278 | if isfield(Attrib,'Time') |
---|
| 2279 | time_last=Attrib.Time; |
---|
| 2280 | else |
---|
| 2281 | if isfield(Attrib,'absolut_time_T0') |
---|
| 2282 | time_last=Attrib.absolut_time_T0; |
---|
| 2283 | end |
---|
[12] | 2284 | if isfield(Attrib,'absolut_time_T0_2')&&~(isequal(VelType,'civ1')||isequal(VelType,'interp1')||isequal(VelType,'filter1')) |
---|
[2] | 2285 | time_last=Attrib.absolut_time_T0_2; |
---|
| 2286 | end |
---|
| 2287 | end |
---|
| 2288 | end |
---|
| 2289 | end |
---|
| 2290 | end |
---|
| 2291 | else |
---|
| 2292 | siz=size(times); |
---|
| 2293 | if siz(1)>=last_i & siz(2)>=last_j |
---|
| 2294 | time_first=times(first_i,first_j); |
---|
| 2295 | time_last=times(last_i,last_j); |
---|
| 2296 | end |
---|
| 2297 | end |
---|
| 2298 | time_first_cell{iview}=num2str(time_first,4); |
---|
| 2299 | time_last_cell{iview}=num2str(time_last,4); |
---|
| 2300 | end |
---|
| 2301 | set(handles.time_first,'Value',1) |
---|
| 2302 | set(handles.time_last,'Value',1) |
---|
| 2303 | set(handles.time_first,'String',time_first_cell); |
---|
| 2304 | set(handles.time_last,'String',time_last_cell); |
---|
| 2305 | |
---|
| 2306 | %-------------------------------------------------------------------- |
---|
| 2307 | % --- Executes on selection change in VelTypeMenu. |
---|
| 2308 | function VelTypeMenu_Callback(hObject, eventdata, handles) |
---|
| 2309 | % VelTypeList=get(handles.VelTypeMenu,'String'); |
---|
| 2310 | % VelTypeIndex=get(handles.VelTypeMenu,'Value'); |
---|
| 2311 | % VelTypeCell=get(handles.VelType,'String'); |
---|
| 2312 | % VelTypeCell{1}=VelTypeList{VelTypeIndex}; |
---|
| 2313 | % set(handles.VelType,'String',VelTypeCell) |
---|
| 2314 | |
---|
| 2315 | |
---|
| 2316 | %-------------------------------------------------------------------- |
---|
| 2317 | % --- Executes on button press in GetObject. |
---|
| 2318 | function GetObject_Callback(hObject, eventdata, handles) |
---|
| 2319 | hseries=get(handles.GetObject,'parent'); |
---|
| 2320 | SeriesData=get(hseries,'UserData'); |
---|
| 2321 | value=get(handles.GetObject,'Value'); |
---|
| 2322 | if value |
---|
| 2323 | set(handles.GetObject,'BackgroundColor',[1 1 0])%put unactivated buttons to yellow |
---|
| 2324 | DataInit.ParentButton=handles.GetObject; |
---|
| 2325 | hset_object=findobj(allchild(0),'Name','set_object');%find the set_object interface handle |
---|
| 2326 | if ishandle(hset_object) |
---|
| 2327 | [SeriesData.hset_object,SeriesData.sethandles]=set_object(DataInit); %open the set_object interface |
---|
| 2328 | else |
---|
| 2329 | DataInit.TITLE='POINTS';%default option |
---|
| 2330 | [SeriesData.hset_object,SeriesData.sethandles]=set_object(DataInit); %open the set_object interface |
---|
| 2331 | end |
---|
| 2332 | else |
---|
| 2333 | set(handles.GetObject,'BackgroundColor',[0 1 0])%put activated buttons to green |
---|
| 2334 | if isfield(SeriesData,'hset_object')&& ishandle(SeriesData.hset_object) |
---|
| 2335 | close(SeriesData.hset_object) |
---|
| 2336 | end |
---|
| 2337 | end |
---|
| 2338 | set(hseries,'UserData',SeriesData) |
---|
| 2339 | |
---|
| 2340 | %-------------------------------------------------------------- |
---|
| 2341 | function GetMask_Callback(hObject, eventdata, handles) |
---|
| 2342 | value=get(handles.GetMask,'Value'); |
---|
| 2343 | if value |
---|
| 2344 | errordlg('not implemented yet') |
---|
| 2345 | end |
---|
| 2346 | %-------------------------------------------------------------- |
---|
| 2347 | |
---|
| 2348 | %-------------------------------------------------------------------------- |
---|
| 2349 | %'uv_ncbrowser': interactively calls the netcdf file browser 'get_field.m' |
---|
| 2350 | function ncbrowser_uvmat(hObject, eventdata) |
---|
| 2351 | bla=get(gcbo,'String'); |
---|
| 2352 | ind=get(gcbo,'Value'); |
---|
| 2353 | filename=cell2mat(bla(ind)); |
---|
| 2354 | blank=find(filename==' '); |
---|
| 2355 | filename=filename(1:blank-1); |
---|
| 2356 | get_field(filename) |
---|
| 2357 | |
---|
| 2358 | |
---|
| 2359 | |
---|
| 2360 | % -------------------------------------------------------------------- |
---|
| 2361 | function MenuHelp_Callback(hObject, eventdata, handles) |
---|
| 2362 | |
---|
| 2363 | path_to_uvmat=which ('uvmat');% check the path of uvmat |
---|
| 2364 | pathelp=fileparts(path_to_uvmat); |
---|
| 2365 | helpfile=fullfile(pathelp,'UVMAT_DOC','uvmat_doc.html'); |
---|
| 2366 | if isempty(dir(helpfile)), errordlg('Please put the help file uvmat_doc.html in the directory UVMAT/UVMAT_DOC') |
---|
| 2367 | else |
---|
| 2368 | web([helpfile '#series']) |
---|
| 2369 | end |
---|
| 2370 | |
---|
| 2371 | |
---|
| 2372 | |
---|
| 2373 | |
---|
| 2374 | |
---|
| 2375 | |
---|