- Timestamp:
- Mar 25, 2013, 5:43:18 PM (12 years ago)
- Location:
- trunk/src
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r589 r591 83 83 end 84 84 if isfield(sparam,'BatchParam') && isfield(sparam.BatchParam,'BatchMode') 85 batch_mode=sparam.BatchParam.BatchMode; %sge is currently the only implemented batch mod85 batch_mode=sparam.BatchParam.BatchMode; 86 86 test_command=''; 87 87 switch batch_mode … … 900 900 uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','msgbox','Max',2,'String','checking files...'); 901 901 uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]); 902 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','normalized','FontSize',0.9,'Callback',@close_GUI); 902 %uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','normalized','FontSize',0.9,'Callback',@close_GUI); 903 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','normalized','FontSize',0.9,'Callback',@stop_status); 903 904 hrefresh=uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.1 0.01 0.2 0.07],'String','Refresh','FontWeight','bold','FontUnits','normalized','FontSize',0.9,'Callback',@refresh_GUI); 904 905 BarPosition=[0.05 0.81 0.01 0.05]; … … 1009 1010 set(hhciv.status,'BackgroundColor',[0 1 0]) 1010 1011 1011 % ------------------------------------------------------------------------1012 % launched by pressing OK on the status figure1013 function close_GUI(hObject, eventdata)1014 % ------------------------------------------------------------------------1015 delete(gcbf)1012 % %------------------------------------------------------------------------ 1013 % % launched by pressing OK on the status figure 1014 % function close_GUI(hObject, eventdata) 1015 % %------------------------------------------------------------------------ 1016 % delete(gcbf) 1016 1017 1017 1018 … … 1335 1336 write_param(Param); 1336 1337 1337 % create the file used in run or batch1338 % create the command file name .m, .bat or .sh depending on the run option 1338 1339 switch Param.Program 1339 1340 case {'civ_matlab'} … … 1758 1759 ext_ima=get(handles.ImaExt,'String'); % image extension (the same for all images) 1759 1760 switch compare 1760 case 'PIV'1761 case {'PIV','PIV volume'} 1761 1762 RootFile_ima1=RootFile_ima2;% root name of the two image series is the same 1762 1763 NomType_ima1=NomType_ima2;% the index of the first image follows the index of the second one … … 2497 2498 ListCompareMode=get(handles.ListCompareMode,'String'); 2498 2499 option=ListCompareMode{get(handles.ListCompareMode,'Value')}; 2499 if ~strcmp(option,'PIV') % case 'displacement' or 'stereo PIV' 2500 filebase=get(handles.RootPath,'String'); 2501 set(handles.sub_txt,'Visible','on') 2502 set(handles.RootFile_1,'Visible','On');%mkes the second file input window visible 2503 mode_store=get(handles.ListPairMode,'String');%get the present 'mode' 2504 set(handles.ListCompareMode,'UserData',mode_store);%store the mode display 2505 set(handles.ListPairMode,'Visible','off') 2506 2507 %% open an image file with the browser 2508 ind_opening=1;%default 2509 browse.incr_pair=[0 0]; %default 2510 oldfile=get(handles.RootPath,'String'); 2511 menu={'*.png;*.jpg;*.tif;*.avi;*.AVI;', ' (*.png,*.jpg ,.tif, *.avi,*.AVI)'; 2512 '*.png','.png image files'; ... 2513 '*.jpg',' jpeg image files'; ... 2514 '*.tif','.tif image files'; ... 2515 '*.avi;*.AVI','.avi movie files'; ... 2516 '*.*', 'All Files (*.*)'}; 2517 if strcmp(option,'displacement') 2518 comment='Pick the reference file for displacements'; 2519 else 2520 comment='Pick a file of the second series'; 2521 end 2522 [FileName, PathName] = uigetfile( menu, comment,oldfile); 2523 fileinput=[PathName FileName];%complete file name 2524 sizf=size(fileinput); 2525 if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string 2526 [path,name,ext]=fileparts(fileinput); 2527 [path1]=fileparts(filebase); 2528 if isunix 2529 [status,path]=system(['readlink ' path]); 2530 [status,path1]=system(['readlink ' path1]);% look for the true path in case of symbolic paths 2531 end 2532 if ~strcmp(path1,path) 2533 msgbox_uvmat('ERROR','The second image or series must be in the same directory as the first one') 2534 return 2535 end 2536 if strcmp(option,'displacement') 2537 [tild,RootFile_1]=fileparts(name); 2538 else 2539 [FilePath,FileName,Ext]=fileparts(fileinput); 2540 % detect the file type, get the movie object if relevant, and look for the corresponding file series: 2541 % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists 2542 [RootPath,SubDir,RootFile_1,i1_series,i2_series,j1_series,j2_series,nom_type_1,FileType,Object,i1,i2,j1,j2]=find_file_series(FilePath,[FileName Ext]); 2543 2544 %check image nom type 2545 if ~strcmp(nom_type_1,get(handles.NomType,'String')) 2546 msgbox_uvmat('ERROR','The second image series must have the same indexing type as the first one, or use the option displacement for a fixed image') 2547 return 2548 end 2549 end 2550 %check image extension 2551 if ~strcmp(ext,get(handles.ImaExt,'String')) 2552 msgbox_uvmat('ERROR','The second image series must have the same extension name as the first one') 2553 return 2554 end 2555 set(handles.RootFile_1,'String',RootFile_1); 2556 else 2557 set(handles.ListPairMode,'Visible','on') 2558 set(handles.RootFile_1,'Visible','Off'); 2559 set(handles.sub_txt,'Visible','off') 2560 set(handles.RootFile_1,'String',[]); 2561 mode_store=get(handles.ListCompareMode,'UserData'); 2562 set(handles.ListPairMode,'Value',1) 2563 set(handles.ListPairMode,'String',mode_store) 2564 set(handles.CheckStereo,'Value',0) 2565 set(handles.ListPairMode,'Value',1) % mode 'civX' selected by default 2500 switch option 2501 case 'PIV' 2502 set(handles.RootFile_1,'Visible','Off'); 2503 set(handles.sub_txt,'Visible','off') 2504 set(handles.RootFile_1,'String',[]); 2505 mode_store=get(handles.ListCompareMode,'UserData'); 2506 set(handles.ListPairMode,'Visible','on') 2507 set(handles.ListPairMode,'Value',1) 2508 set(handles.ListPairMode,'String',mode_store) 2509 set(handles.CheckStereo,'Value',0) 2510 case 'PIV volume' 2511 set(handles.RootFile_1,'Visible','Off'); 2512 set(handles.sub_txt,'Visible','off') 2513 set(handles.RootFile_1,'String',[]); 2514 mode_store=get(handles.ListCompareMode,'UserData'); 2515 set(handles.ListPairMode,'Visible','on') 2516 set(handles.ListPairMode,'Value',1) 2517 set(handles.ListPairMode,'String',{'series(Di)'}) 2518 set(handles.CheckStereo,'Value',0) 2519 set(handles.last_j,'String',get(handles.nb_field2,'String'))% select the whole volume scan by default 2520 set(handles.incr_i,'String',num2str(2))% 2521 otherwise 2522 filebase=get(handles.RootPath,'String'); 2523 set(handles.sub_txt,'Visible','on') 2524 set(handles.RootFile_1,'Visible','On');%mkes the second file input window visible 2525 mode_store=get(handles.ListPairMode,'String');%get the present 'mode' 2526 set(handles.ListCompareMode,'UserData',mode_store);%store the mode display 2527 set(handles.ListPairMode,'Visible','off') 2528 2529 %% open an image file with the browser 2530 ind_opening=1;%default 2531 browse.incr_pair=[0 0]; %default 2532 oldfile=get(handles.RootPath,'String'); 2533 menu={'*.png;*.jpg;*.tif;*.avi;*.AVI;', ' (*.png,*.jpg ,.tif, *.avi,*.AVI)'; 2534 '*.png','.png image files'; ... 2535 '*.jpg',' jpeg image files'; ... 2536 '*.tif','.tif image files'; ... 2537 '*.avi;*.AVI','.avi movie files'; ... 2538 '*.*', 'All Files (*.*)'}; 2539 if strcmp(option,'displacement') 2540 comment='Pick the reference file for displacements'; 2541 else 2542 comment='Pick a file of the second series'; 2543 end 2544 [FileName, PathName] = uigetfile( menu, comment,oldfile); 2545 fileinput=[PathName FileName];%complete file name 2546 sizf=size(fileinput); 2547 if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string 2548 [path,name,ext]=fileparts(fileinput); 2549 [path1]=fileparts(filebase); 2550 if isunix 2551 [status,path]=system(['readlink ' path]); 2552 [status,path1]=system(['readlink ' path1]);% look for the true path in case of symbolic paths 2553 end 2554 if ~strcmp(path1,path) 2555 msgbox_uvmat('ERROR','The second image or series must be in the same directory as the first one') 2556 return 2557 end 2558 if strcmp(option,'displacement') 2559 [tild,RootFile_1]=fileparts(name); 2560 else 2561 [FilePath,FileName,Ext]=fileparts(fileinput); 2562 % detect the file type, get the movie object if relevant, and look for the corresponding file series: 2563 % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists 2564 [RootPath,SubDir,RootFile_1,i1_series,i2_series,j1_series,j2_series,nom_type_1,FileType,Object,i1,i2,j1,j2]=find_file_series(FilePath,[FileName Ext]); 2565 2566 %check image nom type 2567 if ~strcmp(nom_type_1,get(handles.NomType,'String')) 2568 msgbox_uvmat('ERROR','The second image series must have the same indexing type as the first one, or use the option displacement for a fixed image') 2569 return 2570 end 2571 end 2572 %check image extension 2573 if ~strcmp(ext,get(handles.ImaExt,'String')) 2574 msgbox_uvmat('ERROR','The second image series must have the same extension name as the first one') 2575 return 2576 end 2577 set(handles.RootFile_1,'String',RootFile_1); 2578 2566 2579 end 2567 2580 ListPairMode_Callback(hObject, eventdata, handles) -
trunk/src/civ_matlab.m
r582 r591 85 85 end 86 86 87 % caluclate velocity data (y and v in indices, reverse to y component)88 [xtable ytable utable vtable ctable F result_conv errormsg] = civ (par_civ1);89 if ~isempty(errormsg)90 return91 end92 87 list_param=(fieldnames(Param.Civ1))'; 93 88 Civ1_param=list_param;%default 89 94 90 %set the values of all the global attributes in list_param 91 Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ1_param]; 95 92 for ilist=1:length(list_param) 96 93 Civ1_param{ilist}=['Civ1_' list_param{ilist}]; 97 94 Data.(['Civ1_' list_param{ilist}])=Param.Civ1.(list_param{ilist}); 98 95 end 99 Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ1_param];% {'Civ1_Time','Civ1_Dt'}]; 96 Data.CivStage=1; 97 98 % set the list of variables 100 99 Data.ListVarName={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_F','Civ1_C'};% cell array containing the names of the fields to record 101 100 Data.VarDimName={'nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1'}; … … 105 104 Data.VarAttribute{4}.Role='vector_y'; 106 105 Data.VarAttribute{5}.Role='warnflag'; 107 Data.Civ1_X=reshape(xtable,[],1); 108 Data.Civ1_Y=reshape(Param.Civ1.ImageHeight-ytable+1,[],1); 109 Data.Civ1_U=reshape(utable,[],1); 110 Data.Civ1_V=reshape(-vtable,[],1); 111 Data.Civ1_C=reshape(ctable,[],1); 112 Data.Civ1_F=reshape(F,[],1); 113 Data.CivStage=1; 106 107 if 'PIV volume' 108 Data.ListVarName=[Data.ListVarName 'Civ1_Z']; 109 Data.Civ1_X=[];Data.Civ1_Y=[];Data.Civ1_Z=[]; 110 Data.Civ1_U=[];Data.Civ1_V=[];Data.Civ1_C=[];Data.Civ1_F=[]; 111 for ivol=1:NbSlice 112 % caluclate velocity data (y and v in indices, reverse to y component) 113 [xtable ytable utable vtable ctable F result_conv errormsg] = civ (par_civ1); 114 if ~isempty(errormsg) 115 return 116 end 117 Data.Civ1_X=[Data.Civ1_X reshape(xtable,[],1)]; 118 Data.Civ1_Y=[Data.Civ1_Y reshape(Param.Civ1.ImageHeight-ytable+1,[],1)]; 119 Data.Civ1_Z=[Data.Civ1_Z ivol*ones(numel(xtable),1)];% z=image index in image coordinates 120 Data.Civ1_U=[Data.Civ1_U reshape(utable,[],1)]; 121 Data.Civ1_V=[Data.Civ1_V reshape(-vtable,[],1)]; 122 Data.Civ1_C=[Data.Civ1_C reshape(ctable,[],1)]; 123 Data.Civ1_F=[Data.Civ1_C reshape(F,[],1)]; 124 end 125 else %usual PIV 126 % caluclate velocity data (y and v in indices, reverse to y component) 127 [xtable ytable utable vtable ctable F result_conv errormsg] = civ (par_civ1); 128 if ~isempty(errormsg) 129 return 130 end 131 Data.Civ1_X=reshape(xtable,[],1); 132 Data.Civ1_Y=reshape(Param.Civ1.ImageHeight-ytable+1,[],1); 133 Data.Civ1_U=reshape(utable,[],1); 134 Data.Civ1_V=reshape(-vtable,[],1); 135 Data.Civ1_C=reshape(ctable,[],1); 136 Data.Civ1_F=reshape(F,[],1); 137 end 114 138 else 115 139 if exist('ncfile','var') -
trunk/src/fill_GUI.m
r569 r591 1 1 %'fill_GUI': fill a GUI with a set of parameters from a Matlab structure 2 2 % ----------------------------------------------------------------------- 3 % function errormsg=fill_GUI(Param, handles)3 % function errormsg=fill_GUI(Param,GUI_handle) 4 4 % OUPUT: 5 5 % errormsg: error message, ='' by default … … 11 11 % see also the reverse function read_GUI.m 12 12 % 13 function errormsg=fill_GUI(Param, handles)13 function errormsg=fill_GUI(Param,GUI_handle) 14 14 %------------------------------------------------------------------------ 15 15 errormsg=''; 16 handles=guidata(GUI_handle); 17 UserData=get(GUI_handle,'UserData'); 16 18 fields=fieldnames(Param);%list of fields in Param 17 19 % loop on the elements of the input structure Param … … 21 23 if isfield(handles,fields{ifield}) 22 24 set(handles.(fields{ifield}),'Visible','on') 23 children=get(handles.(fields{ifield}),'children'); 24 for ichild=1:numel(children) 25 hchild.(get(children(ichild),'tag'))=children(ichild); 26 end 27 errormsg=fill_GUI(Param.(fields{ifield}),hchild);% apply the function to the substructure 25 % children=get(handles.(fields{ifield}),'children'); 26 % for ichild=1:numel(children) 27 % hchild.(get(children(ichild),'tag'))=children(ichild); 28 % end 29 % errormsg=fill_GUI(Param.(fields{ifield}),hchild);% apply the function to the substructure 30 errormsg=fill_GUI(Param.(fields{ifield}),handles.(fields{ifield}));% apply the function to the substructure 31 % if the input sub-structure fits with a tag name of the GUI and a 32 % substructure of UserData 33 elseif isfield(UserData,fields{ifield})&& isfield(handles,fields{ifield})&&isfield(Param.(fields{ifield}),'Name') 34 UserData.(fields{ifield})=Param.(fields{ifield}); 35 set(handles.(fields{ifield}),'String',Param.(fields{ifield}).Name) 28 36 end 29 37 % case of an element -
trunk/src/geometry_calib.m
r569 r591 818 818 set(handles.XImage,'String',coord_str(k(3)+3:k(4)-1)) 819 819 set(handles.YImage,'String',coord_str(k(4)+3:end)) 820 h_menu_coord=findobj(huvmat,'Tag',' transform_fct');820 h_menu_coord=findobj(huvmat,'Tag','TransformName'); 821 821 menu=get(h_menu_coord,'String'); 822 822 choice=get(h_menu_coord,'Value'); … … 914 914 hhuvmat=guidata(huvmat); %handles of GUI elements in uvmat 915 915 %hplot=findobj(huvmat,'Tag','axes3');%main plotting axis of uvmat 916 h_menu_coord=findobj(huvmat,'Tag',' transform_fct');916 h_menu_coord=findobj(huvmat,'Tag','TransformName'); 917 917 menu=get(h_menu_coord,'String'); 918 918 choice=get(h_menu_coord,'Value'); -
trunk/src/get_field.m
r586 r591 225 225 %% Make choices in menus from input 226 226 if exist('ParamIn','var')&&~isempty(ParamIn) 227 fill_GUI(ParamIn,handles );227 fill_GUI(ParamIn,handles.get_field); 228 228 end 229 229 CheckPlot1D_Callback(handles.CheckPlot1D, [], handles) -
trunk/src/get_file_series.m
r540 r591 15 15 function [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param) 16 16 17 filecell={}; 17 filecell={};i1_series={};i2_series={};j1_series={};j2_series={}; 18 18 InputTable=Param.InputTable; 19 19 first_i=Param.IndexRange.first_i; -
trunk/src/imadoc2struct.m
r582 r591 86 86 Dtk=[];%default 87 87 NbDtk=1;%default 88 if isfield(Timing ,'Dtk')88 if isfield(Timing{k},'Dtk') 89 89 Dtk=Timing{k}.Dtk; 90 90 end 91 if isfield(Timing ,'NbDtk')&&~isempty(Timing{k}.NbDtk)91 if isfield(Timing{k},'NbDtk')&&~isempty(Timing{k}.NbDtk) 92 92 NbDtk=Timing{k}.NbDtk; 93 93 end -
trunk/src/read_GUI.m
r517 r591 88 88 end 89 89 end 90 % read UserData if relevant 91 UserData=get(handle,'UserData'); 92 if isstruct(UserData) 93 List=fields(UserData); 94 for ilist=1:numel(List) 95 if isstruct(UserData.(List{ilist})) 96 heditbox=findobj(handle,'Tag',List{ilist},'Style','edit','Visible','on'); 97 if isequal(numel(heditbox),1) 98 struct.(List{ilist})=UserData.(List{ilist}); 99 end 100 end 101 end 102 end -
trunk/src/series.m
r586 r591 59 59 % --- Executes just before series is made visible. 60 60 %-------------------------------------------------------------------------- 61 function series_OpeningFcn(hObject, eventdata, handles, param)62 global nb_builtin_ACTION nb_builtin_transform 61 function series_OpeningFcn(hObject, eventdata, handles,Param) 62 63 63 % Choose default command line output for series 64 64 handles.output = hObject; 65 65 % Update handles structure 66 66 guidata(hObject, handles); 67 %default initial parameters 67 68 %% initial settings 68 69 drawnow 69 70 set(hObject,'Units','pixels') … … 74 75 series_ResizeFcn(hObject, eventdata, handles)%resize table according to series GUI size 75 76 set(hObject,'WindowButtonDownFcn',{'mouse_down'})%allows mouse action with right button (zoom for uicontrol display) 77 % check default input data 78 if ~exist('Param','var') 79 Param=[]; %default 80 end 81 82 %% default list of functions in the mebu ActionName 83 ActionList={'check_data_files';'aver_stat';'time_series';'merge_proj'};% WARNING: fits with nb_builtin_ACTION=4 in ActionName_callback 84 [path_series,name,ext]=fileparts(which('series'));% path to the GUI series 85 path_series_fct=fullfile(path_series,'series');%path of the functions in subdirectroy 'series' 86 path_bin=fullfile(path_series,'bin');%path of the binary functions (compiled) 87 ActionPathList=regexprep(ActionList,'^.+$',path_series_fct);% set path=path_series to each function in the list ('^.+$'=any non empty nbre of char form beginning to end of char string) 88 ActionPathList=[ActionPathList regexprep(ActionList,'^.+$',path_bin)];% set path to compiled functions 89 ActionExtList={'.m';'.sh'};% default choice of extensions (Matlab fct .m or compiled version .sh) 90 RunModeList={'local';'background'};% default choice of extensions (Matlab fct .m or compiled version .sh) 91 [s,w]=system('oarstat');% look for cluster system 'oar' 92 if isequal(s,0) 93 RunModeList=[RunModeList;{'cluster_oar'}]; 94 end 95 [s,w]=system('qstat');% look for cluster system 'sge' 96 if isequal(s,0) 97 RunModeList=[RunModeList;{'cluster_sge'}]; 98 end 99 set(handles.RunMode,'String',RunModeList) 100 101 %% default list of functions in the mebu TransformName 102 TransformList={'';'sub_field';'phys';'phys_polar'};% WARNING: must fit with the corresponding menu in uvmat and nb_builtin_transform=4 in TransformName_callback 103 path_transform_fct=fullfile(path_series,'transform_field'); 104 TransformPathList=regexprep(TransformList,'^.+$',path_transform_fct);% set path=path_transform_fct to each function in the list ('^.+$'=any non empty nbre of char form beginning to end of char string) 105 106 %% load the personal file uvmat_perso.mat 76 107 dir_perso=prefdir; 77 test_profil_perso=0;78 108 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 79 109 if exist(profil_perso,'file') 80 h=load (profil_perso); 81 if isfield(h,'MenuFile') 82 for ifile=1:min(length(h.MenuFile),5) 83 eval(['set(handles.MenuFile_' num2str(ifile) ',''Label'',h.MenuFile{ifile});']) 84 end 85 end 86 test_profil_perso=1; 87 end 88 89 %check default input data 90 if ~exist('param','var') 91 param=[]; %default 92 end 93 94 %% file name and browser initialisation 95 if isfield(param,'transform_str') 96 set(handles.TransformName,'String',param.transform_str) 97 end 98 if isfield(param,'transform_val') 99 set(handles.TransformName,'Value',param.transform_val); 100 else 101 set(handles.TransformName,'Value',1);%default 102 end 103 if isfield(param,'FileName') 104 InputTable={'','','','',''}; 105 set(handles.InputTable,'Data',InputTable) 106 if isfield(param,'FileName_1') 107 display_file_name(handles,param.FileName_1,0) 108 display_file_name(handles,param.FileName,1) 109 else 110 display_file_name(handles,param.FileName,0) 111 end 112 end 113 if isfield(param,'incr_i') 114 set(handles.num_incr_i,'String',num2str(param.incr_i)) 115 end 116 if isfield(param,'incr_j') 117 set(handles.num_incr_j,'String',num2str(param.incr_j)) 118 end 119 110 h=load (profil_perso); 111 %get the list of previous input files in the upper bar menu Open 112 if isfield(h,'MenuFile') 113 for ifile=1:min(length(h.MenuFile),5) 114 eval(['set(handles.MenuFile_' num2str(ifile) ',''Label'',h.MenuFile{ifile});']) 115 end 116 end 117 %get the menu of actions 118 if isfield(h,'ActionExtListUser') && iscell(h.ActionExtListUser) 119 ActionExtList=[ActionExtList; h.ActionExtListUser]; 120 end 121 if isfield(h,'ActionListUser') && iscell(h.ActionListUser) && isfield(h,'ActionPathListUser') && iscell(h.ActionPathListUser) 122 ActionList=[ActionList;h.ActionListUser]; 123 ActionPathList=[ActionPathList;h.ActionPathListUser]; 124 end 125 %get the menu of transform fct 126 if isfield(h,'TransformListUser') && iscell(h.TransformListUser) && isfield(h,'TransformPathListUser') && iscell(h.TransformPathListUser) 127 TransformList=[TransformList;h.TransformListUser]; 128 TransformPathList=[TransformPathList;h.TransformPathListUser]; 129 end 130 end 131 132 %% selection of the input Action fct 133 ActionCheckExist=false(size(ActionList)); 134 for ilist=1:numel(ActionList) 135 ActionCheckExist(ilist)=exist(fullfile(ActionPathList{ilist},[ActionList{ilist} '.m']),'file'); 136 end 137 ActionPathList=ActionPathList(ActionCheckExist,:); 138 ActionList=ActionList(ActionCheckExist); 139 set(handles.ActionName,'String',[ActionList;{'more...'}]) 140 set(handles.ActionName,'UserData',ActionPathList) 141 ActionIndex=[]; 142 if isfield(Param,'ActionName')% copy the selected menu index transferred in Param from uvmat 143 ActionIndex=find(strcmp(Param.ActionName,ActionList),1); 144 end 145 if isempty(ActionIndex) 146 ActionIndex=1; 147 end 148 set(handles.ActionName,'Value',ActionIndex) 149 set(handles.ActionPath,'String',ActionPathList{ActionIndex}) 150 set(handles.ActionExt,'Value',1) 151 set(handles.ActionExt,'String',ActionExtList) 152 153 %% selection of the input transform fct 154 TransformCheckExist=false(size(TransformList)); 155 TransformCheckExist(1)=1;%the first option is blank: no transform, always allowed 156 for ilist=2:numel(TransformList) 157 TransformCheckExist(ilist)=exist(fullfile(TransformPathList{ilist},[TransformList{ilist} '.m']),'file'); 158 end 159 TransformPathList=TransformPathList(TransformCheckExist); 160 TransformList=TransformList(TransformCheckExist); 161 set(handles.TransformName,'String',[TransformList;{'more...'}]) 162 set(handles.TransformName,'UserData',TransformPathList) 163 TransformIndex=[]; 164 if isfield(Param,'TransformName')% copy the selected menu index transferred in Param from uvmat 165 TransformIndex=find(strcmp(Param.TransformName,TransformList),1); 166 end 167 if isempty(TransformIndex) 168 TransformIndex=1; 169 end 170 set(handles.TransformName,'Value',TransformIndex) 171 set(handles.TransformPath,'String',TransformPathList{TransformIndex}) 172 120 173 %% fields input initialisation 121 if isfield(param,'list_fields')&& isfield(param,'index_fields') &&~isempty(param.list_fields) &&~isempty(param.index_fields) 122 set(handles.FieldName,'String',param.list_fields);% list menu fields 123 set(handles.FieldName,'Value',param.index_fields);% selected string index 124 end 125 if isfield(param,'Coord_x_str')&& isfield(param,'Coord_x_val') 126 set(handles.Coord_x,'String',param.Coord_x_str);% list menu fields 127 set(handles.Coord_x,'Value',param.Coord_x_val);% selected string index 128 end 129 if isfield(param,'Coord_y_str')&& isfield(param,'Coord_y_val') 130 set(handles.Coord_y,'String',param.Coord_y_str);% list menu fields 131 set(handles.Coord_y,'Value',param.Coord_y_val);% selected string index 132 end 133 134 %loads the information stored in prefdir to initiate the list of ActionName functions 135 fct_menu={'check_data_files';'aver_stat';'time_series';'merge_proj';'clean_civ_cmx'}; 136 transform_menu={'';'phys';'px';'phys_polar'}; 137 nb_builtin_ACTION=numel(fct_menu); %number of functions 138 nb_transform=numel(transform_menu); 139 [path_series,name,ext]=fileparts(which('series')); 140 path_series=fullfile(path_series,'series');%path of the function 'series' 141 addpath (path_series) ; %add the path to UVMAT, (useful in case of change of working directory after civ has been s opened in the working directory) 142 path_transform=fullfile(path_series,'transform_field');%path to the field transform functions 143 for ilist=1:length(fct_menu) 144 fct_path{ilist,1}=path_series;%paths of the fuctions buil-in in 'series.m' 145 end 146 147 %% TRANSFORM menu: loads the information stored in prefdir to initiate the list of field transform functions 148 menu_str={'';'sub_field';'phys';'phys_polar'}; 149 nb_builtin_transform=numel(menu_str); %number of functions 150 [path_uvmat,name,ext]=fileparts(which('uvmat')); 151 addpath(fullfile(path_uvmat,'transform_field')) 152 fct_handle{1,1}=[]; 153 testexist(1)=1; 154 for ilist=2:length(menu_str) 155 if exist(menu_str{ilist},'file') 156 fct_handle{ilist,1}=str2func(menu_str{ilist}); 157 testexist(ilist)=1; 158 else 159 testexist(ilist)=0; 160 end 161 end 162 rmpath(fullfile(path_uvmat,'transform_field')) 163 164 %% read the list of transform functions stored in the personal file 'uvmat_perso.mat' in prefdir 165 if test_profil_perso 166 if isfield(h,'series_fct') && iscell(h.series_fct) 167 for ilist=1:length(h.series_fct) 168 [path,file]=fileparts(h.series_fct{ilist}); 169 fct_path=[fct_path; {path}];%concatene the list of paths 170 fct_menu=[fct_menu; {file}]; 171 end 172 end 173 if isfield(h,'transform_fct') && iscell(h.transform_fct) 174 for ilist=1:length(h.transform_fct); 175 [path,file]=fileparts(h.transform_fct{ilist}); 176 addpath(path) 177 if exist(file,'file') 178 h_func=str2func(file); 179 testexist=[testexist 1]; 180 else 181 h_func=[]; 182 testexist=[testexist 0]; 183 end 184 fct_handle=[fct_handle; {h_func}];%concatene the list of paths 185 rmpath(path) 186 menu_str=[menu_str; {file}]; 187 end 188 end 189 end 190 fct_menu=[fct_menu;{'more...'}]; 191 set(handles.ActionName,'String',fct_menu) 192 set(handles.ActionName,'UserData',fct_path)% store the list of path in UserData of ACTION 193 menu_str=menu_str(find(testexist)); 194 fct_handle=fct_handle(find(testexist)); 195 menu_str=[menu_str;{'more...'}]; 196 set(handles.TransformName,'String',menu_str) 197 set(handles.TransformName,'UserData',fct_handle)% store the list of path in UserData of ACTION 174 if isfield(Param,'list_fields')&& isfield(Param,'index_fields') &&~isempty(Param.list_fields) &&~isempty(Param.index_fields) 175 set(handles.FieldName,'String',Param.list_fields);% list menu fields 176 set(handles.FieldName,'Value',Param.index_fields);% selected string index 177 end 178 if isfield(Param,'Coord_x_str')&& isfield(Param,'Coord_x_val') 179 set(handles.Coord_x,'String',Param.Coord_x_str);% list menu fields 180 set(handles.Coord_x,'Value',Param.Coord_x_val);% selected string index 181 end 182 if isfield(Param,'Coord_y_str')&& isfield(Param,'Coord_y_val') 183 set(handles.Coord_y,'String',Param.Coord_y_str);% list menu fields 184 set(handles.Coord_y,'Value',Param.Coord_y_val);% selected string index 185 end 198 186 199 187 %% Adjust the GUI according to the binaries available in PARAM.xml … … 207 195 sparam=convert(t); 208 196 catch ME 209 errormsg={' Unable to read the file PARAM.xml defining the civxbinaries:';ME.message};197 errormsg={' Unable to read the file PARAM.xml defining the binaries:';ME.message}; 210 198 end 211 199 else 212 errormsg=[xmlfile ' not found: path to civxbinaries undefined'];200 errormsg=[xmlfile ' not found: path to binaries undefined']; 213 201 end 214 202 if ~isempty(errormsg) … … 228 216 set(handles.RunMode,'String',{'local';'background';'cluster'}) 229 217 end 218 219 %% introduce the input file name(s) if defined from input Param 220 if isfield(Param,'FileName') 221 InputTable={'','','','',''}; % refresh the file input table 222 set(handles.InputTable,'Data',InputTable) 223 if isfield(Param,'FileName_1') 224 display_file_name(handles,Param.FileName_1,0) 225 display_file_name(handles,Param.FileName,1) 226 else 227 display_file_name(handles,Param.FileName,0) 228 end 229 end 230 if isfield(Param,'incr_i') 231 set(handles.num_incr_i,'String',num2str(Param.incr_i)) 232 end 233 if isfield(Param,'incr_j') 234 set(handles.num_incr_j,'String',num2str(Param.incr_j)) 235 end 236 230 237 231 238 %------------------------------------------------------------------------ … … 293 300 msg_box_uvmat('ERROR','xml file heading is not <Series>') 294 301 else 295 fill_GUI(Param,handles );%fill the GUI with the parameters retrieved from the xml file302 fill_GUI(Param,handles.series);%fill the GUI with the parameters retrieved from the xml file 296 303 if isfield(Param,'CheckObject')&& Param.CheckObject 297 304 set_object(Param.ProjObject) … … 832 839 x_index=find(pair_max{iview}>0)-index_min+1; 833 840 LineData(x_index)=1; 841 if numel(x)>1 834 842 LineData=interp1(x,LineData,xI,'nearest'); 835 843 CData(ind_y,:)=ones(size(ind_y'))*LineData; 844 end 836 845 end 837 846 CData=cat(3,zeros(size(CData)),CData,zeros(size(CData))); … … 1306 1315 RunModeList=get(handles.RunMode,'String'); 1307 1316 RunMode=RunModeList{get(handles.RunMode,'Value')}; 1308 1317 ActionExtList=get(handles.ActionExt,'String'); 1318 ActionExt=ActionExtList{get(handles.ActionExt,'Value')};% '.m' or '.sh' (compiled) 1319 ActionPath=get(handles.ActionPath,'String'); 1320 ActionList=get(handles.ActionName,'String'); 1321 ActionName=ActionList{get(handles.ActionName,'Value')}; 1322 1323 %% set nbre of processes 1324 if isfield(Series,'NbSlice')&&~isempty(Series.NbSlice) 1325 NbProcess=Series.NbSlice; 1326 else 1327 switch RunMode 1328 case {'local','background'} 1329 NbCore=1;% no need to split the calculation 1330 case 'cluster' 1331 if strcmp(Series.Action.ActionExt,'.m')% case of Matlab function (uncompiled) 1332 NbCore=1;% one core used only (limitation of Matlab licences) 1333 msgbox_uvmat('WARNING','Number of cores =1: select the compiled version civ_matlab.sh for multi-core processing'); 1334 else 1335 answer=inputdlg({'Number of cores (max 36)','extra oar options'},'oarsub parameter',1,{'12',''}); 1336 NbCore=str2double(answer{1}); 1337 end 1338 end 1339 NbProcess=NbCore;% choose one process per core 1340 end 1341 for iprocess=1:NbProcess% TOD0 1342 % split the input files 1343 % adjust Param 1344 % create xmlfile and batfile 1345 end 1309 1346 switch RunMode 1310 1347 case 'local' 1311 Series=h_fun(Series); 1312 if ~isempty(filexml) 1313 t=struct2xml(Series); 1314 t=set(t,1,'name','Series'); 1315 save(t,filexml); 1348 switch ActionExt 1349 case '.m' 1350 for iprocess=1:NbProcess 1351 if ~isempty(filexml) 1352 t=struct2xml(Series); 1353 t=set(t,1,'name','Series'); 1354 save(t,filexml); 1355 end 1356 Series.RUNHandle=handles.RUN; 1357 Series.WaitbarHandle=handles.Waitbar; 1358 Series=h_fun(Series); 1359 end 1360 case '.sh' 1361 for iprocess=1:NbProcess 1362 CivmBin=fullfile(ActionPath,[ActionName '.sh']); %path to the source directory of uvmat 1363 switch computer 1364 case {'PCWIN','PCWIN64'} 1365 filename=regexprep(filename,'\\','\\\\');% add '\' so that '\' are left as characters 1366 % TODO launch command in DOS 1367 case {'GLNX86','GLNXA64','MACI64'} 1368 cmd=['#!/bin/bash \n '... 1369 '#$ -cwd \n '... 1370 'hostname && date \n '... 1371 'umask 002 \n'... 1372 CivmBin ' ' Param.xml.RunTime ' ' regexprep(filename,'(.+)([/\\])(.+$)','$1$20_XML$2$3.xml') ' ' Param.OutputFile '.nc'];%allow writting access to created files for user group 1373 end 1374 end 1316 1375 end 1317 1376 case 'background' … … 1320 1379 else 1321 1380 % update the xml file after interactive input with the function 1322 Series.Specific='?';1323 Series=h_fun(Series);1381 % Series.Specific='?'; 1382 % Series=h_fun(Series); 1324 1383 t=struct2xml(Series); 1325 1384 t=set(t,1,'name','Series'); … … 1327 1386 path_uvmat=fileparts(which('uvmat')); 1328 1387 1329 filename_bat=regexprep(filexml,'.xml$','.bat'); 1388 filename_bat=regexprep(filexml,'.xml$','.bat');% create executable file to run program in background 1330 1389 [fid,message]=fopen(filename_bat,'w'); 1331 1390 if isequal(fid,-1) … … 1333 1392 return 1334 1393 end 1335 path_fct=get(handles.ActionPath,'String');1394 %ActionPath=get(handles.ActionPath,'String'); 1336 1395 filelog=regexprep(filexml,'.xml$','.log'); 1337 1396 … … 1362 1421 end 1363 1422 end 1364 update_waitbar(handles.Waitbar,1); % put the waitbar to end position to indicate lounching is finished 1423 update_waitbar(handles.Waitbar,1); % put the waitbar to end position to indicate launching is finished 1424 case 'cluster' %NOT YET READY 1425 switch batch_mode 1426 case 'sge' %at the moment only psmn ENS Lyon uses it 1427 for p=1:length(batch_file_list) 1428 cmd=['!qsub -q piv1,piv2,piv3 '... 1429 '-e ' regexprep(batch_file_list{p},'.bat','.errors') ' -o ' regexprep(batch_file_list{p},'.bat','.log ')... 1430 ' -v ' 'LD_LIBRARY_PATH=/home/sjoubaud/matlab_sylvain/civx/lib ' batch_file_list{p}]; 1431 display(cmd);eval(cmd); 1432 end 1433 case 'oar' 1434 max_walltime=3600*12; % 12h max 1435 oar_modes={'oar-parexec','oar-dispatch','mpilauncher'}; 1436 text={'Batch processing on servcalcul3 LEGI';... 1437 'Please choose one of the followint modes';... 1438 '* oar-parexec : default and best choice';... 1439 '* oar-dispatch : jobs in a container of several cores';... 1440 '* mpilauncher : one single parallel mpi job using several cores';... 1441 '**********************************'... 1442 }; 1443 [S,v]=listdlg('PromptString',text,'ListString',oar_modes,... 1444 'SelectionMode','single','ListSize',[400 100],'Name','LEGI job mode'); 1445 switch oar_modes{S} 1446 case 'oar-parexec' %oar-dispatch.pl 1447 % if strcmp(Series.Action.ActionExt,'.m')% case of Matlab function (uncompiled) 1448 % ncores=1;% one core used only (limitation of Matlab licences) 1449 % msgbox_uvmat('WARNING','Number of cores =1: select the compiled version civ_matlab.sh for multi-core processing'); 1450 % else 1451 % answer=inputdlg({'Number of cores (max 36)','extra oar options'},'oarsub parameter',1,{'12',''}); 1452 % ncores=str2double(answer{1}); 1453 % end 1454 1455 extra_oar=answer{2}; 1456 walltime_onejob=600;%seconds 1457 filename_joblist=fullfile(RootBat,'job_list.txt'); 1458 fid=fopen(filename_joblist,'w'); 1459 for p=1:length(batch_file_list) 1460 fprintf(fid,[batch_file_list{p} '\n']);% list of exe files (TODO: create them) 1461 end 1462 fclose(fid); 1463 oar_command=['oarsub -n CIVX '... 1464 '-t idempotent --checkpoint ' num2str(walltime_onejob+60) ' '... 1465 '-l /core=' num2str(ncores) ','... 1466 'walltime=' datestr(min(1.05*walltime_onejob/86400*max(length(batch_file_list),ncores)/ncores,max_walltime/86400),13) ' '... 1467 '-E ' regexprep(filename_joblist,'\.txt\>','.stderr') ' '... 1468 '-O ' regexprep(filename_joblist,'\.txt\>','.stdout') ' '... 1469 extra_oar ' '... 1470 '"oar-parexec -s -f ' filename_joblist ' '... 1471 '-l ' filename_joblist '.log"\n']; 1472 filename_oarcommand=fullfile(RootBat,'oar_command'); 1473 fid=fopen(filename_oarcommand,'w'); 1474 fprintf(fid,oar_command); 1475 fclose(fid); 1476 fprintf(oar_command);% display in command line 1477 system(oar_command); 1478 case 'oar-dispatch' %oar-dispatch.pl 1479 ncores=str2double(... 1480 inputdlg('Number of cores (max 36)','oarsub parameter',1,{'6'})... 1481 ); 1482 walltime_onejob=600;%seconds 1483 filename_joblist=fullfile(RootBat,'job_list.txt'); 1484 fid=fopen(filename_joblist,'w'); 1485 for p=1:length(batch_file_list) 1486 oar_command=['oarsub -n CIVX '... 1487 '-E ' regexprep(batch_file_list{p},'\.bat\>','.stderr') ' -O ' regexprep(batch_file_list{p},'\.bat\>','.stdout ')... 1488 '-l "/core=1,walltime=' datestr(walltime_onejob/86400,13) '" ' batch_file_list{p}]; 1489 fprintf(fid,[oar_command '\n']); 1490 end 1491 fclose(fid); 1492 oar_command=['oarsub -t container -n civx-container '... 1493 '-l /core=' num2str(ncores)... 1494 ',walltime=' datestr(1.05*walltime_onejob/86400*max(length(batch_file_list),ncores)/ncores,13) ' '... 1495 '-E ' regexprep(filename_joblist,'\.txt\>','.stderr') ' '... 1496 '-O ' regexprep(filename_joblist,'\.txt\>','.stdout') ' '... 1497 '"oar-dispatch -f ' filename_joblist '"']; 1498 filename_oarcommand=fullfile(RootBat,'oar_command'); 1499 fid=fopen(filename_oarcommand,'w'); 1500 fprintf(fid,[oar_command '\n']); 1501 fclose(fid); 1502 display(oar_command); 1503 eval(['! . ' filename_oarcommand]) 1504 case 'mpilauncher' 1505 filename_joblist=fullfile(RootBat,'job_list.txt'); 1506 fid=fopen(filename_joblist,'w'); 1507 1508 for p=1:length(batch_file_list) 1509 fprintf(fid,[batch_file_list{p} '\n']); 1510 end 1511 fclose(fid) 1512 text_oarscript=[... 1513 '#!/bin/bash \n'... 1514 '#OAR -n Mylauncher \n'... 1515 '#OAR -l node=4/core=5,walltime=0:15:00 \n'... 1516 '#OAR -E ' fullfile(RootBat,'stderrfile.log') ' \n'... 1517 '#OAR -O ' fullfile(RootBat,'stdoutfile.log') ' \n'... 1518 '# ========================================================= \n'... 1519 '# This simple program launch a multinode parallel OpenMPI mpilauncher \n'... 1520 '# application for coriolis PIV post-processing. \n'... 1521 '# OAR uses oarshmost wrapper to propagate the user environement. \n'... 1522 '# This wrapper assert that the user has the same environment on all the \n'... 1523 '# allocated nodes (basic behavior needed by most MPI applications). \n'... 1524 '# \n'... 1525 '# REQUIREMENT: \n'... 1526 '# the oarshmost wrapper should be installed in $HOME/bin directory. \n'... 1527 '# If a different location is used, change the line following the comment "Bidouille" \n'... 1528 '# ========================================================= \n'... 1529 '# USER should only modify these 2 lines \n'... 1530 'WORKDIR=' pwd ' \n'... 1531 'COMMANDE="mpilauncher -f ' filename_joblist '" \n'... 1532 '# ========================================================= \n'... 1533 '# DO NOT MODIFY the FOLOWING LINES. (or be carefull) \n'... 1534 'echo "job starting on: "`hostname` \n'... 1535 'MPINODES="-host `tr [\\\\\\n] [,] <$OAR_NODEFILE |sed -e "s/,$/ /"`" \n'... 1536 'NCPUS=`cat $OAR_NODEFILE |wc -l` \n'... 1537 '#========== Bidouille ============== \n'... 1538 'export OMPI_MCA_plm_rsh_agent=oar-envsh \n'...% 'cd $WORKDIR \n'... 1539 'CMD="mpirun -np $NCPUS -wdir $WORKDIR $MPINODES $COMMANDE" \n'... 1540 'echo "I run: $CMD" \n'... 1541 '$CMD \n'... 1542 'echo "job ending" \n'... 1543 ]; 1544 filename_oarscript=fullfile(RootBat,'oar_command'); 1545 fid=fopen(filename_oarscript,'w'); 1546 fprintf(fid,[text_oarscript]); 1547 fclose(fid); 1548 eval(['!chmod +x ' filename_oarscript]); 1549 eval(['!oarsub -S ' filename_oarscript]); 1550 end 1551 end 1365 1552 end 1366 1553 1367 1554 set(handles.RUN, 'Enable','On') 1368 1555 set(handles.RUN,'BackgroundColor',[1 0 0]) 1556 set(handles.RUN, 'Value',0) 1369 1557 1370 1558 %------------------------------------------------------------------------ … … 1374 1562 set(handles.RUN,'BackgroundColor',[1 0 0]) 1375 1563 set(handles.RUN,'enable','on') 1564 set(handles.RUN, 'Value',0) 1376 1565 1377 1566 % %------------------------------------------------------------------------ … … 1387 1576 %------------------------------------------------------------------------ 1388 1577 % --- Main launch command, called by RUN and BATCH 1578 1389 1579 function [h_fun,Series,filexml,errormsg]=prepare_jobs(handles,run) 1390 1580 %INPUT: … … 1403 1593 Series=read_GUI(handles.series); 1404 1594 if isfield(Series,'Pairs') 1405 Series=rmfield(Series,'Pairs'); %info Pairs not needed for output1595 Series=rmfield(Series,'Pairs'); %info Pairs not needed for output 1406 1596 end 1407 1597 … … 1432 1622 end 1433 1623 1434 if last_i < first_i | last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),...1624 if last_i < first_i || last_j < first_j , msgbox_uvmat('ERROR','last field number must be larger than the first one'),... 1435 1625 set(handles.RUN, 'Enable','On'), set(handles.RUN,'BackgroundColor',[1 0 0]),return,end; 1436 1626 … … 1462 1652 index=get(handles.ActionName,'Value'); 1463 1653 action= list_action{index}; % selected string 1464 Series.hseries=handles.series; % handles to the series GUI1654 %Series.hseries=handles.series; % handles to the series GUI 1465 1655 path_series=which('series'); 1466 list_path=get(handles.ActionName,'UserData');1467 fct_path=list_path{index}; %path stored for the function ACTION1468 if ~isequal( fct_path,path_series)1656 ActionPathList=get(handles.ActionName,'UserData'); 1657 ActionPath=ActionPathList{index}; %path stored for the function ACTION 1658 if ~isequal(ActionPath,path_series) 1469 1659 eval(['spath=which(''' action ''');']) %spath = current path of the selected function ACTION 1470 if ~exist( fct_path,'dir')1471 errormsg=['The prescribed function path ' fct_path ' does not exist'];1660 if ~exist(ActionPath,'dir') 1661 errormsg=['The prescribed function path ' ActionPath ' does not exist']; 1472 1662 return 1473 1663 end 1474 if ~isequal(spath, fct_path)1475 addpath( fct_path)% add the prescribed path if not the current one1664 if ~isequal(spath,ActionPath) 1665 addpath(ActionPath)% add the prescribed path if not the current one 1476 1666 end 1477 1667 end 1478 1668 eval(['h_fun=@' action ';'])%create a function handle for ACTION 1479 if ~isequal( fct_path,path_series)1480 rmpath( fct_path)% add the prescribed path if not the current one1669 if ~isequal(ActionPath,path_series) 1670 rmpath(ActionPath)% add the prescribed path if not the current one 1481 1671 end 1482 1672 1483 1673 %% create the output data directory and write in it the xml file from the GUI config 1484 1674 %determine the root file corresponding to the first sub dir 1485 if isfield(Series,'OutputSubDir')1486 SubDirOut=[ Series.OutputSubDirSeries.OutputDirExt];1675 if get(handles.RUN,'value') && isfield(Series,'OutputSubDir') 1676 SubDirOut=[get(handles.OutputSubDir,'String') Series.OutputDirExt]; 1487 1677 SubDirOutNew=SubDirOut; 1488 1678 iview=1; 1489 1679 SeriesData=get(handles.series,'UserData'); 1490 if size(Series.InputTable,1)>1 && isfield(SeriesData,'AllowInputSort') && isfield(SeriesData.AllowInputSort)1680 if size(Series.InputTable,1)>1 && isfield(SeriesData,'AllowInputSort') && SeriesData.AllowInputSort 1491 1681 [tild,iview]=sort(Series.InputTable(:,2)); %subdirectories sorted in alphabetical order 1492 1682 Series.InputTable=Series.InputTable(iview,:); … … 1529 1719 Series.IndexRange=rmfield(Series.IndexRange,'MaxIndex'); 1530 1720 %removes empty lines of InputTable 1531 empty_line= zeros(size(Series.InputTable,1),1);1721 empty_line=false(size(Series.InputTable,1),1); 1532 1722 for iline=1:size(Series.InputTable,1) 1533 1723 empty_line(iline)=isequal(Series.InputTable(iline,1:3),{'','',''}); 1534 1724 end 1535 Series.InputTable( find(empty_line),:)=[];1725 Series.InputTable(empty_line,:)=[]; 1536 1726 1537 1727 %------------------------------------------------------------------------ … … 1539 1729 function ActionName_Callback(hObject, eventdata, handles) 1540 1730 %------------------------------------------------------------------------ 1541 global nb_builtin_ACTION 1542 list_ACTION=get(handles.ActionName,'String');% list menu fields 1543 index_ACTION=get(handles.ActionName,'Value');% selected string index 1544 ACTION= list_ACTION{index_ACTION}; % selected function name 1545 path_series=which('series');%path to series.m 1546 list_path=get(handles.ActionName,'UserData');%list of recorded paths to functions of the list ACTION 1547 default_file=fullfile(list_path{end},ACTION); 1548 % add a new function to the menu if the selected item is 'more...' 1549 if isequal(ACTION,'more...') 1550 pathfct=fileparts(path_series); 1551 [FileName, PathName, filterindex] = uigetfile( ... 1552 {'*.m', ' (*.m)'; 1731 %% stop any ongoing series processing 1732 if isequal(get(handles.RUN,'Value'),1) 1733 answer= msgbox_uvmat('INPUT_Y-N','stop current Action process?'); 1734 if strcmp(answer,'Yes') 1735 STOP_Callback(hObject, eventdata, handles) 1736 else 1737 return 1738 end 1739 end 1740 1741 %% get Action name and path 1742 nb_builtin_ACTION=4; %nbre of functions initially proposed in the menu ActionName (as defined in the Opening fct of series) 1743 ActionList=get(handles.ActionName,'String');% list menu fields 1744 ActionIndex=get(handles.ActionName,'Value'); 1745 if ~isequal(ActionIndex,1) 1746 InputTable=get(handles.InputTable,'Data'); 1747 if isempty(InputTable{1,4}) 1748 msgbox_uvmat('ERROR','no input file available: use Open in the menu bar') 1749 return 1750 end 1751 end 1752 ActionName= ActionList{get(handles.ActionName,'Value')}; % selected function name 1753 ActionPathList=get(handles.ActionName,'UserData');%list of recorded paths to functions of the list ActionName 1754 1755 %% add a new function to the menu if 'more...' has been selected in the menu ActionName 1756 if isequal(ActionName,'more...') 1757 [FileName, PathName] = uigetfile( ... 1758 {'*.m', ' (*.m)'; 1553 1759 '*.m', '.m files '; ... 1554 1760 '*.*', 'All Files (*.*)'}, ... 1555 'Pick a file',default_file);1761 'Pick a series processing function ',get(handles.ActionPath,'String')); 1556 1762 if length(FileName)<2 1557 1763 return 1558 end 1559 [pp,ACTION,ext_fct]=fileparts(FileName);%(end-1:end); 1560 if ~isequal(ext_fct,'.m') 1561 msgbox_uvmat('ERROR','a Matlab function .m must be introduced'); 1562 return 1563 end 1764 end 1765 [ActionPath,ActionName,ActionExt]=fileparts(FileName); 1766 % insert the choice in the menu 1767 ActionIndex=find(strcmp(ActionName,ActionList),1);% look for the selected function in the menu Action 1768 if isempty(ActionIndex)%the input string does not exist in the menu 1769 ActionIndex= length(ActionList); 1770 ActionList=[ActionList(1:end-1);{ActionName};ActionList(end)];% the selected function is appended in the menu, before the last item 'more...' 1771 set(handles.ActionName,'String',ActionList) 1772 end 1773 %set(handles.ActionName,'Value',ActionIndex) 1774 %list_path{ActionIndex}=PathName; 1775 % remove old Action options in the menu (keeping a menu length <nb_builtin_ACTION+5) 1776 if length(ActionList)>nb_builtin_ACTION+5; %nb_builtin=nbre of functions always remaining in the initial menu 1777 nbremove=length(ActionList)-nb_builtin_ACTION-5; 1778 ActionList(nb_builtin_ACTION+1:end-5)=[]; 1779 ActionPathList(nb_builtin_ACTION+1:end-4)=[]; 1780 ActionIndex=ActionIndex-nbremove; 1781 end 1782 set(handles.ActionName,'Value',ActionIndex) 1783 set(handles.ActionName,'String',ActionList) 1784 ActionPathList{ActionIndex}=PathName; 1785 set(handles.ActionPath,'enable','inactive')% indicate that the current path is accessible (not 'off') 1564 1786 1565 % insert the choice in the actionname menu 1566 menu_str=update_menu(handles.ActionName,ACTION);%new action menu in which the new item has been appended if needed 1567 index_ACTION=get(handles.ActionName,'Value');% currently selected index in the list 1568 list_path{index_ACTION}=PathName; 1569 if length(menu_str)>nb_builtin_ACTION+5; %nb_builtin=nbre of functions always remaining in the initial menu 1570 nbremove=length(menu_str)-nb_builtin_ACTION-5; 1571 menu_str(nb_builtin_ACTION+1:end-5)=[]; 1572 list_path(nb_builtin_ACTION+1:end-4)=[]; 1573 index_ACTION=index_ACTION-nbremove; 1574 set(handles.ActionName,'Value',index_ACTION) 1575 set(handles.ActionName,'String',menu_str) 1576 end 1577 list_path{index_ACTION}=PathName; 1578 set(handles.ActionName,'UserData',list_path); 1579 set(handles.ActionPath,'enable','inactive')% indicate that the current path is accessible (not 'off') 1580 1581 %record the current menu in personal file profil_perso 1582 dir_perso=prefdir; 1583 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 1584 for ilist=nb_builtin_ACTION+1:length(menu_str)-1 1585 series_fct{ilist-nb_builtin_ACTION}=fullfile(list_path{ilist},[menu_str{ilist} '.m']); 1586 end 1587 if nb_builtin_ACTION+1<=length(menu_str)-1 1588 if exist(profil_perso,'file')% && nb_builtin_ACTION+1>=length(menu_str)-1 1589 save(profil_perso,'series_fct','-append') 1590 else 1591 txt=ver('MATLAB'); 1592 Release=txt.Release; 1593 relnumb=str2num(Release(3:4)); 1594 if relnumb >= 14%recent relaese of Matlab 1595 save(profil_perso,'series_fct','-V6') 1596 else 1597 save(profil_perso, 'series_fct') 1598 end 1599 end 1600 end 1601 end 1602 1603 %check the current ActionPath to the selected function 1604 PathName=list_path{index_ACTION};%current recorded path 1787 % record the file extension and update the paths in userdata 1788 ActionExtList=get(handles.ActionExt,'String'); 1789 ActionExtIndex=find(strcmp(ActionExt,ActionExtList), 1); 1790 if isempty(ActionExtIndex) 1791 set(handles.ActionExt,'String',[ActionExtList;{ActionExt}]) 1792 set(handles.ActionExt,'Value',numel(ActionExtList)+1) 1793 ActionPathNew=cell(size(ActionPathList,1),1);%new column of ActionPath 1794 ActionPathNew{ActionIndex}=ActionPath; 1795 ActionPathList=[ActionPathList ActionPathNew]; 1796 end 1797 set(handles.ActionName,'UserData',ActionPathList); 1798 1799 %record the current menu in personal file profil_perso 1800 dir_perso=prefdir; 1801 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 1802 if nb_builtin_ACTION+1<=length(ActionList)-1 1803 ActionListUser=ActionList(nb_builtin_ACTION+1:numel(ActionList)-1); 1804 ActionPathListUser=ActionPathList(nb_builtin_ACTION+1:numel(ActionList)-1,:); 1805 ActionExtListUser={}; 1806 if numel(ActionExtList)>2 1807 ActionExtListUser=ActionExtList(3:end); 1808 end 1809 if exist(profil_perso,'file') 1810 save(profil_perso,'ActionListUser','ActionPathListUser','ActionExtListUser','-append') 1811 else 1812 save(profil_perso,'ActionListUser','ActionPathListUser','ActionExtListUser','-V6') 1813 end 1814 end 1815 end 1816 1817 %% check the current ActionPath to the selected function 1818 PathName=ActionPathList{ActionIndex};%current recorded path 1605 1819 set(handles.ActionPath,'String',PathName); %show the path to the senlected function 1606 1820 1607 % reinitialise the waitbar1821 %% reinitialise the waitbar 1608 1822 update_waitbar(handles.Waitbar,0) 1609 1823 1610 %default setting for the visibility of the GUI elements 1611 set(handles.num_NbSlice,'Visible','off') 1612 set(handles.NbSlice_title,'Visible','off') 1613 set(handles.VelType,'Visible','off'); 1614 set(handles.VelType_text,'Visible','off'); 1615 set(handles.VelType_1,'Visible','off'); 1616 set(handles.VelType_text_1,'Visible','off'); 1617 set(handles.InputFields,'Visible','off') 1618 set(handles.FieldName_1,'Visible','off') 1619 %view_FieldMenu_1(handles,'off') 1824 %% default setting for the visibility of the GUI elements 1620 1825 set(handles.FieldTransform,'Visible','off') 1621 1826 set(handles.CheckObject,'Visible','off'); … … 1623 1828 set(handles.CheckMask,'Visible','off') 1624 1829 set(handles.Mask,'Visible','off') 1625 set(handles.OutputDirExt,'Visible','off') 1626 set(handles.OutputSubDir,'Visible','off') 1627 set(handles.OutputDir_title,'Visible','off') 1628 %set the displayed GUI item needed for input parameters 1629 if ~isequal(path_series,PathName) 1630 addpath(PathName) 1631 end 1632 eval(['h_function=@' ACTION ';']); 1830 1831 %% run the current action function to prepare the input GUI 1832 [h_fun,Series,tild,errormsg]=prepare_jobs(handles); 1833 if ~isempty(errormsg) 1834 msgbox_uvmat('ERROR',errormsg) 1835 return 1836 end 1837 ParamOut=h_fun(Series); 1838 1839 %% Put the first line of the selected Action fct as tootip help 1633 1840 try 1634 [fid,errormsg] =fopen([A CTION'.m']);1841 [fid,errormsg] =fopen([ActionName '.m']); 1635 1842 InputText=textscan(fid,'%s',1,'delimiter','\n'); 1636 1843 fclose(fid); 1637 1844 set(handles.ActionName,'ToolTipString',InputText{1}{1})% put the first line of the selected function as tooltip help 1638 1845 end 1639 if ~isequal(path_series,PathName) 1640 rmpath(PathName) 1641 end 1642 varargout=h_function(); 1846 % if ~isequal(path_series,PathName) 1847 % rmpath(PathName) 1848 % end 1643 1849 Param_list={}; 1644 1850 1645 InputTable=get(handles.InputTable,'Data'); 1646 nbview=size(InputTable,1); 1851 %% Detect the types of input files 1647 1852 SeriesData=get(handles.series,'UserData'); 1648 nb_civ=numel(find(strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType))); 1649 nb_netcdf=numel(find(strcmp('netcdf',SeriesData.FileType))); 1650 for ilist=1:length(varargout)-1 1651 switch varargout{ilist} 1652 case 'AllowInputSort' 1653 if isequal(lower(varargout{ilist+1}),'on')% sort the input table by alphabetical order of the SubDir 1654 SeriesData.AllowInputSort=1; 1655 set(handles.series,'UserData',SeriesData) 1656 end 1657 case 'WholeIndexRange' 1658 if isequal(lower(varargout{ilist+1}),'on')% set by default the input index range from min to max 1659 MinIndex=get(handles.MinIndex,'Data'); 1660 MaxIndex=get(handles.MaxIndex,'Data'); 1661 if ~isempty(MinIndex) 1662 set(handles.num_first_i,'String',num2str(MinIndex{1})) 1663 set(handles.num_last_i,'String',num2str(MaxIndex{1})) 1664 set(handles.num_incr_i,'String','1') 1665 if size(MinIndex,2)>=2 1666 set(handles.num_first_j,'String',num2str(MinIndex{1,2})) 1667 set(handles.num_last_j,'String',num2str(MaxIndex{1,2})) 1668 set(handles.num_incr_j,'String','1') 1669 end 1670 end 1671 end 1672 case 'NbSlice' %hidden by default 1673 if isequal(lower(varargout{ilist+1}),'on') 1674 set(handles.num_NbSlice,'Visible','on') 1675 set(handles.NbSlice_title,'Visible','on') 1676 end 1677 case 'VelType' %hidden by default 1678 if isequal(lower(varargout{ilist+1}),'one') || isequal(lower(varargout{ilist+1}),'two') 1679 if nb_civ>=1 1680 set(handles.VelType,'Visible','on') 1681 set(handles.VelType_text,'Visible','on'); 1682 end 1683 end 1684 if isequal(lower(varargout{ilist+1}),'two') 1685 if nb_civ>=2 1686 set(handles.VelType_1,'Visible','on') 1687 set(handles.VelType_text_1,'Visible','on'); 1688 end 1689 end 1690 case 'FieldName' %hidden by default 1691 if isequal(lower(varargout{ilist+1}),'one')||isequal(lower(varargout{ilist+1}),'two') 1692 if (nb_civ+nb_netcdf)>=1 1693 set(handles.FieldName,'Visible','on') % test for MenuBorser 1694 set(handles.InputFields,'Visible','on') 1695 end 1696 end 1697 if isequal(lower(varargout{ilist+1}),'two') 1698 if (nb_civ+nb_netcdf)>=1 1699 set(handles.FieldName_1,'Visible','on') 1700 end 1701 end 1702 case 'FieldTransform' %hidden by default 1703 if isequal(lower(varargout{ilist+1}),'on') 1704 set(handles.TransformName,'Enable','on') 1705 set(handles.FieldTransform,'Visible','on') 1706 TransformName_Callback([],[], handles) 1707 end 1708 case 'ProjObject' %hidden by default 1709 if isequal(lower(varargout{ilist+1}),'on') 1710 set(handles.CheckObject,'Visible','on') 1711 set(handles.ProjObject,'Visible','on') 1712 end 1713 case 'Mask' %hidden by default 1714 if isequal(lower(varargout{ilist+1}),'on') 1715 set(handles.Mask,'Visible','on') 1716 set(handles.CheckMask,'Visible','on'); 1717 end 1718 case 'OutputDirExt' 1719 if ~isempty(varargout{ilist+1}) 1720 set(handles.OutputDirExt,'String',varargout{ilist+1}) 1721 set(handles.OutputDirExt,'Visible','on') 1722 set(handles.OutputSubDir,'Visible','on') 1723 set(handles.OutputDir_title,'Visible','on') 1724 end 1725 end 1726 end 1727 if ~isempty(Param_list) 1728 set(handles.ParamKey,'String',Param_list) 1729 set(handles.ParamVal,'Visible','on') 1730 end 1853 nb_civ=0;nb_netcdf=0; 1854 if ~isempty(SeriesData) 1855 nb_civ=numel(find(strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType))); 1856 nb_netcdf=numel(find(strcmp('netcdf',SeriesData.FileType))); 1857 end 1858 1859 %% Check whether alphabetical sorting of input Subdir is alowed by the Action fct (for multiples series entries) 1860 SeriesData.AllowInputSort=0;%default 1861 if isfield(ParamOut,'AllowInputSort')&&isequal(ParamOut.AllowInputSort,'on') 1862 SeriesData.AllowInputSort=1; 1863 end 1864 1865 %% Impose the whole input file index range if requested 1866 if isfield(ParamOut,'WholeIndexRange')&&isequal(ParamOut.WholeIndexRange,'on') 1867 MinIndex=get(handles.MinIndex,'Data'); 1868 MaxIndex=get(handles.MaxIndex,'Data'); 1869 if ~isempty(MinIndex) 1870 set(handles.num_first_i,'String',num2str(MinIndex{1})) 1871 set(handles.num_last_i,'String',num2str(MaxIndex{1})) 1872 set(handles.num_incr_i,'String','1') 1873 if size(MinIndex,2)>=2 1874 set(handles.num_first_j,'String',num2str(MinIndex{1,2})) 1875 set(handles.num_last_j,'String',num2str(MaxIndex{1,2})) 1876 set(handles.num_incr_j,'String','1') 1877 end 1878 end 1879 end 1880 1881 %% NbSlice visibility 1882 NbSliceVisible='off';%default 1883 if isfield(ParamOut,'NbSlice') && isequal(ParamOut.NbSlice,'on') 1884 NbSliceVisible='on'; 1885 set(handles.num_NbProcess,'String',get(handles.num_NbSlice,'String'))% the nbre of processes is imposed as the nbre of slices 1886 else 1887 set(handles.num_NbProcess,'String','')% free nbre of processes 1888 end 1889 set(handles.num_NbSlice,'Visible',NbSliceVisible) 1890 set(handles.NbSlice_title,'Visible',NbSliceVisible) 1891 1892 %% Visibility of VelType and VelType_1 menus 1893 VelTypeVisible='off'; %hidden by default 1894 VelType_1Visible='off'; 1895 InputFieldsVisible='off';%visibility of the frame Fields 1896 if isfield(ParamOut,'VelType') 1897 if strcmp( ParamOut.VelType,'one')||strcmp( ParamOut.VelType,'two') 1898 if nb_civ>=1 1899 VelTypeVisible='on'; 1900 InputFieldsVisible='on'; 1901 end 1902 end 1903 if strcmp( ParamOut.VelType,'two') 1904 if nb_civ>=2 1905 VelType_1Visible='on'; 1906 end 1907 end 1908 end 1909 set(handles.VelType,'Visible',VelTypeVisible) 1910 set(handles.VelType_text,'Visible',VelTypeVisible); 1911 set(handles.VelType_1,'Visible',VelType_1Visible) 1912 set(handles.VelType_text_1,'Visible',VelType_1Visible); 1913 1914 %% Visibility of FieldName and FieldName_1 menus 1915 FieldNameVisible='off'; %hidden by default 1916 FieldName_1Visible='off'; %hidden by default 1917 if isfield(ParamOut,'FieldName') 1918 if strcmp( ParamOut.FieldName,'one')||strcmp( ParamOut.FieldName,'two') 1919 if (nb_civ+nb_netcdf)>=1 1920 InputFieldsVisible='on'; 1921 FieldNameVisible='on'; 1922 end 1923 end 1924 if strcmp( ParamOut.FieldName,'two') 1925 if (nb_civ+nb_netcdf)>=1 1926 FieldName_1Visible='on'; 1927 end 1928 end 1929 end 1930 set(handles.InputFields,'Visible',InputFieldsVisible) 1931 set(handles.FieldName,'Visible',FieldNameVisible) % test for MenuBorser 1932 set(handles.FieldName_1,'Visible',FieldName_1Visible) 1933 1934 %% Visibility of FieldTransform menu 1935 FieldTransformVisible='off'; %hidden by default 1936 if isfield(ParamOut,'FieldTransform') 1937 FieldTransformVisible=ParamOut.FieldTransform; 1938 TransformName_Callback([],[], handles) 1939 end 1940 set(handles.FieldTransform,'Visible',FieldTransformVisible) 1941 1942 %% Visibility of projection object 1943 ProjObjectVisible='off'; %hidden by default 1944 if isfield(ParamOut,'ProjObject') 1945 ProjObjectVisible=ParamOut.ProjObject; 1946 end 1947 set(handles.CheckObject,'Visible',ProjObjectVisible) 1948 if ~get(handles.CheckObject,'Value') 1949 ProjObjectVisible='off'; 1950 end 1951 set(handles.ProjObject,'Visible',ProjObjectVisible) 1952 set(handles.DeleteObject,'Visible',ProjObjectVisible) 1953 set(handles.ViewObject,'Visible',ProjObjectVisible) 1954 1955 1956 %% Visibility of mask input 1957 MaskVisible='off'; %hidden by default 1958 if isfield(ParamOut,'Mask') 1959 MaskVisible=ParamOut.Mask; 1960 end 1961 set(handles.Mask,'Visible',MaskVisible) 1962 set(handles.CheckMask,'Visible',MaskVisible); 1963 1964 %% definition of the directory containing the output files 1965 OutputDirVisible='off'; 1966 if isfield(ParamOut,'OutputDirExt')&&~isempty(ParamOut.OutputDirExt) 1967 set(handles.OutputDirExt,'String',ParamOut.OutputDirExt) 1968 OutputDirVisible='on'; 1969 end 1970 set(handles.OutputDirExt,'Visible',OutputDirVisible) 1971 set(handles.OutputSubDir,'Visible',OutputDirVisible) 1972 set(handles.OutputDir_title,'Visible',OutputDirVisible) 1973 set(handles.RunMode,'Visible',OutputDirVisible) 1974 set(handles.ActionExt,'Visible',OutputDirVisible) 1975 set(handles.RunMode_title,'Visible',OutputDirVisible) 1976 set(handles.ActionExt_title,'Visible',OutputDirVisible) 1977 1978 %% definition of an additional parameter set, determined by an ancillary GUI 1979 if isfield(ParamOut,'ActionInput') 1980 set(handles.ActionInput,'Visible','on') 1981 set(handles.ActionInput_title,'Visible','on') 1982 set(handles.ActionInput,'String',ActionName) 1983 SeriesData.ActionInput=ParamOut.ActionInput; 1984 else 1985 set(handles.ActionInput,'Visible','off') 1986 set(handles.ActionInput_title,'Visible','off') 1987 if isfield(SeriesData,'ActionInput') 1988 SeriesData=rmfield(SeriesData,'ActionInput'); 1989 end 1990 end 1991 set(handles.series,'UserData',SeriesData) 1731 1992 1732 1993 %------------------------------------------------------------------------ … … 1885 2146 hset_object=set_object(data);% call the set_object interface 1886 2147 end 1887 Object=read_GUI(hset_object); 1888 set(handles.ProjObject,'String',Object.Name);%display the object name 2148 ProjObject=read_GUI(hset_object); 2149 set(handles.ProjObject,'String',ProjObject.Name);%display the object name 2150 SeriesData=get(handles.series,'UserData'); 2151 SeriesData.ProjObject=ProjObject; 2152 set(handles.series,'UserData',SeriesData); 2153 set(handles.DeleteObject,'Visible','on'); 2154 set(handles.ViewObject,'Visible','on'); 1889 2155 else 1890 2156 set(handles.CheckObject,'BackgroundColor',[0.7 0.7 0.7])%put activated buttons to green … … 1926 2192 % --- Executes on selection change in TransformName. 1927 2193 function TransformName_Callback(hObject, eventdata, handles) 1928 %------------------------------------------------------------------- 1929 global nb_transform 1930 1931 menu=get(handles.TransformName,'String'); 1932 ind_coord=get(handles.TransformName,'Value'); 1933 coord_option=menu{ind_coord}; 1934 list_transform=get(handles.TransformName,'UserData'); 1935 ff=functions(list_transform{end}); 1936 if isequal(coord_option,'more...'); 1937 coord_fct=''; 1938 prompt = {'Enter the name of the transform function'}; 1939 dlg_title = 'user defined transform'; 1940 num_lines= 1; 1941 [FileName, PathName, filterindex] = uigetfile( ... 2194 %---------------------------------------------------------------------- 2195 TransformList=get(handles.TransformName,'String'); 2196 TransformIndex=get(handles.TransformName,'Value'); 2197 TransformName=TransformList{TransformIndex}; 2198 TransformPathList=get(handles.TransformName,'UserData'); 2199 nb_builtin_transform=4; 2200 % ff=functions(list_transform{end}); 2201 if isequal(TransformName,'more...'); 2202 % coord_fct=''; 2203 % prompt = {'Enter the name of the transform function'}; 2204 % dlg_title = 'user defined transform'; 2205 % num_lines= 1; 2206 [FileName, PathName] = uigetfile( ... 1942 2207 {'*.m', ' (*.m)'; 1943 2208 '*.m', '.m files '; ... 1944 2209 '*.*', 'All Files (*.*)'}, ... 1945 'Pick a file', ff.file); 2210 'Pick a transform function',get(handles.TransformPath,'String')); 2211 if isequal(FileName,0) 2212 return %browser closed without choice 2213 end 1946 2214 if isequal(PathName(end),'/')||isequal(PathName(end),'\') 1947 2215 PathName(end)=[]; 1948 2216 end 1949 transform_selected =fullfile(PathName,FileName); 1950 if ~exist(transform_selected,'file') 1951 return 1952 end 1953 [ppp,transform,xt_fct]=fileparts(FileName);% removes extension .m 1954 if ~isequal(ext_fct,'.m') 2217 [TransformPath,TransformName,TransformExt]=fileparts(FileName);% removes extension .m 2218 if ~strcmp(TransformExt,'.m') 1955 2219 msgbox_uvmat('ERROR','a Matlab function .m must be introduced'); 1956 2220 return 1957 2221 end 1958 menu=update_menu(handles.TransformName,transform);%add the selected fct to the menu 1959 ind_coord=get(handles.TransformName,'Value'); 1960 addpath(PathName) 1961 list_transform{ind_coord}=str2func(transform);% create the function handle corresponding to the newly seleced function 1962 set(handles.TransformName,'UserData',list_transform) 1963 rmpath(PathName) 2222 % insert the choice in the menu 2223 TransformIndex=find(strcmp(TransformName,TransformList),1);% look for the selected function in the menu Action 2224 if isempty(TransformIndex)%the input string does not exist in the menu 2225 TransformIndex= length(TransformList); 2226 TransformList=[TransformList(1:end-1);{TransformnName};TransformList(end)];% the selected function is appended in the menu, before the last item 'more...' 2227 set(handles.TransformName,'String',TransformList) 2228 TransformPathList=[TransformPathList;{TransformPath}]; 2229 end 1964 2230 % save the new menu in the personal file 'uvmat_perso.mat' 1965 2231 dir_perso=prefdir;%personal Matalb directory 1966 2232 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 1967 2233 if exist(profil_perso,'file') 1968 for ilist=nb_ transform+1:numel(list_transform)1969 ff=functions(list_transform{ilist});1970 transform_fct{ilist-nb_transform}=ff.file;2234 for ilist=nb_builtin_transform+1:numel(TransformPathList) 2235 TransformListUser{ilist-nb_builtin_transform}=TransformList{ilist}; 2236 TransformPathListUser{ilist-nb_builtin_transform}=TransformPathList{ilist}; 1971 2237 end 1972 save (profil_perso,'transform_fct','-append'); %store the root name for future opening of uvmat2238 save (profil_perso,'TransformPathListUser','TransformListUser','-append'); %store the root name for future opening of uvmat 1973 2239 end 1974 2240 end 1975 2241 1976 %check the current ActionPath to the selected function 1977 if ~isempty(list_transform{ind_coord}) 1978 func=functions(list_transform{ind_coord}); 1979 set(handles.TransformPath,'String',fileparts(func.file)); %show the path to the senlected function 1980 else 1981 set(handles.TransformPath,'String',''); %show the path to the senlected function 1982 end 1983 2242 %display the current function path 2243 set(handles.TransformPath,'String',TransformPathList{TransformIndex}); %show the path to the senlected function 2244 set(handles.TransformName,'UserData',TransformPathList); 1984 2245 1985 2246 … … 2050 2311 function status_Callback(hObject, eventdata, handles) 2051 2312 val=get(handles.status,'Value'); 2313 2314 %% delete current display fig if selection is off 2052 2315 if val==0 2053 2316 set(handles.status,'BackgroundColor',[0 1 0]) … … 2086 2349 % civ_files=filecell.nc.civ1; 2087 2350 % end 2351 % InputTable=get(handles.InputTable,'Data'); 2352 % OutputDir=fullfile(InputTable{1,1},[get(handles.OutputSubDir,'String') get(handles.OutputDirExt,'String')]); 2353 StatusData.time_ref=get(handles.RUN,'UserData');% get the time of launch 2354 % StatusData.option_civ=option_civ; 2355 Param=read_GUI(handles.series); 2356 RootPath=Param.InputTable{1,1}; 2357 %SubDir=Param.InputTable{1,2}; 2358 OutputSubDir=[Param.OutputSubDir Param.OutputDirExt];% subdirectory for output files 2359 OutputDir=fullfile(RootPath,OutputSubDir); 2360 % set(hlist,'UserData',OutputDir) 2088 2361 hfig=findobj(allchild(0),'name','series_status'); 2089 2362 if isempty(hfig) … … 2094 2367 set(hfig,'tag','series_status') 2095 2368 % set(hfig,'UserData',civ_files) 2096 hlist= uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', {'open_uvmat'},'tag','list' );2097 uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','msgbox','Max',2,'String', 'checking files...');2369 hlist= uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', {'open_uvmat'},'tag','list','UserData',OutputDir); 2370 uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','msgbox','Max',2,'String',OutputDir); 2098 2371 uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]); 2099 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','normalized','FontSize',0.9,'Callback',@close_GUI); 2100 hrefresh=uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.1 0.01 0.2 0.07],'String','Refresh','FontWeight','bold','FontUnits','normalized','FontSize',0.9,'Callback',@refresh_GUI); 2372 %uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@close_GUI); 2373 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@stop_status); 2374 hrefresh=uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.1 0.01 0.2 0.07],'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@refresh_GUI); 2375 set(hrefresh,'UserData',StatusData) 2101 2376 BarPosition=[0.05 0.81 0.01 0.05]; 2102 2377 uicontrol('Style','frame','Units','normalized', 'Position',BarPosition ,'BackgroundColor',[1 0 0],'tag','waitbar'); 2103 2378 drawnow 2104 2379 end 2105 StatusData.time_ref=get(handles.RUN,'UserData');% get the time of launch 2106 % StatusData.option_civ=option_civ; 2107 set(hrefresh,'UserData',StatusData) 2108 Param=read_GUI(handles.series); 2109 RootPath=Param.InputTable{1,1}; 2110 SubDir=Param.InputTable{1,2}; 2111 OutputSubDir=[Param.OutputSubDir Param.OutputDirExt];% subdirectory for output files 2112 OutputDir=fullfile(RootPath,SubDir,OutputSubDir); 2113 set(hlist,'UserData',OutputDir) 2114 %refresh_GUI(hrefresh,[]) 2380 2381 refresh_GUI(hrefresh,[]) 2382 %------------------------------------------------------------------------ 2383 % launched by refreshing the status figure 2384 function refresh_GUI(hObject, eventdata) 2385 %------------------------------------------------------------------------ 2386 % Tabchar={}; 2387 % BarPosition=[0.05 0.81 0.01 0.05]; 2388 hfig=get(hObject,'parent'); 2389 hmsgbox=findobj(hfig,'tag','msgbox'); 2390 hlist=findobj(hfig,'tag','list'); 2391 % StatusData=get(hObject,'UserData'); 2392 OutputDir=get(hmsgbox,'String'); 2393 ListFiles=dir(OutputDir); 2394 ListDisplay=cell(numel(ListFiles),1); 2395 for ilist=1:numel(ListDisplay) 2396 ListDisplay{ilist}=ListFiles(ilist).name; 2397 end 2398 set(hlist,'String',ListDisplay) 2399 % civ_files=get(hfig,'UserData'); 2400 2401 % [filepath,filename,ext]=fileparts(civ_files{1}); 2402 % [tild,SubDir,extdir]=fileparts(filepath); 2403 % SubDir=[SubDir extdir]; 2404 % option_civ=StatusData.option_civ; 2405 % nbfiles=numel(civ_files); 2406 % testrecent=0; 2407 % count=0; 2408 % datnum=zeros(1,nbfiles); 2409 % filefound=cell(1,nbfiles); 2410 % for ifile=1:nbfiles 2411 % detect=exist(civ_files{ifile},'file'); % check the existence of the file 2412 % option=0; 2413 % if detect==0 2414 % option_str='not created'; 2415 % else 2416 % datfile=dir(civ_files{ifile}); 2417 % if isfield(datfile,'datenum') 2418 % datnum(ifile)=datfile.datenum;%only available in recent matlab versions 2419 % testrecent=1; 2420 % end 2421 % filefound(ifile)={datfile.name}; 2422 % 2423 % % check the content netcdf file 2424 % Data=nc2struct(civ_files{ifile},'ListGlobalAttribute','CivStage','patch2','fix2','civ2','patch','fix'); 2425 % option_list={'civ1','fix1','patch1','civ2','fix2','patch2'}; 2426 % if ~isempty(Data.CivStage) 2427 % option=Data.CivStage;%case of Matlab civ 2428 % else 2429 % if ~isempty(Data.patch2) && isequal(Data.patch2,1) 2430 % option=6; 2431 % elseif ~isempty(Data.fix2) && isequal(Data.fix2,1) 2432 % option=5; 2433 % elseif ~isempty(Data.civ2) && isequal(Data.civ2,1); 2434 % option=4; 2435 % elseif ~isempty(Data.patch) && isequal(Data.patch,1); 2436 % option=3; 2437 % elseif ~isempty(Data.fix) && isequal(Data.fix,1); 2438 % option=2; 2439 % else 2440 % option=1; 2441 % end 2442 % end 2443 % option_str=option_list{option}; 2444 % if datnum(ifile)<StatusData.time_ref 2445 % option_str=[option_str ' --OLD--']; 2446 % end 2447 % end 2448 % if option >= option_civ 2449 % count=count+1; 2450 % end 2451 % [filepath,filename,ext]=fileparts(civ_files{ifile}); 2452 % Tabchar{ifile,1}=[fullfile(SubDir,filename) ext '...' option_str]; 2453 % end 2454 % datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files 2455 % if isempty(datnum) 2456 % if testrecent 2457 % message='no civ result created yet'; 2458 % else 2459 % message=''; 2460 % end 2461 % else 2462 % datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files 2463 % [first,ind]=min(datnum); 2464 % [last,indlast]=max(datnum); 2465 % message={[num2str(count) ' file(s) done over ' num2str(nbfiles)] ;['oldest modification: ' cell2mat(filefound(ind)) ' : ' datestr(first)];... 2466 % ['latest modification: ' cell2mat(filefound(indlast)) ' : ' datestr(last)]}; 2467 % end 2468 % hlist=findobj(hfig,'tag','list'); 2469 % hmsgbox=findobj(hfig,'tag','msgbox'); 2470 % hwaitbar=findobj(hfig,'tag','waitbar'); 2471 % set(hlist,'String',Tabchar) 2472 % set(hmsgbox,'String', message) 2473 % if count>0 %&& ~test_new 2474 % BarPosition(3)=0.9*count/nbfiles; 2475 % set(hwaitbar,'Position',BarPosition) 2476 % end 2477 %------------------------------------------------------------------------ 2478 % launched by deleting the status figure 2479 function stop_status(hObject, eventdata) 2480 %------------------------------------------------------------------------ 2481 hciv=findobj(allchild(0),'tag','series'); 2482 hhciv=guidata(hciv); 2483 set(hhciv.status,'value',0) %reset the status uicontrol in the GUI civ 2484 set(hhciv.status,'BackgroundColor',[0 1 0]) 2485 delete(gcbf) 2486 2487 % --- Executes on selection change in ActionExt. 2488 function ActionExt_Callback(hObject, eventdata, handles) 2489 ActionExtList=get(handles.ActionExt,'String'); 2490 ActionExt=ActionExtList{get(handles.ActionExt,'Value')}; 2491 ActionList=get(handles.ActionName,'String'); 2492 ActionName=ActionList{get(handles.ActionName,'Value')}; 2493 if strcmp(ActionExt,'.sh') 2494 ActionFullName=fullfile(get(handles.ActionPath,'String'),[ActionName ActionExt]); 2495 if ~exist(ActionFullName,'file') 2496 answer=msgbox_uvmat('INPUT_Y-N','compiled version has not been created: compile now?'); 2497 if strcmp(answer,'Yes') 2498 currentdir=pwd; 2499 cd(get(handles.ActionPath,'String')) 2500 compile(ActionName) 2501 cd(currentdir) 2502 end 2503 end 2504 end 2505 2506 2507 function ActionInput_Callback(hObject, eventdata, handles) 2508 2509 2510 % --- Executes on button press in DeleteObject. 2511 function DeleteObject_Callback(hObject, eventdata, handles) 2512 if get(handles.DeleteObject,'Value') 2513 SeriesData=get(handles.series,'UserData'); 2514 SeriesData.ProjObject=[]; 2515 set(handles.series,'UserData',SeriesData) 2516 set(handles.ProjObject,'String','') 2517 set(handles.CheckObject,'Value',0) 2518 set(handles.DeleteObject,'Visible','off') 2519 set(handles.ViewObject,'Visible','off') 2520 end 2521 2522 % --- Executes on button press in ViewObject. 2523 function ViewObject_Callback(hObject, eventdata, handles) 2524 if get(handles.ViewObject,'Value') 2525 UserData=get(handles.series,'UserData'); 2526 set_object(UserData.ProjObject) 2527 else 2528 hset_object=findobj(allchild(0),'Tag','set_object'); 2529 if ~isempty(hset_object) 2530 delete(hset_object) 2531 end 2532 end 2533 2534 2535 function num_NbProcess_Callback(hObject, eventdata, handles) 2536 2537 2538 function num_NbSlice_Callback(hObject, eventdata, handles) 2539 NbSlice=str2num(get(handles.num_NbSlice,'String')); 2540 set(handles.num_NbProcess,'String',num2str(NbSlice)) -
trunk/src/set_grid.m
r576 r591 102 102 Input.YMin=(Mesh/2)*ceil(InputField.YMin/(Mesh/2))-0.5*check_pixel; 103 103 Input.YMax=Input.YMin+Mesh*floor((InputField.YMax-Input.YMin)/Mesh)-0.5*check_pixel; 104 errormsg=fill_GUI(Input,handles );104 errormsg=fill_GUI(Input,handles.set_grid); 105 105 end 106 106 -
trunk/src/set_object.m
r589 r591 100 100 set(handles.ProjMode,'UserData',data.ProjModeMenu)% data.ProjModeMenu as default menu (used in Type_Callback) 101 101 end 102 errormsg=fill_GUI(data,handles );102 errormsg=fill_GUI(data,handles.set_object); 103 103 if ~isempty(errormsg) 104 104 msgbox_uvmat('ERROR','bad data input in set_object') … … 510 510 hhview_field=guidata(hview_field); 511 511 [PlotType,PlotParam]=plot_field(ProjData,hhview_field.PlotAxes,read_GUI(hview_field));%update an existing plot in view_field 512 errormsg=fill_GUI(PlotParam,h hview_field);512 errormsg=fill_GUI(PlotParam,hview_field); 513 513 if ~isempty(errormsg) 514 514 msgbox_uvmat('ERROR',errormsg) -
trunk/src/uvmat.m
r589 r591 34 34 % .PosSetObject: position of set_object 35 35 % .PosGeometryCalib: size of set_object 36 % .NbBuiltin: nbre of functions always displayed in transform_fctmenu36 % .NbBuiltin: nbre of functions always displayed in TransformName menu 37 37 % .Object: cell array of structures representing the current projection objects, as produced by 'set_object.m'={[]} by default 38 38 % .NewSeries: =0/1 flag telling whether a new field series has been opened … … 215 215 end 216 216 217 %% load the list of previously browsed files in menus Open, Open_1 and transform_fct217 %% load the list of previously browsed files in menus Open, Open_1 and TransformName 218 218 dir_perso=prefdir; % path to the directory .matlab containing the personal data of the current user 219 219 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');% personal data file uvmat_perso.mat' in .matlab … … 240 240 end 241 241 transform_menu=[transform_menu;{'more...'}];%append the option more.. to the menu 242 set(handles. transform_fct,'String',transform_menu)% display the menu of transform fcts243 set(handles. transform_fct,'UserData',path_list)% store the corresponding list of path in UserData of uicontrol transform_fct244 set(handles. path_transform,'String','')245 set(handles. path_transform,'UserData',[])242 set(handles.TransformName,'String',transform_menu)% display the menu of transform fcts 243 set(handles.TransformName,'UserData',path_list)% store the corresponding list of path in UserData of uicontrol transform_fct 244 set(handles.TransformPath,'String','') 245 set(handles.TransformPath,'UserData',[]) 246 246 247 247 %% case of an input argument for uvmat … … 973 973 set(handles.pxcm,'String','') 974 974 set(handles.pycm,'String','') 975 set(handles. transform_fct,'Value',1); % no transform by default975 set(handles.TransformName,'Value',1); % no transform by default 976 976 else 977 977 if (isfield(GeometryCalib,'R')&& ~isequal(GeometryCalib.R(2,1),0) && ~isequal(GeometryCalib.R(1,2),0)) ||... … … 986 986 end 987 987 if ~get(handles.CheckFixLimits,'Value') 988 set(handles. transform_fct,'Value',3); % phys transform by default if fixedLimits is off988 set(handles.TransformName,'Value',3); % phys transform by default if fixedLimits is off 989 989 end 990 990 if isfield(GeometryCalib,'SliceCoord') … … 1108 1108 1109 1109 %% apply the effect of the transform fct and view the field 1110 transform=get(handles. path_transform,'UserData');1110 transform=get(handles.TransformPath,'UserData'); 1111 1111 if index==2 && (~isa(transform,'function_handle')||nargin(transform)<3) 1112 set(handles. transform_fct,'value',2); % set transform to sub_field if the current fct doe not accept two input fields1113 end 1114 transform_fct_Callback([],[],handles)1112 set(handles.TransformName,'value',2); % set transform to sub_field if the current fct doe not accept two input fields 1113 end 1114 TransformName_Callback([],[],handles) 1115 1115 mask_test=get(handles.CheckMask,'value'); 1116 1116 if mask_test … … 1413 1413 end 1414 1414 %px to phys or other transform on field 1415 menu_transform=get(handles. transform_fct,'String');1416 choice_value=get(handles. transform_fct,'Value');1415 menu_transform=get(handles.TransformName,'String'); 1416 choice_value=get(handles.TransformName,'Value'); 1417 1417 transform_name=menu_transform{choice_value};%name of the transform fct given by the menu 'transform_fct' 1418 transform=get(handles. path_transform,'UserData');1418 transform=get(handles.TransformPath,'UserData'); 1419 1419 if ~isequal(transform_name,'') && ~isequal(transform_name,'px') 1420 1420 if isfield(UvData,'XmlData') && isfield(UvData.XmlData{1},'GeometryCalib')%use geometry calib recorded from the ImaDoc xml file as first priority … … 1947 1947 1948 1948 %px to phys or other transform on field 1949 transform=get(handles. path_transform,'UserData');1949 transform=get(handles.TransformPath,'UserData'); 1950 1950 if ~isempty(transform) 1951 1951 if isfield(UvData,'XmlData') && numel(UvData.XmlData)>=index %use geometry calib recorded from the ImaDoc xml file as first priority … … 2420 2420 2421 2421 %% apply coordinate transform or other user fct 2422 transform=get(handles. path_transform,'UserData');2422 transform=get(handles.TransformPath,'UserData'); 2423 2423 if isempty(transform) 2424 2424 UvData.Field=Field{1}; … … 2432 2432 end 2433 2433 end 2434 transform=get(handles. path_transform,'UserData');2434 transform=get(handles.TransformPath,'UserData'); 2435 2435 switch nargin(transform) 2436 2436 case 4 … … 2999 2999 end 3000 3000 set(handles.uvmat,'UserData',UvData); 3001 transform_fct_list=get(handles. transform_fct,'String');3002 transform_fct=transform_fct_list(get(handles. transform_fct,'Value'));3001 transform_fct_list=get(handles.TransformName,'String'); 3002 transform_fct=transform_fct_list(get(handles.TransformName,'Value')); 3003 3003 if strcmp(transform_fct,'sub_field') 3004 set(handles. transform_fct,'Value',1)%suppress the sub_field transform3004 set(handles.TransformName,'Value',1)%suppress the sub_field transform 3005 3005 transform_fct_Callback(hObject, eventdata, handles); 3006 3006 else … … 3301 3301 UvData.FileType{2}=UvData.FileType{1}; 3302 3302 UvData.XmlData{2}= UvData.XmlData{1}; 3303 transform=get(handles. path_transform,'UserData');3303 transform=get(handles.TransformPath,'UserData'); 3304 3304 if (~isa(transform,'function_handle')||nargin(transform)<3) 3305 3305 set(handles.uvmat,'UserData',UvData) 3306 set(handles. transform_fct,'value',2); % set transform fct to 'sub_field' if the current fct does not accept two input fields3306 set(handles.TransformName,'value',2); % set transform fct to 'sub_field' if the current fct does not accept two input fields 3307 3307 transform_fct_Callback(hObject, eventdata, handles)% activate transform_fct_Callback and refresh current plot 3308 3308 check_refresh=0; … … 3400 3400 UvData.XmlData{2}= UvData.XmlData{1}; 3401 3401 set(handles.SubField,'Value',1) 3402 transform=get(handles. path_transform,'UserData');3402 transform=get(handles.TransformPath,'UserData'); 3403 3403 if (~isa(transform,'function_handle')||nargin(transform)<3) 3404 3404 set(handles.uvmat,'UserData',UvData) 3405 set(handles. transform_fct,'value',2); % set transform fct to 'sub_field' if the current fct does not accept two input fields3405 set(handles.TransformName,'value',2); % set transform fct to 'sub_field' if the current fct does not accept two input fields 3406 3406 transform_fct_Callback(hObject, eventdata, handles)% activate transform_fct_Callback and refresh current plot 3407 3407 else … … 3606 3606 %------------------------------------------------------------------ 3607 3607 %------------------------------------------------------------- 3608 % --- Executes on selection change in transform_fct.3609 3610 function transform_fct_Callback(hObject, eventdata, handles)3608 % --- Executes on selection change in TransformName. 3609 3610 function TransformName_Callback(hObject, eventdata, handles) 3611 3611 %------------------------------------------------------------- 3612 3612 UvData=get(handles.uvmat,'UserData'); 3613 menu=get(handles. transform_fct,'String');refresh3614 ichoice=get(handles. transform_fct,'Value');%item number in the menu3613 menu=get(handles.TransformName,'String');refresh 3614 ichoice=get(handles.TransformName,'Value');%item number in the menu 3615 3615 transform_name=menu{ichoice};% choice of the transform fct 3616 list_path=get(handles. transform_fct,'UserData');3616 list_path=get(handles.TransformName,'UserData'); 3617 3617 3618 3618 %% add a new item to the menu if the option 'more...' has been selected 3619 prev_path=fullfile(get(handles. path_transform,'String'));3619 prev_path=fullfile(get(handles.TransformPath,'String')); 3620 3620 if ~exist(prev_path,'dir') 3621 3621 prev_path=fullfile(fileparts(which('uvmat')),'transform_field'); … … 3641 3641 end 3642 3642 list_path{ichoice}=PathName;%update the list fo fct paths 3643 set(handles. transform_fct,'String',menu)3644 set(handles. transform_fct,'Value',ichoice)3643 set(handles.TransformName,'String',menu) 3644 set(handles.TransformName,'Value',ichoice) 3645 3645 3646 3646 % save the new menu in the personal file 'uvmat_perso.mat' … … 3672 3672 cd(current_dir) 3673 3673 end 3674 set(handles. path_transform,'String',list_path{ichoice})3675 set(handles. path_transform,'UserData',transform_handle)3676 set(handles. transform_fct,'UserData',list_path)3677 3678 %% update the ToolTip string of the menu transform_fctwith the first line of the selected fct file3674 set(handles.TransformPath,'String',list_path{ichoice}) 3675 set(handles.TransformPath,'UserData',transform_handle) 3676 set(handles.TransformName,'UserData',list_path) 3677 3678 %% update the ToolTip string of the menu TransformName with the first line of the selected fct file 3679 3679 if isempty(list_path{ichoice})% case of no selected fct 3680 set(handles. transform_fct,'ToolTipString','transform_fct:choose a transform function')3680 set(handles.TransformName,'ToolTipString','transform_fct:choose a transform function') 3681 3681 else 3682 3682 try … … 3684 3684 InputText=textscan(fid,'%s',1,'delimiter','\n'); 3685 3685 fclose(fid) 3686 set(handles. transform_fct,'ToolTipString',['transform_fct: ' InputText{1}{1}])% put the first line of the selected function as tooltip help3686 set(handles.TransformName,'ToolTipString',['transform_fct: ' InputText{1}{1}])% put the first line of the selected function as tooltip help 3687 3687 end 3688 3688 end … … 5066 5066 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt]; 5067 5067 UvData=get(handles.uvmat,'UserData'); 5068 % CoordList=get(handles. transform_fct,'String');5069 % val=get(handles. transform_fct,'Value');5068 % CoordList=get(handles.TransformName,'String'); 5069 % val=get(handles.TransformName,'Value'); 5070 5070 set_grid(FileName,UvData.Field);% call the set_object interface 5071 5071 … … 5089 5089 function MenuSeries_Callback(hObject, eventdata, handles) 5090 5090 %------------------------------------------------------------------------ 5091 series; %first display of the GUI to fill waiting time5092 5091 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles); 5093 5092 Param.FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];%first input file name … … 5128 5127 end 5129 5128 Param.index_fields_1=find(strcmp(FieldName_1,Param.list_fields_1));% selected string index 5130 Param.transform_str=get(handles.transform_fct,'String');5131 Param. transform_val=get(handles.transform_fct,'Value');5129 TransformList=get(handles.TransformName,'String'); 5130 Param.TransformName=TransformList{get(handles.TransformName,'Value')}; 5132 5131 Param.Coord_x_str=get(handles.Coord_x,'String'); 5133 5132 Param.Coord_x_val=get(handles.Coord_x,'Value'); … … 5165 5164 % --- Executes on button press in CheckColorBar. 5166 5165 function CheckColorBar_Callback(hObject, eventdata, handles) 5166 5167 5168 5169 function TransformPath_Callback(hObject, eventdata, handles) 5170 % hObject handle to TransformPath (see GCBO) 5171 % eventdata reserved - to be defined in a future version of MATLAB 5172 % handles structure with handles and user data (see GUIDATA) 5173 5174 % Hints: get(hObject,'String') returns contents of TransformPath as text 5175 % str2double(get(hObject,'String')) returns contents of TransformPath as a double -
trunk/src/view_field.m
r569 r591 83 83 set(handles.Vectors,'Visible','on') 84 84 end 85 errormsg=fill_GUI(PlotParamOut,h andles);85 errormsg=fill_GUI(PlotParamOut,hObject); 86 86 if ~isempty(errormsg) 87 87 msgbox_uvmat('ERROR',errormsg) … … 780 780 PlotParam=read_GUI(handles.view_field); 781 781 [PP,PlotParamOut]= plot_field(AxeData,handles.PlotAxes,PlotParam); 782 errormsg=fill_GUI(PlotParamOut,handles );782 errormsg=fill_GUI(PlotParamOut,handles.view_field); 783 783 if ~isempty(errormsg) 784 784 msgbox_uvmat('ERROR',errormsg)
Note: See TracChangeset
for help on using the changeset viewer.