Changeset 651
- Timestamp:
- Jun 25, 2013, 12:48:10 AM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/browse_data.m
r630 r651 121 121 MirrorDir=get(handles.MirrorDir,'String'); 122 122 else 123 MirrorRoot=uigetdir('','select the dir which must contain the mirror directory, then press OK'); %file browser 124 if ~ischar(MirrorRoot) 123 MirrorRoot=uigetfile_uvmat('select the folder which must contain the mirror directory:',SourcePath,'uigetdir'); 124 % MirrorRoot=uigetdir('','select the dir which must contain the mirror directory, then press OK'); %file browser 125 if isempty(MirrorRoot) 125 126 return 126 127 else … … 148 149 if ~isequal(dirname(1),'.')&&~isequal(dirname(1),'0') 149 150 idir=idir+1; 150 ExpName{idir}=hdir(ilist).name; 151 152 mirror=fullfile(MirrorDir,ExpName{idir}); 151 mirror=fullfile(MirrorDir,hdir(ilist).name); 153 152 if ~exist(mirror,'dir') 154 153 mkdir(mirror) 155 154 end 155 ExpName{idir}=['+/' hdir(ilist).name]; 156 156 end 157 157 % look for the list of 'devices' … … 186 186 %SourceDir=get(handles.SourceDir,'String'); 187 187 %MirrorDir=get(handles.MirrorDir,'String'); 188 ExpName={''};188 % ExpName={''}; 189 189 if exist(Campaign,'dir') 190 hdir=dir(Campaign); %list files and dirs 191 idir=0; 192 for ilist=1:length(hdir) 193 if hdir(ilist).isdir 194 dirname=hdir(ilist).name; 195 if ~isequal(dirname(1),'.')&&~isequal(dirname(1),'0') 196 idir=idir+1; 197 ExpName{idir}=hdir(ilist).name; 198 end 199 end 200 end 201 set(handles.ListExperiments,'String',[{'*'};ExpName']) 190 ListStruct=dir(Campaign); %list files and dirs 191 ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray 192 ListFiles=ListCells(1,:);%list of dir and file names 193 check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files 194 ListFiles(check_dir)=regexprep(ListFiles(check_dir),'^.+','+/$0');% put '+/' in front of dir name display 195 cell_remove=regexp(ListFiles,'^(-|\.|\+/\.)');% detect strings beginning by '-' ,'.' or '+/.'(dir beginning by . ) 196 check_keep=cellfun('isempty', cell_remove); 197 ListFiles=sort((ListFiles(check_keep))'); 198 set(handles.ListExperiments,'String',[{'*'};ListFiles]) 202 199 set(handles.ListExperiments,'Value',1) 203 200 ListExperiments_Callback([],[], handles) … … 210 207 %------------------------------------------------------------------------ 211 208 % --- Executes on selection change in ListExperiments. 209 %------------------------------------------------------------------------ 212 210 function ListExperiments_Callback(hObject, eventdata, handles) 213 %------------------------------------------------------------------------ 211 214 212 MirrorPath=''; 215 213 CampaignPath=get(handles.SourceDir,'String'); 216 214 if strcmp(get(handles.MirrorDir,'Visible'),'on') 217 % CampaignPath=get(handles.MirrorDir,'String');218 215 MirrorPath=get(handles.MirrorDir,'String'); 219 else 220 % CampaignPath=get(handles.SourceDir,'String'); 221 end 222 % MirrorPath=get(handles.MirrorDir,'String'); 216 end 223 217 ListExperiments=get(handles.ListExperiments,'String'); 224 218 list_val=get(handles.ListExperiments,'Value'); 225 219 if isequal(list_val(1),1) 226 220 ListExperiments=ListExperiments(2:end); %choose all experiments 227 testList=1;228 221 set(handles.ListExperiments,'Value',1) 229 222 else 230 223 ListExperiments=ListExperiments(list_val);%choose selected experiments 231 testList=0;232 224 end 233 225 scan_experiments(handles,ListExperiments,CampaignPath,MirrorPath) … … 236 228 %------------------------------------------------------------------------ 237 229 % --- Executes on selection change in ListExperiments. 230 %------------------------------------------------------------------------ 238 231 function scan_experiments(handles,ListExperiments,CampaignPath,MirrorPath) 239 %------------------------------------------------------------------------ 232 240 233 ListDevices={}; 241 234 for iexp=1:numel(ListExperiments) 242 hdir=dir(fullfile(CampaignPath,ListExperiments{iexp})); %list files and dir in the experiment directory 243 idir=0; 244 for ilist=1:length(hdir) 245 if ~isequal(hdir(ilist).name(1),'.') 246 DataSeries=fullfile(CampaignPath,ListExperiments{iexp},hdir(ilist).name); 247 if ~isempty(MirrorPath) 248 mirror=fullfile(MirrorPath,ListExperiments{iexp},hdir(ilist).name); 249 if ~exist(mirror)% create mirror if needed 250 system(['ln -s ' DataSeries ' ' mirror]) 251 end 252 end 253 check_list=strcmp(hdir(ilist).name,ListDevices); 254 if isempty(find(check_list, 1)) 255 ListDevices=[ListDevices;hdir(ilist).name]; 235 if strcmp(ListExperiments{iexp}(1),'+')% if the item is a directory 236 ListExperiments{iexp}(1)=[]; 237 ListStruct=dir(fullfile(CampaignPath,ListExperiments{iexp})); %list files and dir in the experiment directory 238 ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray 239 ListFiles=ListCells(1,:);%list of dir and file names 240 cell_remove=regexp(ListFiles,'^(-|\.|\+/\.)');% detect strings beginning by '-' ,'.' or '+/.'(dir beginning by . ) 241 check_keep=cellfun('isempty', cell_remove); 242 check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files 243 for ilist=1:numel(ListFiles) 244 if check_keep(ilist) 245 DataSeries=fullfile(CampaignPath,ListExperiments{iexp},ListFiles{ilist}); 246 if ~isempty(MirrorPath) 247 mirror=fullfile(MirrorPath,ListExperiments{iexp},ListFiles{ilist}); 248 if ~exist(mirror)% create mirror if needed 249 system(['ln -s ' DataSeries ' ' mirror]) 250 end 251 end 252 if isempty(find(strcmp(ListFiles{ilist},ListDevices), 1))% if the item is not already in ListDevices 253 if check_dir(ilist) 254 ListFiles{ilist}=['+/' ListFiles{ilist}];%mark dir by '+' in the list 255 end 256 ListDevices=[ListDevices;ListFiles{ilist}]; %append the item to the list 257 end 256 258 end 257 259 end 258 260 end 259 261 end 260 set(handles.ListDevices,'String',ListDevices) 261 262 %------------------------------------------------------------------------ 263 % --- Executes on button press in update_headings. 264 function ListDevices_Callback(hObject, eventdata, handles) 265 % CurrentPath=get(handles.SourceDir,'String'); 266 % ListExperiments=get(handles.ListExperiments,'String'); 267 % list_val=get(handles.ListExperiments,'Value'); 268 % if isequal(list_val,1) 269 % ListExperiments=ListExperiments(2:end); 270 % else 271 % ListExperiments=ListExperiments(list_val); 272 % end 273 % set(handles.ListRecords,'Value',1) 274 % set(handles.ListXml,'Value',1) 275 % ListDevices=get(handles.ListDevices,'String'); 276 % list_val=get(handles.ListDevices,'Value'); 277 % if isequal(list_val,1) 278 % ListDevices=ListDevices(2:end); 279 % else 280 % ListDevices=ListDevices(list_val); 281 % end 282 % [ListDevices,ListRecords,ListXml]=ListDir(CurrentPath,ListExperiments,ListDevices,{}); 283 % set(handles.ListRecords,'String',[{'*'};ListRecords']) 284 % set(handles.ListXml,'String',[{'*'};ListXml']) 285 % 286 % 287 % if strcmp(get(handles.MirrorDir,'Visible'),'on') 288 % CurrentPath=get(handles.MirrorDir,'String'); 289 % else 290 % CurrentPath=get(handles.SourceDir,'String'); 291 % end 292 % ListDevices=get(handles.ListDevices,'String'); 293 % Device=ListDevices(get(handles.ListDevices,'Value')); 294 % % else 295 % hdir=dir(fullfile(SourcePath,Device)); %list files and dirs 296 297 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 298 299 300 301 %------------------------------------------------------------------------ 302 % --- Executes on selection change in ListRecords. 303 function ListRecords_Callback(hObject, eventdata, handles) 304 Value=get(handles.ListRecords,'Value'); 305 if isequal(Value(1),1) 306 set(handles.ListRecords,'Value',1); 307 end 262 set(handles.ListDevices,'String',sort(ListDevices)) 308 263 309 264 %------------------------------------------------------------------------ … … 311 266 function CampaignDoc_Callback(hObject, eventdata, handles) 312 267 %------------------------------------------------------------------------ 313 answer=msgbox_uvmat('INPUT_Y-N','This function will update the global xml rpresentation of the data set and the Heading of each xml file') 268 answer=msgbox_uvmat('INPUT_Y-N','This function will update the global xml rpresentation of the data set and the Heading of each xml file'); 314 269 if ~isequal(answer{1},'OK') 315 270 return … … 351 306 [Title,test]=check_heading(Currentpath,Campaign,ExpName,DeviceName,[],FileName,SubCampaignTest); 352 307 if test 353 [List.Experiment{iexp}.Device{idevice}.xmlfile{ixml} ' , Heading updated']308 disp([List.Experiment{iexp}.Device{idevice}.xmlfile{ixml} ' , Heading updated']) 354 309 end 355 310 if isequal(Title,'ImaDoc') … … 369 324 [Title,test]=check_heading(Currentpath,Campaign,ExpName,DeviceName,RecordName,FileName,SubCampaignTest); 370 325 if test 371 [FileName ' , Heading updated']326 disp([FileName ' , Heading updated']) 372 327 end 373 328 [t,uid_xml]=add(t,uid_record,'element','ImaDoc'); … … 426 381 if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile') 427 382 for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile) 428 FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml} 383 FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml}; 429 384 if isequal(FileName,XmlName) 430 385 editxml(fullfile(CurrentPath,ExpName,DeviceName,FileName)); … … 556 511 557 512 %------------------------------------------------------------------------ 558 % --- Executes on button press in HELP.559 function HELP_Callback(hObject, eventdata, handles)560 path_to_uvmat=which ('uvmat')% check the path of uvmat561 pathelp=fileparts(path_to_uvmat);562 helpfile=fullfile(pathelp,'UVMAT_DOC','uvmat_doc.html');563 if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the directory UVMAT/UVMAT_DOC')564 else565 web([helpfile '#dataview'])566 end567 568 569 570 % --- Executes on selection change in ListXml.571 function ListXml_Callback(hObject, eventdata, handles)572 Value=get(handles.ListXml,'Value');573 if isequal(Value(1),1)574 set(handles.ListXml,'Value',1);575 end576 577 578 % --- Executes on button press in clean_civ_cmx.579 function clean_civ_cmx_Callback(hObject, eventdata, handles)580 message='this function will delete all files with extensions .log, .bat, .cmx,.cmx2,.errors in the input directory(ies)';581 answer=msgbox_uvmat('INPUT_Y-N',message);582 if ~isequal(answer,'Yes')583 return584 end585 set(handles.ListExperiments,'Value',1)586 ListExperiments_Callback(hObject, eventdata, handles)%update the overview of the experiment directories587 DataviewData=get(handles.browse_data,'UserData')588 List=DataviewData.List;589 Currentpath=get(handles.SourceDir,'String');590 [Currentpath,Campaign,DirExt]=fileparts(Currentpath);591 Campaign=[Campaign DirExt];592 SubCampaignTest=get(handles.SubCampaignTest,'Value');593 nbdelete_tot=0;594 for iexp=1:length(List.Experiment)595 set(handles.ListExperiments,'Value',iexp+1)596 drawnow597 test_mod=0;598 ExpName=List.Experiment{iexp}.name;599 nbdelete=0;600 if isfield(List.Experiment{iexp},'Device')601 for idevice=1:length(List.Experiment{iexp}.Device)602 DeviceName=List.Experiment{iexp}.Device{idevice}.name;603 if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile')604 currentdir=fullfile(Currentpath,Campaign,ExpName,DeviceName);605 hdir=dir(currentdir); %list files and dirs606 idir=0;607 for ilist=1:length(hdir)608 if hdir(ilist).isdir609 dirname=hdir(ilist).name;610 if ~isequal(dirname(1),'.')&&~isequal(dirname(1),'0')611 CivDir=fullfile(currentdir,dirname)612 hCivDir=dir(CivDir);613 for ilist=1:length(hCivDir)614 FileName=hCivDir(ilist).name;615 [dd,ff,Ext]=fileparts(FileName);616 if isequal(Ext,'.log')||isequal(Ext,'.bat')||isequal(Ext,'.cmx')||isequal(Ext,'.cmx2')|| isequal(Ext,'.errors')617 delete(fullfile(CivDir,FileName))618 nbdelete=nbdelete+1;619 end620 end621 end622 end623 end624 elseif isfield(List.Experiment{iexp}.Device{idevice},'Record')625 for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record)626 RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name;627 if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile')628 'look at subdirectories'629 end630 end631 end632 end633 end634 display([num2str(nbdelete) ' files deleted'])635 nbdelete_tot=nbdelete_tot+nbdelete;636 end637 msgbox_uvmat('CONFIRMATION',['END: ' num2str(nbdelete_tot) ' files deleted by clean_civ_cmx'])638 set(handles.ListExperiments,'Value',1)639 640 641 513 % --- Executes on button press in OK. 514 %------------------------------------------------------------------------ 642 515 function OK_Callback(hObject, eventdata, handles) 643 %------------------------------------------------------------------------ 516 644 517 if strcmp(get(handles.MirrorDir,'Visible'),'on') 645 518 Campaign=get(handles.MirrorDir,'String'); … … 653 526 Experiment=Experiment(IndicesExp);% use the selection of the list of experiments 654 527 end 528 Experiment=regexprep(Experiment,'^\+/','');% remove the +/ used to mark dir 655 529 Device=get(handles.ListDevices,'String'); 656 530 Value=get(handles.ListDevices,'Value'); 657 531 Device=Device(Value); 532 Device=regexprep(Device,'^\+/','');% remove the +/ used to mark dir 658 533 handles.output.Experiment=Experiment; 659 handles.output.D evice=Device;534 handles.output.DataSeries=Device; 660 535 guidata(hObject, handles);% Update handles structure 661 536 uiresume(handles.browse_data); 662 537 drawnow 663 return 664 665 666 % ListRecords=get(handles.ListRecords,'String'); 667 % Value=get(handles.ListRecords,'Value'); 668 % if ~isequal(Value,1) 669 % ListRecords=ListRecords(Value); 670 % end 671 672 %[ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices); 673 ListXml=get(handles.ListXml,'String'); 674 Value=get(handles.ListXml,'Value'); 675 if isequal(Value,1) 676 msgbox_uvmat('ERROR','you need to select in the GUI browse_data the xml files to edit') 677 return 678 else 679 ListXml=ListXml(Value); 680 end 681 682 %update all the selected xml files 683 DataviewData=get(handles.browse_data,'UserData'); 684 % answer=msgbox_uvmat('INPUT_Y-N',[num2str(length(Value)) ' xml files for device ' ListDevices{1} ' will be refreshed with ' ... 685 % DataviewData.GeometryCalib.CalibrationType ' calibration data']) 686 % if ~isequal(answer,'Yes') 687 % return 688 % end 689 %List.Experiment{1}.Device{1} 690 %List.Experiment{2}.Device{1} 691 for iexp=1:length(List.Experiment) 692 ExpName=List.Experiment{iexp}.name; 693 set(handles.ListExperiments,'Value',IndicesExp(iexp)); 694 if isfield(List.Experiment{iexp},'Device') 695 for idevice=1:length(List.Experiment{iexp}.Device) 696 DeviceName=List.Experiment{iexp}.Device{idevice}.name; 697 if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile') 698 for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile) 699 FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml}; 700 for ilistxml=1:length(ListXml) 701 if isequal(FileName,ListXml{ilistxml}) 702 set(handles.ListXml,'Value',Value(ilistxml)) 703 drawnow 704 xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,FileName); 705 update_imadoc(DataviewData.GeometryCalib,xmlfullname,'GeometryCalib') 706 display([xmlfullname ' updated']) 707 break 708 end 709 end 710 end 711 elseif isfield(List.Experiment{iexp}.Device{idevice},'Record') 712 for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record) 713 RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name; 714 if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile') 715 for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile) 716 FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml}; 717 for ilistxml=1:length(ListXml) 718 if isequal(FileName,ListXml{ilistxml}) 719 set(handles.ListXml,'Value',Value(ilistxml)) 720 drawnow 721 xmlfullname=fullfile(CurrentPath,ExpName,DeviceName,RecordName,FileName); 722 update_imadoc(DataviewData.GeometryCalib,xmlfullname,'GeometryCalib') 723 display([xmlfullname ' updated']) 724 break 725 end 726 end 727 end 728 end 729 end 730 end 731 end 732 end 733 end 734 set(handles.ListXml,'Value',Value) 735 % 736 % 737 % 738 % 739 % 740 % 741 % 742 % CurrentPath=get(handles.SourceDir,'String');%= get(hObject,'String'); 743 % ListExperiments=get(handles.ListExperiments,'String'); 744 % Value=get(handles.ListExperiments,'Value'); 745 % if ~isequal(Value,1) 746 % ListExperiments=ListExperiments(Value); 747 % end 748 % ListDevices=get(handles.ListDevices,'String'); 749 % Value=get(handles.ListDevices,'Value'); 750 % if isequal(Value,1) 751 % msgbox_uvmat('ERROR','manually select in the GUI browse_data the device being calibrated') 752 % return 753 % else 754 % ListDevices=ListDevices(Value); 755 % end 756 % ListRecords=get(handles.ListRecords,'String'); 757 % Value=get(handles.ListRecords,'Value'); 758 % if ~isequal(Value,1) 759 % ListRecords=ListRecords(Value); 760 % end 761 % [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords); 762 % ListXml=get(handles.ListXml,'String'); 763 % Value=get(handles.ListXml,'Value'); 764 % if isequal(Value,1) 765 % msgbox_uvmat('ERROR','you need to select in the GUI browse_data the xml files to edit') 766 % return 767 % else 768 % ListXml=ListXml(Value); 769 % end 770 % handles.output.CurrentPath=CurrentPath; 771 % handles.output.ListExperiments=ListExperiments; 772 % handles.output.ListDevices=ListDevices; 773 % handles.output.ListRecords=ListRecords; 774 % handles.output.ListXml=ListXml; 775 % handles.output.List=List; 776 % handles.output ='OK, Calibration replicated'; 777 % guidata(hObject, handles);% Update handles structure 778 % uiresume(handles.browse_data); 779 538 539 %------------------------------------------------------------------------ 540 % --- Executes on button press in HELP. 541 function HELP_Callback(hObject, eventdata, handles) 542 path_to_uvmat=which ('uvmat');% check the path of uvmat 543 pathelp=fileparts(path_to_uvmat); 544 helpfile=fullfile(pathelp,'UVMAT_DOC','uvmat_doc.html'); 545 if isempty(dir(helpfile)), msgbox_uvmat('ERROR','Please put the help file uvmat_doc.html in the directory UVMAT/UVMAT_DOC') 546 else 547 web([helpfile '#dataview']) 548 end 549 550 %------------------------------------------------------------------------ 780 551 % --- Executes on button press in Cancel. 552 %------------------------------------------------------------------------ 781 553 function Cancel_Callback(hObject, eventdata, handles) 554 782 555 handles.output = get(hObject,'String'); 783 556 guidata(hObject, handles); % Update handles structure … … 785 558 uiresume(handles.browse_data); 786 559 560 %------------------------------------------------------------------------ 787 561 % --- Executes when user attempts to close browse_data. 562 %------------------------------------------------------------------------ 788 563 function browse_data_CloseRequestFcn(hObject, eventdata, handles) 564 789 565 if isequal(get(handles.browse_data, 'waitstatus'), 'waiting') 790 566 % The GUI is still in UIWAIT, us UIRESUME … … 795 571 end 796 572 573 %------------------------------------------------------------------------ 797 574 % --- Executes on key press over figure1 with no controls selected. 575 %------------------------------------------------------------------------ 798 576 function browse_data_KeyPressFcn(hObject, eventdata, handles) 577 799 578 % Check for "enter" or "escape" 800 579 if isequal(get(hObject,'CurrentKey'),'escape') -
trunk/src/calc_field_tps.m
r581 r651 2 2 %'calc_field_tps': defines fields (velocity, vort, div...) from civ data and calculate them with tps interpolation 3 3 %--------------------------------------------------------------------- 4 % [DataOut,VarAttribute,errormsg]=calc_field_tps(Coord_tps,Nb Sites,SubRange,FieldVar,FieldName,Coord_interp)4 % [DataOut,VarAttribute,errormsg]=calc_field_tps(Coord_tps,NbCentre,SubRange,FieldVar,FieldName,Coord_interp) 5 5 % 6 6 % OUTPUT: … … 8 8 % 9 9 % INPUT: 10 % Coord_tps: 11 % NbSites 12 % SubRange 13 % FieldVar 14 % FieldName: cell array representing the list of operations (eg div, rot..) 15 % Coord_interp: coordiantes of sites on which the fields need to be calculated 10 % Coord_tps: coordinates of the centres, of dimensions [nb_point,nb_coord,nb_subdomain], where 11 % nb_point is the max number of data point in a subdomain, 12 % nb_coord the space dimension, 13 % nb_subdomain the nbre of subdomains used for tps 14 % NbCentre: nbre of tps centres for each subdomain, of dimension nb_subdomain 15 % SubRange: coordinate range for each subdomain, of dimensions [nb_coord,2,nb_subdomain] 16 % FieldVar: cell array of list of variables needed to calculate the requested fields 17 % FieldName: cell array representing the list of operations (eg div(U,V), rot(U,V)) 18 % Coord_interp: coordinates of sites on which the fields need to be calculated of dimensions 19 % [nb_site,nb_coord] for an array of interpolation sites 20 % [nb_site_y,nb_site_x,nb_coord] for interpolation on a plane grid of size [nb_site_y,nb_site_x] 16 21 17 function [DataOut,VarAttribute,errormsg]=calc_field_tps(Coord_tps,Nb Sites,SubRange,FieldVar,FieldName,Coord_interp)22 function [DataOut,VarAttribute,errormsg]=calc_field_tps(Coord_tps,NbCentre,SubRange,FieldVar,FieldName,Coord_interp) 18 23 19 24 %list of defined scalars to display in menus (in addition to 'ima_cor'). … … 68 73 %% loop on subdomains 69 74 for isub=1:NbSubDomain 70 nbvec_sub=Nb Sites(isub);75 nbvec_sub=NbCentre(isub); 71 76 check_range=(Coord_interp >=ones(nb_sites,1)*SubRange(:,1,isub)' & Coord_interp<=ones(nb_sites,1)*SubRange(:,2,isub)'); 72 77 ind_sel=find(sum(check_range,2)==nb_coord); -
trunk/src/civ_matlab.m
r604 r651 193 193 Data.Patch1_SubDomainSize=Param.Patch1.SubDomainSize; 194 194 nbvar=length(Data.ListVarName); 195 Data.ListVarName=[Data.ListVarName {'Civ1_U_smooth','Civ1_V_smooth','Civ1_SubRange','Civ1_NbCentre s','Civ1_Coord_tps','Civ1_U_tps','Civ1_V_tps'}];196 Data.VarDimName=[Data.VarDimName {'nb_vec_1','nb_vec_1',{'nb_coord','nb_bound s','nb_subdomain_1'},'nb_subdomain_1',...195 Data.ListVarName=[Data.ListVarName {'Civ1_U_smooth','Civ1_V_smooth','Civ1_SubRange','Civ1_NbCentre','Civ1_Coord_tps','Civ1_U_tps','Civ1_V_tps'}]; 196 Data.VarDimName=[Data.VarDimName {'nb_vec_1','nb_vec_1',{'nb_coord','nb_bound','nb_subdomain_1'},'nb_subdomain_1',... 197 197 {'nb_tps_1','nb_coord','nb_subdomain_1'},{'nb_tps_1','nb_subdomain_1'},{'nb_tps_1','nb_subdomain_1'}}]; 198 198 Data.VarAttribute{nbvar+1}.Role='vector_x'; … … 208 208 ind_good=1:numel(Data.Civ1_X); 209 209 end 210 [Data.Civ1_SubRange,Data.Civ1_NbCentre s,Data.Civ1_Coord_tps,Data.Civ1_U_tps,Data.Civ1_V_tps,tild,Ures, Vres,tild,FFres]=...210 [Data.Civ1_SubRange,Data.Civ1_NbCentre,Data.Civ1_Coord_tps,Data.Civ1_U_tps,Data.Civ1_V_tps,tild,Ures, Vres,tild,FFres]=... 211 211 filter_tps([Data.Civ1_X(ind_good) Data.Civ1_Y(ind_good)],Data.Civ1_U(ind_good),Data.Civ1_V(ind_good),[],Data.Patch1_SubDomainSize,Data.Patch1_FieldSmooth,Data.Patch1_MaxDiff); 212 212 Data.Civ1_U_smooth(ind_good)=Ures; … … 292 292 % get the guess from patch1 293 293 for isub=1:NbSubDomain 294 nbvec_sub=Data.Civ1_NbCentre s(isub);294 nbvec_sub=Data.Civ1_NbCentre(isub); 295 295 ind_sel=find(GridX>=Data.Civ1_SubRange(1,1,isub) & GridX<=Data.Civ1_SubRange(1,2,isub) & GridY>=Data.Civ1_SubRange(2,1,isub) & GridY<=Data.Civ1_SubRange(2,2,isub)); 296 296 epoints = [GridX(ind_sel) GridY(ind_sel)];% coordinates of interpolation sites … … 401 401 Data.Patch2_SubDomainSize=Param.Patch2.SubDomainSize; 402 402 nbvar=length(Data.ListVarName); 403 Data.ListVarName=[Data.ListVarName {'Civ2_U_smooth','Civ2_V_smooth','Civ2_SubRange','Civ2_NbCentre s','Civ2_Coord_tps','Civ2_U_tps','Civ2_V_tps'}];404 Data.VarDimName=[Data.VarDimName {'nb_vec_2','nb_vec_2',{'nb_coord','nb_bound s','nb_subdomain_2'},{'nb_subdomain_2'},...403 Data.ListVarName=[Data.ListVarName {'Civ2_U_smooth','Civ2_V_smooth','Civ2_SubRange','Civ2_NbCentre','Civ2_Coord_tps','Civ2_U_tps','Civ2_V_tps'}]; 404 Data.VarDimName=[Data.VarDimName {'nb_vec_2','nb_vec_2',{'nb_coord','nb_bound','nb_subdomain_2'},{'nb_subdomain_2'},... 405 405 {'nb_tps_2','nb_coord','nb_subdomain_2'},{'nb_tps_2','nb_subdomain_2'},{'nb_tps_2','nb_subdomain_2'}}]; 406 406 … … 417 417 ind_good=1:numel(Data.Civ2_X); 418 418 end 419 [Data.Civ2_SubRange,Data.Civ2_NbCentre s,Data.Civ2_Coord_tps,Data.Civ2_U_tps,Data.Civ2_V_tps,tild,Ures, Vres,tild,FFres]=...419 [Data.Civ2_SubRange,Data.Civ2_NbCentre,Data.Civ2_Coord_tps,Data.Civ2_U_tps,Data.Civ2_V_tps,tild,Ures, Vres,tild,FFres]=... 420 420 filter_tps([Data.Civ2_X(ind_good) Data.Civ2_Y(ind_good)],Data.Civ2_U(ind_good),Data.Civ2_V(ind_good),[],Data.Patch2_SubDomainSize,Data.Patch2_FieldSmooth,Data.Patch2_MaxDiff); 421 421 Data.Civ2_U_smooth(ind_good)=Ures; -
trunk/src/filter_tps.m
r582 r651 1 1 %'filter_tps': find the thin plate spline coefficients for interpolation-smoothing 2 2 %------------------------------------------------------------------------ 3 % [SubRange,NbCentre s,Coord_tps,U_tps,V_tps,W_tps,U_smooth,V_smooth,W_smooth,FF] =filter_tps(Coord,U,V,W,SubDomain,Rho,Threshold)3 % [SubRange,NbCentre,Coord_tps,U_tps,V_tps,W_tps,U_smooth,V_smooth,W_smooth,FF] =filter_tps(Coord,U,V,W,SubDomain,Rho,Threshold) 4 4 % 5 5 % OUTPUT: 6 6 % SubRange(NbCoord,NbSubdomain,2): range (min, max) of the coordiantes x and y respectively, for each subdomain 7 % NbCentre s(NbSubdomain): number of source points for each subdomain7 % NbCentre(NbSubdomain): number of source points for each subdomain 8 8 % FF: false flags 9 9 % U_smooth, V_smooth: filtered velocity components at the positions of the initial data 10 % Coord_tps(NbCentre s,NbCoord,NbSubdomain): positions of the tps centres10 % Coord_tps(NbCentre,NbCoord,NbSubdomain): positions of the tps centres 11 11 % U_tps,V_tps: weight of the tps for each subdomain 12 12 % to get the interpolated field values, use the function calc_field.m … … 19 19 % Subdomain: estimated number of data points in each subdomain 20 20 21 function [SubRange,NbCentre s,Coord_tps,U_tps,V_tps,W_tps,U_smooth,V_smooth,W_smooth,FF] =filter_tps(Coord,U,V,W,SubDomain,Rho,Threshold)21 function [SubRange,NbCentre,Coord_tps,U_tps,V_tps,W_tps,U_smooth,V_smooth,W_smooth,FF] =filter_tps(Coord,U,V,W,SubDomain,Rho,Threshold) 22 22 23 23 %% adjust subdomain decomposition … … 46 46 %% default output 47 47 SubRange=zeros(NbCoord,2,NbSubDomain);%initialise the positions of subdomains 48 NbCentres=zeros(1,NbSubDomain);%number of interpolated values per subdomain, =0 by default 49 %Coord_tps=zeros(NbVec,NbCoord,NbSubDomain);% default positions of the tps source= initial positions of the good vectors sorted by subdomain 50 %U_tps=zeros(NbVec,NbSubDomain);%default spline 51 %V_tps=zeros(NbVec,NbSubDomain);%default spline 48 NbCentre=zeros(1,NbSubDomain);%number of interpolated values per subdomain, =0 by default 52 49 W_tps=[];%default (2 component case) 53 50 U_smooth=zeros(NbVec,1); % smoothed velocity U at the initial positions … … 93 90 U_smooth(ind_sel)=U_smooth(ind_sel)+U_smooth_sub; 94 91 V_smooth(ind_sel)=V_smooth(ind_sel)+V_smooth_sub; 95 NbCentre s(isub)=numel(ind_sel);96 Coord_tps(1:NbCentre s(isub),:,isub)=Coord(ind_sel,:);97 U_tps(1:NbCentre s(isub)+3,isub)=U_tps_sub;98 V_tps(1:NbCentre s(isub)+3,isub)=V_tps_sub;92 NbCentre(isub)=numel(ind_sel); 93 Coord_tps(1:NbCentre(isub),:,isub)=Coord(ind_sel,:); 94 U_tps(1:NbCentre(isub)+3,isub)=U_tps_sub; 95 V_tps(1:NbCentre(isub)+3,isub)=V_tps_sub; 99 96 nb_select(ind_sel)=nb_select(ind_sel)+1; 100 97 display('good') … … 110 107 U_smooth(ind_sel(ind_ind_sel))=U_smooth(ind_sel(ind_ind_sel))+U_smooth_sub; 111 108 V_smooth(ind_sel(ind_ind_sel))=V_smooth(ind_sel(ind_ind_sel))+V_smooth_sub; 112 NbCentre s(isub)=numel(ind_ind_sel);113 Coord_tps(1:NbCentre s(isub),:,isub)=Coord(ind_sel(ind_ind_sel),:);114 U_tps(1:NbCentre s(isub)+3,isub)=U_tps_sub;115 V_tps(1:NbCentre s(isub)+3,isub)=V_tps_sub;109 NbCentre(isub)=numel(ind_ind_sel); 110 Coord_tps(1:NbCentre(isub),:,isub)=Coord(ind_sel(ind_ind_sel),:); 111 U_tps(1:NbCentre(isub)+3,isub)=U_tps_sub; 112 V_tps(1:NbCentre(isub)+3,isub)=V_tps_sub; 116 113 nb_select(ind_sel(ind_ind_sel))=nb_select(ind_sel(ind_ind_sel))+1; 117 114 display('good2') -
trunk/src/plot_field.m
r644 r651 353 353 354 354 %% set the colors of the successive plots (designed to produce rgb for the three components of color images) 355 ColorOrder=[1 0 0;0 0.50;0 0 1;0 0.75 0.75;0.75 0 0.75;0.75 0.75 0;0.25 0.25 0.25];356 set(h axes,'ColorOrder',ColorOrder)355 ColorOrder=[1 0 0;0 1 0;0 0 1;0 0.75 0.75;0.75 0 0.75;0.75 0.75 0;0.25 0.25 0.25]; 356 set(hfig,'DefaultAxesColorOrder',ColorOrder) 357 357 % if isfield(Coordinates,'NextPlot') 358 358 % set(haxes,'NextPlot',Coordinates.NextPlot) … … 459 459 eval(plotstr) %execute plot (instruction plotstr) 460 460 %%% 461 set(haxes,'tag',tag) 461 set(haxes,'tag',tag)% restitute the axes tag (removed by the command plot) 462 set(haxes,'ColorOrder',ColorOrder)% restitute the plot color order (to get red green blue for histograms or cuts of color images) 462 463 grid(haxes, 'on') 463 464 hxlabel=xlabel(xtitle(1:end-2));% xlabel (removes ', ' at the end) -
trunk/src/proj_field.m
r650 r651 1053 1053 switch CellInfo{icell}.CoordType 1054 1054 1055 %% case of input fields with unstructured coordinates1056 1055 case 'scattered' 1056 %% case of input fields with unstructured coordinates (applies for projMode ='projection' or 'interp_lin') 1057 1057 if strcmp(ProjMode{icell},'interp_tps') 1058 1058 continue %skip for next cell (needs tps field cell) … … 1073 1073 1074 1074 % selection of the vectors in the projection range (3D case) 1075 if check3D && width > 01075 if check3D && width > 0 1076 1076 %components of the unitiy vector normal to the projection plane 1077 1077 fieldZ=norm_plane(1)*coord_x + norm_plane(2)*coord_y+ norm_plane(3)*coord_z;% distance to the plane … … 1079 1079 for ivar=VarIndex 1080 1080 VarName=FieldData.ListVarName{ivar}; 1081 eval(['FieldData.' VarName '=FieldData.' VarName '(indcut);']) 1082 % A VOIR : CAS DE VAR STRUCTUREE MAIS PAS GRILLE REGULIERE : INTERPOLER SUR GRILLE REGULIERE 1081 FieldData.(VarName)=FieldData.(VarName)(indcut); 1083 1082 end 1084 1083 coord_x=coord_x(indcut); … … 1138 1137 end 1139 1138 1140 % differentcases of projection1139 % two cases of projection 1141 1140 switch ProjMode{icell} 1142 1141 case 'projection' … … 1174 1173 end 1175 1174 end 1176 % testFF=0;1177 % nbvar=numel(ProjData.ListVarName);1178 % if isfield(CellInfo{icell},'VarIndex_vector_x')&&isfield(CellInfo{icell},'VarIndex_vector_y')1179 % VarName_x=FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_x};1180 % VarName_y=FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_y};1181 % if isfield(CellInfo{icell},'VarIndex_errorflag')1182 % FieldData.(VarName_x)=FieldData.(VarName_x)(indsel);1183 % FieldData.(VarName_y)=FieldData.(VarName_y)(indsel);1184 % end1185 % %FieldVar=cat(2,FieldData.(VarName_x),FieldData.(VarName_y));1186 % if ~isfield(CellInfo{icell},'CheckSub') || ~CellInfo{icell}.CheckSub1187 % vector_x_proj=numel(ProjData.ListVarName)+1;1188 % vector_y_proj=numel(ProjData.ListVarName)+2;1189 % end1190 % end1191 % if isfield(CellInfo{icell},'VarIndex_scalar')1192 % VarName_scalar=FieldData.ListVarName{CellInfo{icell}.VarIndex_scalar};1193 % if isfield(CellInfo{icell},'errorflag') && ~isempty(CellInfo{icell}.errorflag)1194 % FieldData.(VarName_scalar)=FieldData.(VarName_scalar)(indsel);1195 % end1196 % end1197 % if isfield(CellInfo{icell},'VarIndex_ancillary')% do not project ancillary data with interp1198 % FieldData=rmfield(FieldData,FieldData.ListVarName{CellInfo{icell}.VarIndex_ancillary});1199 % end1200 % if isfield(CellInfo{icell},'VarIndex_warnflag')% do not project ancillary data with interp1201 % FieldData=rmfield(FieldData,FieldData.ListVarName{CellInfo{icell}.VarIndex_warnflag});1202 % end1203 1175 % interpolate and calculate field on the grid 1204 1176 [VarVal,ListFieldProj,VarAttribute,errormsg]=calc_field_interp([coord_X coord_Y],FieldData,CellInfo{icell}.FieldName,XI,YI); … … 1223 1195 end 1224 1196 1225 %% case of tps interpolation (applies only in interp_tps mode and for spatial derivatives)1226 1197 case 'tps' 1198 %% case of tps data (applies only in interp_tps mode) 1227 1199 if strcmp(ProjMode{icell},'interp_tps') 1228 1200 Coord=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex}); -
trunk/src/read_civdata.m
r613 r651 216 216 % units={'pixel','pixel','pixel','pixel','pixel','pixel','','',''}; 217 217 case 'filter1' 218 var={'X','Y','Z','U','V','W','C','F','FF','Coord_tps','U_tps','V_tps','W_tps','SubRange','NbCentre s','NbCentres';...218 var={'X','Y','Z','U','V','W','C','F','FF','Coord_tps','U_tps','V_tps','W_tps','SubRange','NbCentre','NbCentre','NbCentre';... 219 219 'Civ1_X','Civ1_Y','Civ1_Z','Civ1_U_smooth','Civ1_V_smooth','Civ1_W','Civ1_C','Civ1_F','Civ1_FF',... 220 'Civ1_Coord_tps','Civ1_U_tps','Civ1_V_tps','Civ1_W_tps','Civ1_SubRange','Civ1_NbCentre s','Civ1_NbSites'};220 'Civ1_Coord_tps','Civ1_U_tps','Civ1_V_tps','Civ1_W_tps','Civ1_SubRange','Civ1_NbCentre','Civ1_NbCentres','Civ1_NbSites'}; 221 221 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','coord_tps','vector_x_tps',... 222 'vector_y_tps','vector_z_tps','ancillary','ancillary','ancillary' };223 % rmq: Nb Sites obsolete replaced by NbCentres, kept for consistency with previous data222 'vector_y_tps','vector_z_tps','ancillary','ancillary','ancillary','ancillary'}; 223 % rmq: NbCentres and NbSites obsolete replaced by NbCentre, kept for consistency with previous data 224 224 case 'civ2' 225 225 var={'X','Y','Z','U','V','W','C','F','FF';... … … 227 227 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag'}; 228 228 case 'filter2' 229 var={'X','Y','Z','U','V','W','C','F','FF','Coord_tps','U_tps','V_tps','W_tps','SubRange','NbCentre s','NbCentres';...229 var={'X','Y','Z','U','V','W','C','F','FF','Coord_tps','U_tps','V_tps','W_tps','SubRange','NbCentre','NbCentre','NbCentre';... 230 230 'Civ2_X','Civ2_Y','Civ2_Z','Civ2_U_smooth','Civ2_V_smooth','Civ2_W','Civ2_C','Civ2_F','Civ2_FF',... 231 'Civ2_Coord_tps','Civ2_U_tps','Civ2_V_tps','','Civ2_SubRange','Civ2_NbCentre s','Civ2_NbSites'};231 'Civ2_Coord_tps','Civ2_U_tps','Civ2_V_tps','','Civ2_SubRange','Civ2_NbCentre','Civ2_NbCentres','Civ2_NbSites'}; 232 232 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','coord_tps','vector_x_tps',... 233 'vector_y_tps','vector_z_tps','ancillary','ancillary','ancillary' };233 'vector_y_tps','vector_z_tps','ancillary','ancillary','ancillary','ancillary'}; 234 234 end 235 235 if ~strcmp(ProjModeRequest,'interp_tps') -
trunk/src/series.m
r650 r651 153 153 if isfield(h,'MenuFile') 154 154 for ifile=1:min(length(h.MenuFile),5) 155 eval(['set(handles.MenuFile_' num2str(ifile) ',''Label'',h.MenuFile{ifile});']) 155 set(handles.(['MenuFile_' num2str(ifile)]),'Label',h.MenuFile{ifile}); 156 end 157 end 158 %get the list of previous camapigns in the upper bar menu Open campaign 159 if isfield(h,'MenuCampaign') 160 for ifile=1:min(length(h.MenuCampaign),5) 161 set(handles.(['MenuCampaign_' num2str(ifile)]),'Label',h.MenuCampaign{ifile}); 156 162 end 157 163 end … … 224 230 set(handles.Coord_y,'Value',Param.Coord_y_val);% selected string index 225 231 end 226 227 %% Adjust the GUI according to the binaries available in PARAM.xml228 % path_uvmat=fileparts(which('uvmat')); %path to civ229 % addpath (path_uvmat) ; %add the path to civ, (useful in case of change of working directory after civ has been s opened in the working directory)230 % errormsg=[];%default error message231 % xmlfile='PARAM.xml';232 % if exist(xmlfile,'file')233 % try234 % t=xmltree(xmlfile);235 % sparam=convert(t);236 % catch ME237 % errormsg={' Unable to read the file PARAM.xml defining the binaries:';ME.message};238 % end239 % else240 % errormsg=[xmlfile ' not found: path to binaries undefined'];241 % end242 % if ~isempty(errormsg)243 % msgbox_uvmat('WARNING',errormsg);244 % end245 % test_batch=0;%default: ,no batch mode available246 % if isfield(sparam,'BatchParam') && isfield(sparam.BatchParam,'BatchMode')247 % test_batch=strcmp(sparam.BatchParam.BatchMode,'sge'); %sge is currently the only implemented batch mod248 % end249 % RUNVal=get(handles.RunMode,'Value');250 % if test_batch==0251 % if RUNVal>2252 % set(handles.RunMode,'Value',1)253 % end254 % set(handles.RunMode,'String',{'local';'background'})255 % else256 % set(handles.RunMode,'String',{'local';'background';'cluster'})257 % end258 232 259 233 %% introduce the input file name(s) if defined from input Param … … 296 270 %------------------------------------------------------------------------ 297 271 %------------------------------------------------------------------------ 272 % --- fct activated by the browser under 'Open' 273 %------------------------------------------------------------------------ 298 274 function MenuBrowse_Callback(hObject, eventdata, handles) 299 %------------------------------------------------------------------------ 300 % get the previous input file in the Input Table275 276 %% look for the previously opened file 'oldfile' 301 277 oldfile=''; %default 302 SeriesData=get(handles.series,'UserData'); 303 if isfield(SeriesData,'RefFile') 304 oldfile=SeriesData.RefFile{1}; 305 end 306 if ~exist(oldfile,'file') 278 if get(handles.CheckAppend,'Value') 279 % case 'checkappend': new series appended to the input table 280 InputTable=get(handles.InputTable,'Data'); 281 RootPathCell=InputTable(:,1); 282 SubDirCell=InputTable(:,3); 283 oldfile=''; %default 284 if ~(isempty(RootPathCell) || isequal(RootPathCell,{''}))%loads the previously stored file name and set it as default in the file_input box 285 oldfile=fullfile(RootPathCell{1},SubDirCell{1}); 286 end 287 else 288 % case refresh the input table by a new series 289 SeriesData=get(handles.series,'UserData'); 290 if isfield(SeriesData,'RefFile') 291 oldfile=SeriesData.RefFile{1}; 292 end 293 end 294 295 %% use a file name stored in prefdir 296 dir_perso=prefdir; 297 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 298 if exist(profil_perso,'file') 299 h=load (profil_perso); 300 if isfield(h,'RootPath') && ischar(h.RootPath) 301 oldfile=h.RootPath; 302 end 303 end 304 305 %% launch the browser 306 fileinput=uigetfile_uvmat('pick a file to append in the input table',oldfile); 307 if ~isempty(fileinput) 308 if get(handles.CheckAppend,'Value') 309 display_file_name(handles,fileinput,'append') 310 else 311 display_file_name(handles,fileinput,'one') 312 end 313 end 314 315 %------------------------------------------------------------------------ 316 % --- fct activated by selecting a previous file under the menu Open 317 %------------------------------------------------------------------------ 318 function MenuFile_Callback(hObject, eventdata, handles) 319 320 fileinput=get(hObject,'Label'); 321 if get(handles.CheckAppend,'Value') 322 display_file_name(handles,fileinput,'append') 323 else 324 display_file_name(handles,fileinput,'one') 325 end 326 327 %------------------------------------------------------------------------ 328 % --- fct activated by the browser under 'Open campaign' 329 %------------------------------------------------------------------------ 330 function MenuBrowseCampaign_Callback(hObject, eventdata, handles) 331 332 set(handles.MenuOpenCampaign,'ForegroundColor',[1 1 0]) 333 drawnow 334 InputTable=get(handles.InputTable,'Data'); 335 RootPath=InputTable{1,1}; 336 CampaignPath=fileparts(fileparts(RootPath)); 337 DirFull=uigetfile_uvmat('define this path as the Campaign folder:',CampaignPath,'uigetdir'); 338 if ~ischar(DirFull)|| ~exist(DirFull,'dir') 339 return 340 end 341 OutPut=browse_data(DirFull);% open the GUI browse_data to get select a campaign dir, experiment and device 342 if ~isfield(OutPut,'Campaign') 343 return 344 end 345 DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1}); 346 ListStruct=dir(DirName); %list files and the dir DataSeries 347 % select the first appropriate file in the dir 348 FileName=''; 349 for ilist=1:numel(ListStruct) 350 if ~isequal(ListStruct(ilist).isdir,1)%look for files, not dir 351 FileName=ListStruct(ilist).name; 352 FileType=get_file_type(fullfile(DirName,FileName)); 353 switch FileType 354 case {'image','multimage','civx','civdata','netcdf'} 355 break 356 end 357 end 358 end 359 if isempty(FileName) 360 msgbox_uvmat('ERROR',['no appropriate input file in the DataSeries folder ' fullfile(DirName)]) 361 return 362 end 363 364 %% update the list of campaigns in the menubar 365 MenuCampaign=[{get(handles.MenuCampaign_1,'Label')};{get(handles.MenuCampaign_2,'Label')};... 366 {get(handles.MenuCampaign_3,'Label')};{get(handles.MenuCampaign_4,'Label')};{get(handles.MenuCampaign_5,'Label')}]; 367 check_dir=isempty(find(strcmp(DirFull,MenuCampaign))); 368 if check_dir %insert the new campaign in the list if it is not found 369 MenuCampaign(end)=[]; %suppress the last item 370 MenuCampaign=[{DirFull};MenuCampaign];%insert the new campaign 371 for ilist=1:numel(MenuCampaign) 372 set(handles.(['MenuCampaign_' num2str(ilist)]),'Label',MenuCampaign{ilist}) 373 end 374 % save the list for future opening: 307 375 dir_perso=prefdir; 308 376 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 309 377 if exist(profil_perso,'file') 310 h=load (profil_perso); 311 if isfield(h,'RootPath')&&ischar(h.RootPath) 312 oldfile=h.RootPath; 313 end 314 end 315 end 316 fileinput=uigetfile_uvmat('pick a file to refresh the input table',oldfile); 317 if ~isempty(fileinput) 318 display_file_name(handles,fileinput,'one') 319 end 320 378 save (profil_perso,'MenuCampaign','RootPath','-append'); %store the file names for future opening of uvmat 379 else 380 save (profil_perso,'MenuCampaign','RootPath','-V6'); %store the file names for future opening of uvmat 381 end 382 end 383 384 %% display the selected field and related information 385 if get(handles.CheckAppend,'Value') 386 display_file_name(handles,fullfile(DirName,FileName),'append') 387 else 388 display_file_name(handles,fullfile(DirName,FileName),'one') 389 end 390 set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0]) 321 391 322 392 % -------------------------------------------------------------------- 323 function MenuFile_1_Callback(hObject, eventdata, handles) 324 fileinput=get(handles.MenuFile_1,'Label'); 325 display_file_name(handles,fileinput,'one') 326 327 % -------------------------------------------------------------------- 328 function MenuFile_2_Callback(hObject, eventdata, handles) 329 fileinput=get(handles.MenuFile_2,'Label'); 330 display_file_name(handles,fileinput,'one') 331 332 % -------------------------------------------------------------------- 333 function MenuFile_3_Callback(hObject, eventdata, handles) 334 fileinput=get(handles.MenuFile_3,'Label'); 335 display_file_name( handles,fileinput,'one') 336 337 % -------------------------------------------------------------------- 338 function MenuFile_4_Callback(hObject, eventdata, handles) 339 fileinput=get(handles.MenuFile_4,'Label'); 340 display_file_name(handles,fileinput,'one') 341 342 % -------------------------------------------------------------------- 343 function MenuFile_5_Callback(hObject, eventdata, handles) 344 fileinput=get(handles.MenuFile_5,'Label'); 345 display_file_name(handles,fileinput,'one') 346 347 % -------------------------------------------------------------------- 348 function MenuBrowse_insert_Callback(hObject, eventdata, handles) 349 InputTable=get(handles.InputTable,'Data'); 350 RootPathCell=InputTable(:,1); 351 SubDirCell=InputTable(:,3); 352 RootFileCell=InputTable(:,2); 353 oldfile=''; %default 354 if isempty(RootPathCell)||isequal(RootPathCell,{''})%loads the previously stored file name and set it as default in the file_input box 355 dir_perso=prefdir; 356 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 357 if exist(profil_perso,'file') 358 h=load (profil_perso); 359 if isfield(h,'filebase')&ischar(h.filebase) 360 oldfile=h.filebase; 361 end 362 if isfield(h,'RootPath')&ischar(h.RootPath) 363 oldfile=h.RootPath; 364 end 365 end 366 else 367 oldfile=fullfile(RootPathCell{1},RootFileCell{1}); 368 end 369 fileinput=uigetfile_uvmat('pick a file to append in the input table',oldfile); 370 if ~isempty(fileinput) 371 display_file_name(handles,fileinput,'append') 372 end 373 % [FileName, PathName, filterindex] = uigetfile( ... 374 % {'*.xml;*.xls;*.png;*.avi;*.AVI;*.nc', ' (*.xml,*.xls, *.png, *.avi,*.nc)'; 375 % '*.xml', '.xml files '; ... 376 % '*.xls', '.xls files '; ... 377 % '*.png','.png image files'; ... 378 % '*.avi;*.AVI','.avi movie files'; ... 379 % '*.nc','.netcdf files'; ... 380 % '*.*', 'All Files (*.*)'}, ... 381 % 'Pick a file',oldfile); 382 % fileinput=[PathName FileName];%complete file name 383 % sizf=size(fileinput); 384 % if (~ischar(fileinput)|~isequal(sizf(1),1)),return;end 385 % [path,name,ext]=fileparts(fileinput); 386 % if isequal(ext,'.xml') 387 % msgbox_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer 388 % elseif isequal(ext,'.xls') 389 % msgbox_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer 390 % else 391 % display_file_name(handles,fileinput,'append') 392 % end 393 394 % -------------------------------------------------------------------- 395 function MenuFile_insert_1_Callback(hObject, eventdata, handles) 396 % -------------------------------------------------------------------- 397 fileinput=get(handles.MenuFile_insert_1,'Label'); 398 display_file_name(handles,fileinput,'append') 399 400 % -------------------------------------------------------------------- 401 function MenuFile_insert_2_Callback(hObject, eventdata, handles) 402 % -------------------------------------------------------------------- 403 fileinput=get(handles.MenuFile_insert_2,'Label'); 404 display_file_name(handles,fileinput,'append') 405 406 % -------------------------------------------------------------------- 407 function MenuFile_insert_3_Callback(hObject, eventdata, handles) 408 % -------------------------------------------------------------------- 409 fileinput=get(handles.MenuFile_insert_3,'Label'); 410 display_file_name( handles,fileinput,'append') 411 412 % -------------------------------------------------------------------- 413 function MenuFile_insert_4_Callback(hObject, eventdata, handles) 414 % -------------------------------------------------------------------- 415 fileinput=get(handles.MenuFile_insert_4,'Label'); 416 display_file_name( handles,fileinput,'append') 417 418 % -------------------------------------------------------------------- 419 function MenuFile_insert_5_Callback(hObject, eventdata, handles) 420 % -------------------------------------------------------------------- 421 fileinput=get(handles.MenuFile_insert_5,'Label'); 422 display_file_name(handles,fileinput,'append') 393 function MenuCampaign_Callback(hObject, eventdata, handles) 394 % -------------------------------------------------------------------- 395 set(handles.MenuOpenCampaign,'ForegroundColor',[1 1 0]) 396 OutPut=browse_data(get(hObject,'Label'));% open the GUI browse_data to get select a campaign dir, experiment and device 397 if ~isfield(OutPut,'Campaign') 398 return 399 end 400 DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1}); 401 hdir=dir(DirName); %list files and dirs 402 for ilist=1:numel(hdir) 403 if ~isequal(hdir(ilist).isdir,1)%look for files, not dir 404 FileName=hdir(ilist).name; 405 FileType=get_file_type(fullfile(DirName,FileName)); 406 switch FileType 407 case {'image','multimage','civx','civdata','netcdf'} 408 break 409 end 410 end 411 end 412 if get(handles.CheckAppend,'Value') 413 display_file_name(handles,fullfile(DirName,FileName),'append') 414 else 415 display_file_name(handles,fullfile(DirName,FileName),'one') 416 end 417 set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0]) 418 419 423 420 424 421 %------------------------------------------------------------------------ … … 434 431 end 435 432 %% enable other menus and uicontrols 436 set(handles.MenuOpen _insert,'Enable','on')437 set(handles.Menu File_insert_1,'Enable','on')438 set(handles.Menu File_insert_2,'Enable','on')439 set(handles.Menu File_insert_3,'Enable','on')440 set(handles.Menu File_insert_4,'Enable','on')441 set(handles.Menu File_insert_5,'Enable','on')433 set(handles.MenuOpenCampaign,'Enable','on') 434 set(handles.MenuCampaign_1,'Enable','on') 435 set(handles.MenuCampaign_2,'Enable','on') 436 set(handles.MenuCampaign_3,'Enable','on') 437 set(handles.MenuCampaign_4,'Enable','on') 438 set(handles.MenuCampaign_5,'Enable','on') 442 439 set(handles.RUN, 'Enable','On') 443 440 set(handles.RUN,'BackgroundColor',[1 0 0])% set RUN button to red … … 492 489 % iview: line index in the input table 493 490 % or 'one': refresh the list 494 % ' append': add a new line to the list491 % 'checkappend': add a new line to the list 495 492 496 493 %% get the input root name, indices, file extension and nomenclature NomType … … 521 518 522 519 %% enable other menus and uicontrols 523 set(handles.MenuOpen _insert,'Enable','on')524 set(handles.Menu File_insert_1,'Enable','on')525 set(handles.Menu File_insert_2,'Enable','on')526 set(handles.Menu File_insert_3,'Enable','on')527 set(handles.Menu File_insert_4,'Enable','on')528 set(handles.Menu File_insert_5,'Enable','on')520 set(handles.MenuOpenCampaign,'Enable','on') 521 set(handles.MenuCampaign_1,'Enable','on') 522 set(handles.MenuCampaign_2,'Enable','on') 523 set(handles.MenuCampaign_3,'Enable','on') 524 set(handles.MenuCampaign_4,'Enable','on') 525 set(handles.MenuCampaign_5,'Enable','on') 529 526 set(handles.RUN, 'Enable','On') 530 527 set(handles.RUN,'BackgroundColor',[1 0 0])% set RUN button to red … … 595 592 for ifile=1:min(length(MenuFile),5) 596 593 eval(['set(handles.MenuFile_' num2str(ifile) ',''Label'',MenuFile{ifile});']) 597 eval(['set(handles.MenuFile_insert_' num2str(ifile) ',''Label'',MenuFile{ifile});'])598 594 end 599 595 dir_perso=prefdir; … … 731 727 %% number of slices set by default 732 728 NbSlice=1;%default 733 % read value set by the first series for the append mode (iwiew >1)729 % read value set by the first series for the checkappend mode (iwiew >1) 734 730 if iview>1 && strcmp(get(handles.num_NbSlice,'Visible'),'on') 735 731 NbSlice=str2num(get(handles.num_NbSlice,'String')); … … 738 734 %% default time unit 739 735 TimeUnit=''; 740 % read value set by the first series for the append mode (iwiew >1)736 % read value set by the first series for the checkappend mode (iwiew >1) 741 737 if iview>1 742 738 TimeUnit=get(handles.TimeUnit,'String'); -
trunk/src/series/civ_input.m
r647 r651 56 56 guidata(hObject, handles); % Update handles structure 57 57 set(hObject,'WindowButtonDownFcn',{'mouse_down'}) % allows mouse action with right button (zoom for uicontrol display) 58 SeriesData.ParentHandle=gcbf; 59 SeriesData=get(gcbf,'UserData'); 58 hseries=findobj(allchild(0),'Tag','series'); 59 SeriesData.ParentHandle=hseries; 60 SeriesData=get(hseries,'UserData'); 60 61 % relevant data in gcbf:.FileType,.FileInfo,.Time,.TimeUnit,.GeometryCalib{1}; 61 62 … … 1944 1945 % set(handles.num_FieldSmooth,'Visible','on') 1945 1946 % else 1947 1946 1948 % set(handles.num_subdomainsize,'Visible','off') 1947 1949 % set(handles.num_FieldSmooth,'Visible','off') … … 1955 1957 drawnow 1956 1958 if get(handles.TestCiv1,'Value') 1957 set(handles.TestCiv1,'BackgroundColor',[ 0.7 0.7 0.7])% paint TestCiv1 button to greyto confirm civ launch1959 set(handles.TestCiv1,'BackgroundColor',[1 1 0])% paint TestCiv1 button to yellow to confirm civ launch 1958 1960 ref_i=str2double(get(handles.ref_i,'String'));% read reference i index 1959 1961 if strcmp(get(handles.ref_j,'Visible'),'on') … … 1962 1964 ref_j=1;%default j index 1963 1965 end 1964 [filecell,i1,i2]=set_civ_filenames(handles,ref_i,ref_j,[1 0 0 0 0 0]);% get the corresponding file name and indices1966 % [filecell,i1,i2]=set_civ_filenames(handles,ref_i,ref_j,[1 0 0 0 0 0]);% get the corresponding file name and indices 1965 1967 Data.ListVarName={'ny','nx','A'}; 1966 1968 Data.VarDimName= {'ny','nx',{'ny','nx'}}; 1967 1969 hseries=findobj(allchild(0),'Tag','series'); 1970 hhseries=guidata(hseries); 1971 InputTable=get(hhseries.InputTable,'Data'); 1972 ind_A=1; 1973 if strcmp(InputTable{1,5},'.nc'); 1974 ind_A=2; 1975 end 1976 [i1_series_Civ1,i2_series_Civ1,j1_series_Civ1,j2_series_Civ1,check_bounds,NomTypeNc]=... 1977 find_pair_indices(PairCiv1,i_series{1},j_series{1},MinIndex_i,MaxIndex_i,MinIndex_j,MaxIndex_j); 1978 1979 ImageName_A=fullfile_uvmat(InputTable{ind_A,1},InputTable{ind_A,2},InputTable{ind_A,3},InputTable{ind_A,5},InputTable{ind_A,4},... 1980 ref_i,[],ref_j); 1968 1981 Data.A=imread(filecell.ima1.civ1{1}); % read the first image 1969 1982 if ndims(Data.A)==3 %case of color image -
trunk/src/set_subdomains.m
r587 r651 1 1 %'set_subdomains': sort a set of points defined by scattered coordinates in subdomains, as needed for tps interpolation 2 2 %------------------------------------------------------------------------ 3 % [SubRange,Nb Sites,IndSelSubDomain] =set_subdomains(Coord,SubDomainNbPoint)3 % [SubRange,NbCentre,IndSelSubDomain] =set_subdomains(Coord,SubDomainNbPoint) 4 4 % 5 5 % OUTPUT: 6 6 % SubRange(NbCoord,NbSubdomain,2): range (min, max) of the coordinates x and y respectively, for each subdomain 7 % Nb Sites(NbSubdomain): number of source points for each subdomain7 % NbCentre(NbSubdomain): number of source points for each subdomain 8 8 % IndSelSubDomain(SubDomainNbPointMax,NbSubdomain): set of indices of the input point array 9 % selected in each subdomain, =0 beyond Nb Sitespoints9 % selected in each subdomain, =0 beyond NbCentre points 10 10 % 11 11 % INPUT: … … 13 13 % SubdomainNbPoint: estimated number of data points whished for each subdomain 14 14 15 function [SubRange,Nb Sites,IndSelSubDomain] =set_subdomains(Coord,SubDomainNbPoint)15 function [SubRange,NbCentre,IndSelSubDomain] =set_subdomains(Coord,SubDomainNbPoint) 16 16 17 17 %% adjust subdomain decomposition … … 36 36 %% default output 37 37 SubRange=zeros(NbCoord,2,NbSubDomain);%initialise the positions of subdomains 38 Nb Sites=zeros(NbSubDomain);%number of interpolated values per subdomain, =0 by default38 NbCentre=zeros(1,NbSubDomain);%number of interpolated values per subdomain, =0 by default 39 39 %Coord_tps=zeros(NbVec,NbCoord,NbSubDomain);% default positions of the tps source= initial positions of the good vectors sorted by subdomain 40 40 check_empty=zeros(1,NbSubDomain); … … 61 61 end 62 62 end 63 Nb Sites(isub)=numel(IndSel);64 IndSelSubDomain( :,isub)=IndSel;63 NbCentre(isub)=numel(IndSel); 64 IndSelSubDomain(1:numel(IndSel),isub)=IndSel; 65 65 end 66 66 … … 70 70 if ~isempty(ind_empty) 71 71 SubRange(:,:,ind_empty)=[]; 72 Nb Sites(ind_empty)=[];72 NbCentre(ind_empty)=[]; 73 73 IndSelSubDomain(:,ind_empty)=[]; 74 74 end -
trunk/src/tps_coeff_field.m
r586 r651 1 %'tps_coeff_field': calculate the thin plate spline (tps) coefficients with subdomains for a field structure1 %'tps_coeff_field': calculate the thin plate spline (tps) coefficients within subdomains for a field structure 2 2 %--------------------------------------------------------------------- 3 3 % DataOut=tps_coeff_field(DataIn,checkall) 4 4 % 5 5 % OUTPUT: 6 % DataOut: output field structure 6 % DataOut: output field structure, reproducing the input field structure DataIn and adding the fields: 7 % .Coord_tps 8 % .[VarName '_tps'] for each eligible input variable VarName (scalar ofr vector components) 9 % errormsg: error message, = '' by default 7 10 % 8 11 % INPUT: … … 72 75 end 73 76 ListNewVar=cell(1,numel(VarIndexInterp)+3); 74 ListNewVar(1:3)={['SubRange' term],['NbCentre s' term],['Coord_tps' term]};77 ListNewVar(1:3)={['SubRange' term],['NbCentre' term],['Coord_tps' term]}; 75 78 for ilist=1:numel(VarIndexInterp) 76 79 ListNewVar{ilist+3}=[ListVarInterp{ilist} '_tps' term]; … … 82 85 {{['nb_tps' term],'nb_coord',['nb_subdomain' term]}}]; 83 86 DataOut.VarAttribute{nbvar+3}.Role='coord_tps'; 84 [SubRange,NbCentre s,IndSelSubDomain] =set_subdomains([X Y],SubDomainNbPoint);% create subdomains for tps87 [SubRange,NbCentre,IndSelSubDomain] =set_subdomains([X Y],SubDomainNbPoint);% create subdomains for tps 85 88 for isub=1:size(SubRange,3) 86 ind_sel=IndSelSubDomain(1:NbCentres(isub),isub);% array indices selected for the subdomain 87 Coord_tps=[X(ind_sel) Y(ind_sel)]; 88 fill=zeros(NbCoord+1,NbCoord,size(SubRange,3)); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage) 89 Coord_tps=cat(1,Coord_tps,fill); 89 ind_sel=IndSelSubDomain(1:NbCentre(isub),isub);% array indices selected for the subdomain 90 DataOut.(['Coord_tps' term])(1:NbCentre(isub),1:2,isub)=[X(ind_sel) Y(ind_sel)]; 91 DataOut.(['Coord_tps' term])(NbCentre(isub)+1:NbCentre(isub)+3,1:2,isub)=0;%matrix of zeros to complement the matrix Coord_tps (conveninent for file storage) 92 %fill=zeros(NbCoord+1,NbCoord,size(SubRange,3)); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage) 93 % fill=zeros(NbCoord+1,NbCoord+1,NbCoord); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage) 94 % Coord_tps=cat(1,Coord_tps,fill); 90 95 end 91 96 for ivar=1:numel(VarIndexInterp) … … 106 111 end 107 112 DataOut.(['SubRange' term])=SubRange; 108 DataOut.(['NbCentre s' term])=NbCentres;109 DataOut.(['Coord_tps' term])=Coord_tps;113 DataOut.(['NbCentre' term])=NbCentre; 114 % DataOut.(['Coord_tps' term])=Coord_tps; 110 115 for ilist=1:numel(VarIndexInterp) 116 % Var_tps=zeros(size(IndSelSubDomain)+[NbCoord+1 0]);%default spline 111 117 for isub=1:size(SubRange,3) 112 Var_tps=zeros(size(IndSelSubDomain)+[NbCoord+1 0]);%default spline113 [tild,Var_tps( :,isub)]=tps_coeff([X(ind_sel) Y(ind_sel)],DataIn.(ListVarInterp{ilist}),0);%calculate the tps coeff in the subdomain118 ind_sel=IndSelSubDomain(1:NbCentre(isub),isub);% array indices selected for the subdomain 119 [tild,Var_tps(1:NbCentre(isub)+NbCoord+1,isub)]=tps_coeff([X(ind_sel) Y(ind_sel)],DataIn.(ListVarInterp{ilist})(ind_sel),0);%calculate the tps coeff in the subdomain 114 120 end 115 121 DataOut.(ListNewVar{ilist+3})=Var_tps; -
trunk/src/uigetfile_uvmat.m
r648 r651 15 15 % 'image': any image or movie 16 16 % '.ext': display only files with extension '.ext' 17 % 'uigetdir'; browser used to select a directory (like the matlab browser 'uigetdir') 17 18 18 19 function fileinput=uigetfile_uvmat(title,InputName,FilterExt) … … 52 53 Width=350;% fig width in points (1/72 inch) 53 54 Height=min(0.8*ScreenSize(4),500); 54 Left=ScreenSize(3)- Width-40; %right edge close to the right, with margin=40 55 Left=ScreenSize(3)- Width-40; %right edge close to the right, with margin=40 55 56 Bottom=ScreenSize(4)-Height-40; %put fig at top right 56 57 hfig=figure('name',option,'tag',option,'MenuBar','none','NumberTitle','off','Unit','points','Position',[Left,Bottom,Width,Height],'UserData',InputDir); 57 58 BackgroundColor=get(hfig,'Color'); 58 uicontrol('Style','text','Units','normalized', 'Position', [0.05 0.97 0.5 0.03],'BackgroundColor',BackgroundColor,... 59 'String','path:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left'); 60 uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.89 0.9 0.08],'tag','titlebox','Max',2,'BackgroundColor',[1 1 1],'Callback',@titlebox_Callback,... 61 'String',InputDir,'FontUnits','points','FontSize',12,'FontWeight','bold'); 62 uicontrol('Style','pushbutton','Tag','backward','Units','normalized','Position',[0.05 0.75 0.1 0.07],... 63 'String','<--','FontWeight','bold','FontUnits','points','FontSize',12,'Callback',@backward); 64 uicontrol('Style','togglebutton','Units','normalized', 'Position', [0.75 0.75 0.2 0.04],'tag','check_date','Callback',@dates_Callback,... 65 'String','dates','FontUnits','points','FontSize',12,'FontWeight','bold'); 66 uicontrol('Style','text','Units','normalized', 'Position', [0.4 0.8 0.35 0.03],'BackgroundColor',BackgroundColor,... 67 'String','sort: ','FontUnits','points','FontSize',12,'FontWeight','bold','HorizontalAlignment','right'); 68 uicontrol('Style','popupmenu','Units','normalized', 'Position', [0.75 0.8 0.2 0.04],'tag','sort_option','Callback',@refresh_GUI,'Visible','off',... 69 'String',{'name';'date'},'FontUnits','points','FontSize',12,'FontWeight','bold'); 70 uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.08 0.9 0.66], 'Callback', @(src,event)list_Callback(option,FilterExt,src,event),'tag','list',... 71 'FontUnits','points','FontSize',12); 72 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.005 0.2 0.07],'Callback',@(src,event)close(option,src,event),... 59 path_title=uicontrol('Style','text','Units','normalized', 'Position', [0.02 0.97 0.9 0.03],'BackgroundColor',BackgroundColor,'Tag','Path_title',... 60 'String','path:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left'); 61 htitlebox=uicontrol('Style','edit','Units','normalized', 'Position', [0.02 0.89 0.96 0.08],'tag','titlebox','Max',2,'BackgroundColor',[1 1 1],'Callback',@titlebox_Callback,... 62 'String',InputDir,'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''titlebox'':current path'); 63 uicontrol('Style','pushbutton','Tag','backward','Units','normalized','Position',[0.02 0.77 0.1 0.05],... 64 'String','<--','FontWeight','bold','FontUnits','points','FontSize',12,'Callback',@backward,'TooltipString','move backward'); 65 home_button=uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.35 0.005 0.3 0.07],... 66 'String','Work dir','FontWeight','bold','FontUnits','points','FontSize',12,'Callback',@home_dir,'TooltipString','reach the current Matlab working directory'); 67 68 uicontrol('Style','popupmenu','Units','normalized', 'Position', [0.75 0.75 0.23 0.04],'tag','sort_option','Callback',@refresh_GUI,'Visible','off',... 69 'String',{'sort name';'sort date'},'FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''sort_option'': sort the files by names or dates'); 70 uicontrol('Style','listbox','Units','normalized', 'Position',[0.02 0.08 0.96 0.66], 'Callback', @(src,event)list_Callback(option,FilterExt,src,event),'tag','list',... 71 'FontUnits','points','FontSize',12,'TooltipString','''list'':current list of directories, marked by +/, and files'); 72 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.78 0.005 0.2 0.07],'Callback',@(src,event)close(option,src,event),... 73 73 'String','Close','FontWeight','bold','FontUnits','points','FontSize',12); 74 uicontrol('Style','pushbutton','Tag','refresh','Units','normalized','Position', [0. 10.005 0.2 0.07],'Callback',@refresh_GUI,...74 uicontrol('Style','pushbutton','Tag','refresh','Units','normalized','Position', [0.02 0.005 0.2 0.07],'Callback',@refresh_GUI,... 75 75 'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',12); 76 OK_button=uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.75 0.81 0.23 0.07],'BackgroundColor',[0 1 0],... 77 'String','OK','FontWeight','bold','FontUnits','points','FontSize',12,'Callback',@(src,event)OK_Callback(option,FilterExt,src,event)); 76 78 %set(hrefresh,'UserData',StatusData) 77 79 if strcmp(option,'status_display') %put a run advancement display 78 80 set(hfig,'DeleteFcn',@(src,event)close(option,src,event)) 79 uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.85 0.9 0.04]); 80 uicontrol('Style','frame','Units','normalized', 'Position',[0.05 0.85 0.01 0.04],'BackgroundColor',[1 0 0],'tag','waitbar'); 81 81 uicontrol('Style','frame','Units','normalized', 'Position', [0.02 0.85 0.9 0.04]); 82 uicontrol('Style','frame','Units','normalized', 'Position',[0.02 0.85 0.01 0.04],'BackgroundColor',[1 0 0],'tag','waitbar'); 83 % uicontrol('Style','text','Units','normalized', 'Position', [0.4 0.8 0.35 0.03],'BackgroundColor',BackgroundColor,... 84 % 'String','sort: ','FontUnits','points','FontSize',12,'FontWeight','bold','HorizontalAlignment','right'); 85 delete(home_button) 86 set(OK_button,'String','OPEN') 87 elseif strcmp(FilterExt,'uigetdir') %pick a directory 88 set(path_title,'String',title); %show the input title for path (directory) 82 89 else %put a title and additional pushbuttons 83 uicontrol('Style','text','Units','normalized', 'Position', [0. 15 0.750.6 0.03],'BackgroundColor',BackgroundColor,...90 uicontrol('Style','text','Units','normalized', 'Position', [0.02 0.74 0.6 0.03],'BackgroundColor',BackgroundColor,... 84 91 'String',title,'FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left'); 85 86 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.4 0.005 0.2 0.07],... 87 'String','Home','FontWeight','bold','FontUnits','points','FontSize',12,'Callback',@home_dir); 92 uicontrol('Style','togglebutton','Units','normalized', 'Position', [0.75 0.78 0.23 0.04],'tag','check_date','Callback',@dates_Callback,... 93 'String','show dates','FontUnits','points','FontSize',12,'FontWeight','bold','TooltipString','''check_date'':press button to display dates'); 94 % uicontrol('Style','text','Units','normalized', 'Position', [0.37 0.8 0.35 0.03],'BackgroundColor',BackgroundColor,... 95 % 'String','sort: ','FontUnits','points','FontSize',12,'FontWeight','bold','HorizontalAlignment','right'); 96 88 97 end 89 98 drawnow 90 99 end 91 refresh_GUI(findobj(hfig,'Tag','refresh'),InputFileName,FilterExt)% refresh the list of content of the current dir 92 if ~strcmp(option,'status_display') 100 refresh_GUI(findobj(hfig,'Tag','refresh'),InputFileName,FilterExt)% refresh the list of content of the current dir 101 if ~strcmp(option,'status_display') 93 102 uiwait(hfig) 94 103 if ishandle(hfig) 95 htitlebox=findobj(hfig,'Tag','titlebox');96 fileinput=get(htitlebox,'String');% retrieve the input file selection97 delete(hfig)104 htitlebox=findobj(hfig,'Tag','titlebox'); 105 fileinput=get(htitlebox,'String');% retrieve the input file selection 106 delete(hfig) 98 107 end 99 108 end … … 101 110 %------------------------------------------------------------------------ 102 111 % --- launched by refreshing the display figure 112 %------------------------------------------------------------------------ 103 113 function titlebox_Callback(hObject,event) 104 114 refresh_GUI(hObject) 105 %------------------------------------------------------------------------ 115 116 %------------------------------------------------------------------------ 117 % --- launched by selecting OK (relevant for FilterExt='uigetdir') 118 %------------------------------------------------------------------------ 119 function OK_Callback(option,filter_ext,hObject,event) 120 hfig=get(hObject,'parent');%handle of the fig 121 % if ~strcmp(get(hfig,'SelectionType'),'open') 122 % return %select double click 123 % end 124 %set(hObject,'BackgroundColor',[1 1 0])% paint list in yellow to indicate action 125 % drawnow 126 htitlebox=findobj(hfig,'tag','titlebox'); % display the current dir name 127 DirName=get(htitlebox,'String'); 128 129 if ~strcmp(filter_ext,'uigetdir')% a file is expected as output, not a dir 130 hlist=findobj(hfig,'Tag','list'); 131 list=get(hlist,'String'); 132 index=get(hlist,'Value'); 133 SelectName=regexprep(list{index},'^\+/','');% remove the +/ used to mark dir 134 ind_dot=regexp(SelectName,'\s*\.\.\.');%remove what is beyond '...' 135 if ~isempty(ind_dot) 136 SelectName=SelectName(1:ind_dot-1); 137 end 138 % if strcmp(SelectName,'..')% the upward dir option has been selected 139 % FullSelectName=fileparts(DirName); 140 % else 141 FullSelectName=fullfile(DirName,SelectName); 142 % end 143 if exist(FullSelectName,'file') 144 switch option 145 case 'browser' 146 set(htitlebox,'String',FullSelectName); 147 uiresume(hfig) 148 case 'status_display' 149 FileType=get_file_type(FullSelectName); 150 if strcmp(FileType,'txt') 151 edit(FullSelectName) 152 elseif strcmp(FileType,'xml') 153 editxml(FullSelectName) 154 elseif strcmp(FileType,'figure') 155 open(FullSelectName) 156 else 157 uvmat(FullSelectName); 158 end 159 end 160 end 161 end 162 %set(hObject,'BackgroundColor',[0.7 0.7 0.7])% paint list in grey to indicate action end 163 164 uiresume(get(hObject,'parent')) 106 165 107 166 %------------------------------------------------------------------------ … … 113 172 end 114 173 if ~exist('FilterExt','var') 174 FilterExt='*'; 175 end 176 if strcmp(FilterExt,'uigetdir') 115 177 FilterExt='*'; 116 178 end … … 165 227 set(hlist,'Value',Value) 166 228 set(hlist,'BackgroundColor',[0.7 0.7 0.7]) 229 167 230 %------------------------------------------------------------------------ 168 231 % --- launched by selecting an item on the file list 232 %------------------------------------------------------------------------ 169 233 function dates_Callback(hObject,event) 170 %------------------------------------------------------------------------ 234 171 235 hfig=get(hObject,'parent'); 172 236 hsort_option=findobj(hfig,'tag','sort_option'); … … 178 242 end 179 243 refresh_GUI(hObject,[]) 244 180 245 181 246 %------------------------------------------------------------------------ … … 205 270 end 206 271 if exist(FullSelectName,'dir')% a directory has been selected 207 % ListFiles=dir(FullSelectName);208 % ListDisplay=cell(numel(ListFiles),1);209 % for ilist=2:numel(ListDisplay)% suppress the first line '.'210 % ListDisplay{ilist-1}=ListFiles(ilist).name;211 % end212 % set(hObject,'Value',1)213 % set(hObject,'String',ListDisplay)214 % if strcmp(selectname,'..')215 % FullSelectName=fileparts(fileparts(FullSelectName));216 % end217 272 set(hObject,'BackgroundColor',[1 1 0])% paint list in yellow to indicate action 218 273 drawnow … … 231 286 set(hObject,'BackgroundColor',[0.7 0.7 0.7]) 232 287 set(htitlebox,'String',FullSelectName)% record the new dir name 233 elseif exist(FullSelectName,'file')%visualise the field if it exists234 switch option235 case 'browser'236 set(htitlebox,'String',FullSelectName);237 uiresume(hfig)238 case 'status_display'239 FileType=get_file_type(FullSelectName);240 if strcmp(FileType,'txt')241 edit(FullSelectName)242 elseif strcmp(FileType,'xml')243 editxml(FullSelectName)244 elseif strcmp(FileType,'figure')245 open(FullSelectName)246 else247 uvmat(FullSelectName);248 end249 end250 288 end 251 289 set(hObject,'BackgroundColor',[0.7 0.7 0.7])% paint list in grey to indicate action end … … 265 303 check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files 266 304 ListFiles(check_dir)=regexprep(ListFiles(check_dir),'^.+','+/$0');% put '+/' in front of dir name display 267 if exist('filter_ext','var') && ~strcmp(filter_ext,'*') 305 if exist('filter_ext','var') && ~strcmp(filter_ext,'*') &&~strcmp(filter_ext,'uigetdir') 268 306 if strcmp(filter_ext,'image') 269 307 check_keep=cellfun(@isimage,ListFiles) ; … … 277 315 check_dir=check_dir(check_keep); 278 316 end 317 check_emptydate=cellfun('isempty',ListCells(5,:));% = 1 if datenum undefined 318 ListCells(5,find(check_emptydate))={0}; %set to 0 the empty dates 279 319 ListDates=cell2mat(ListCells(5,:));%list of numerical dates 280 320 if isnumeric(sort_option) -
trunk/src/uvmat.m
r650 r651 49 49 % 50 50 % 51 % 1) Input filenames are determined by MenuBrowse (first field), MenuBrowse _151 % 1) Input filenames are determined by MenuBrowse (first field), MenuBrowseCampaign 52 52 % (second field), or by the stored file name .FileName_1, or as an input of uvmat. 53 53 % 2) These functions call 'uvmat/display_file_name.m' which detects the file series, and fills the file index boxes … … 229 229 dir_perso=prefdir; % path to the directory .matlab containing the personal data of the current user 230 230 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');% personal data file uvmat_perso.mat' in .matlab 231 if exist(profil_perso,'file') 232 h=load (profil_perso); 233 if isfield(h,'MenuFile')% load the menu of previously opened files231 if exist(profil_perso,'file')% if the file exists 232 h=load (profil_perso); % open the personal file 233 if isfield(h,'MenuFile')% load the saved menu of previously opened files 234 234 for ifile=1:min(length(h.MenuFile),5) 235 235 set(handles.(['MenuFile_' num2str(ifile)]),'Label',h.MenuFile{ifile}); 236 set(handles.(['MenuFile_' num2str(ifile) '_1']),'Label',h.MenuFile{ifile}); 236 end 237 end 238 if isfield(h,'MenuCampaign')% load the saved menu of previously opened campaigns 239 for ifile=1:min(length(h.MenuCampaign),5) 240 set(handles.(['MenuCampaign_' num2str(ifile)]),'Label',h.MenuCampaign{ifile}); 237 241 end 238 242 end … … 434 438 oldfile=get(handles.RootPath,'UserData'); 435 439 end 436 fileinput=uigetfile_uvmat(' select an input file:',oldfile);440 fileinput=uigetfile_uvmat('pick an input file',oldfile); 437 441 438 442 %% display the selected field and related information … … 442 446 443 447 % ----------------------------------------------------------------------- 448 % --- Open again the file whose name has been recorded in MenuFile_1 449 function MenuFile_Callback(hObject, eventdata, handles) 450 %------------------------------------------------------------------------ 451 fileinput=get(hObject,'Label'); 452 display_file_name( handles,fileinput) 453 % 454 % % ----------------------------------------------------------------------- 455 % % --- Open again the file whose name has been recorded in MenuFile_2 456 % function MenuFile_2_Callback(hObject, eventdata, handles) 457 % %------------------------------------------------------------------------ 458 % fileinput=get(handles.MenuFile_2,'Label'); 459 % display_file_name(handles,fileinput) 460 % 461 % % ----------------------------------------------------------------------- 462 % % --- Open again the file whose name has been recorded in MenuFile_3 463 % function MenuFile_3_Callback(hObject, eventdata, handles) 464 % %------------------------------------------------------------------------ 465 % fileinput=get(handles.MenuFile_3,'Label'); 466 % display_file_name(handles,fileinput) 467 % 468 % % ----------------------------------------------------------------------- 469 % % --- Open again the file whose name has been recorded in MenuFile_4 470 % function MenuFile_4_Callback(hObject, eventdata, handles) 471 % %------------------------------------------------------------------------ 472 % fileinput=get(handles.MenuFile_4,'Label'); 473 % display_file_name(handles,fileinput) 474 % 475 % % ----------------------------------------------------------------------- 476 % % --- Open again the file whose name has been recorded in MenuFile_5 477 % function MenuFile_5_Callback(hObject, eventdata, handles) 478 % %------------------------------------------------------------------------ 479 % fileinput=get(handles.MenuFile_5,'Label'); 480 % display_file_name(handles,fileinput) 481 482 483 % ----------------------------------------------------------------------- 444 484 % --- Executes on the menu Open/Browse campaign... 445 % search the file inside a campaign, using the GUI view_data 485 % --- search the file inside a campaign, using the GUI browse_data 486 % ----------------------------------------------------------------------- 446 487 function MenuBrowseCampaign_Callback(hObject, eventdata, handles) 447 % ----------------------------------------------------------------------- 488 set(handles.MenuOpenCampaign,'ForegroundColor',[1 1 0]) 489 drawnow 448 490 RootPath=get(handles.RootPath,'String'); 449 491 if isempty(RootPath) … … 451 493 end 452 494 CampaignPath=fileparts(fileparts(RootPath)); 453 DirFull = uigetdir(CampaignPath,'Select a Campaign dir, then press OK'); 454 if ~ischar(DirFull)|| ~exist(DirFull,'dir') 495 DirFull=uigetfile_uvmat('define this path as the Campaign folder:',CampaignPath,'uigetdir'); 496 %DirFull = uigetdir(CampaignPath,'Select a Campaign dir, then press OK'); 497 if isempty(DirFull) 455 498 return 456 499 end … … 459 502 return 460 503 end 461 DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.Device{1}); 504 DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1}); 505 ListStruct=dir(DirName); %list files and the dir DataSeries 506 % select the first appropriate file in the dir 507 FileName=''; 508 for ilist=1:numel(ListStruct) 509 if ~isequal(ListStruct(ilist).isdir,1)%look for files, not dir 510 FileName=ListStruct(ilist).name; 511 FileType=get_file_type(fullfile(DirName,FileName)); 512 switch FileType 513 case {'image','multimage','civx','civdata','netcdf'} 514 break 515 end 516 end 517 end 518 if isempty(FileName) 519 msgbox_uvmat('ERROR',['no appropriate input file in the DataSeries folder ' fullfile(DirName)]) 520 return 521 end 522 523 %% update the list of campaigns in the menubar 524 MenuCampaign=[{get(handles.MenuCampaign_1,'Label')};{get(handles.MenuCampaign_2,'Label')};... 525 {get(handles.MenuCampaign_3,'Label')};{get(handles.MenuCampaign_4,'Label')};{get(handles.MenuCampaign_5,'Label')}]; 526 check_dir=isempty(find(strcmp(DirFull,MenuCampaign))); 527 if check_dir %insert the new campaign in the list if it is not found 528 MenuCampaign(end)=[]; %suppress the last item 529 MenuCampaign=[{DirFull};MenuCampaign];%insert the new campaign 530 for ilist=1:numel(MenuCampaign) 531 set(handles.(['MenuCampaign_' num2str(ilist)]),'Label',MenuCampaign{ilist}) 532 end 533 % save the list for future opening: 534 dir_perso=prefdir; 535 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 536 if exist(profil_perso,'file') 537 save (profil_perso,'MenuCampaign','RootPath','-append'); %store the file names for future opening of uvmat 538 else 539 save (profil_perso,'MenuCampaign','RootPath','-V6'); %store the file names for future opening of uvmat 540 end 541 end 542 543 %% display the selected field and related information 544 display_file_name( handles,fullfile(DirName,FileName)) 545 546 set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0]) 547 548 % ----------------------------------------------------------------------- 549 % --- Open again as second field the file whose name has been recorded in MenuFile_1 550 % ----------------------------------------------------------------------- 551 function MenuCampaign_Callback(hObject, eventdata, handles) 552 553 set(handles.MenuOpenCampaign,'ForegroundColor',[1 1 0]) 554 OutPut=browse_data(get(hObject,'Label'));% open the GUI browse_data to get select a campaign dir, experiment and device 555 if ~isfield(OutPut,'Campaign') 556 return 557 end 558 DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.DataSeries{1}); 462 559 hdir=dir(DirName); %list files and dirs 463 560 for ilist=1:numel(hdir) … … 471 568 end 472 569 end 473 474 %% display the selected field and related information 475 display_file_name( handles,fullfile(DirName,FileName)) 476 477 % ----------------------------------------------------------------------- 478 % --- Open again the file whose name has been recorded in MenuFile_1 479 function MenuFile_1_Callback(hObject, eventdata, handles) 480 %------------------------------------------------------------------------ 481 fileinput=get(handles.MenuFile_1,'Label'); 482 display_file_name( handles,fileinput) 483 484 % ----------------------------------------------------------------------- 485 % --- Open again the file whose name has been recorded in MenuFile_2 486 function MenuFile_2_Callback(hObject, eventdata, handles) 487 %------------------------------------------------------------------------ 488 fileinput=get(handles.MenuFile_2,'Label'); 489 display_file_name(handles,fileinput) 490 491 % ----------------------------------------------------------------------- 492 % --- Open again the file whose name has been recorded in MenuFile_3 493 function MenuFile_3_Callback(hObject, eventdata, handles) 494 %------------------------------------------------------------------------ 495 fileinput=get(handles.MenuFile_3,'Label'); 496 display_file_name(handles,fileinput) 497 498 % ----------------------------------------------------------------------- 499 % --- Open again the file whose name has been recorded in MenuFile_4 500 function MenuFile_4_Callback(hObject, eventdata, handles) 501 %------------------------------------------------------------------------ 502 fileinput=get(handles.MenuFile_4,'Label'); 503 display_file_name(handles,fileinput) 504 505 % ----------------------------------------------------------------------- 506 % --- Open again the file whose name has been recorded in MenuFile_5 507 function MenuFile_5_Callback(hObject, eventdata, handles) 508 %------------------------------------------------------------------------ 509 fileinput=get(handles.MenuFile_5,'Label'); 510 display_file_name(handles,fileinput) 511 512 %------------------------------------------------------------------------ 513 % --- Executes on the menu Open/Browse_1 for the second input field, 514 % search the files, recognize their type according to their name and fill the rootfile input windows 515 function MenuBrowse_1_Callback(hObject, eventdata, handles) 516 %------------------------------------------------------------------------ 517 RootPath=get(handles.RootPath,'String'); 518 SubDir=get(handles.SubDir,'String'); 519 fileinput_1=uigetfile_uvmat('select a second input file:',fullfile(RootPath,SubDir)); 520 521 if ~isempty(fileinput_1) 522 523 % refresh the current displayed field 524 set(handles.SubField,'Value',1) 525 display_file_name(handles,fileinput_1,2) 526 527 %update list of recent files in the menubar 528 MenuFile_1=fileinput_1; 529 MenuFile_2=get(handles.MenuFile_1,'Label'); 530 MenuFile_3=get(handles.MenuFile_2,'Label'); 531 MenuFile_4=get(handles.MenuFile_3,'Label'); 532 MenuFile_5=get(handles.MenuFile_4,'Label'); 533 set(handles.MenuFile_1,'Label',MenuFile_1) 534 set(handles.MenuFile_2,'Label',MenuFile_2) 535 set(handles.MenuFile_3,'Label',MenuFile_3) 536 set(handles.MenuFile_4,'Label',MenuFile_4) 537 set(handles.MenuFile_5,'Label',MenuFile_5) 538 set(handles.MenuFile_1_1,'Label',MenuFile_1) 539 set(handles.MenuFile_2_1,'Label',MenuFile_2) 540 set(handles.MenuFile_3_1,'Label',MenuFile_3) 541 set(handles.MenuFile_4_1,'Label',MenuFile_4) 542 set(handles.MenuFile_5_1,'Label',MenuFile_5) 543 end 544 545 % -------------------------------------------------------------------- 546 function MenuBrowseCampaign_1_Callback(hObject, eventdata, handles) 547 % ----------------------------------------------------------------------- 548 CampaignPath=fileparts(fileparts(get(handles.RootPath,'String'))); 549 DirFull = uigetdir(CampaignPath,'Select a Campaign dir, then press OK'); 550 if ~ischar(DirFull)|| ~exist(DirFull,'dir') 551 return 552 end 553 OutPut=browse_data(DirFull);% open the GUI browse_data to get select a campaign dir, experiment and device 554 if ~isfield(OutPut,'Campaign') 555 return 556 end 557 DirName=fullfile(OutPut.Campaign,OutPut.Experiment{1},OutPut.Device{1}); 558 hdir=dir(DirName); %list files and dirs 559 for ilist=1:numel(hdir) 560 if ~isequal(hdir(ilist).isdir,1)%look for files, not dir 561 FileName=hdir(ilist).name; 562 FileType=get_file_type(fullfile(DirName,FileName)); 563 switch FileType 564 case {'image','multimage','civx','civdata','netcdf'} 565 break 566 end 567 end 568 end 569 570 %% display the selected field and related information 571 set(handles.SubField,'Value',1) 572 display_file_name( handles,fullfile(DirName,FileName),2) 573 574 % ----------------------------------------------------------------------- 575 % --- Open again as second field the file whose name has been recorded in MenuFile_1 576 function MenuFile_1_1_Callback(hObject, eventdata, handles) 577 % ----------------------------------------------------------------------- 578 fileinput_1=get(handles.MenuFile_1_1,'Label'); 579 set(handles.SubField,'Value',1) 580 display_file_name(handles,fileinput_1,2) 581 582 % ----------------------------------------------------------------------- 583 % --- Open again as second field the file whose name has been recorded in MenuFile_2 584 function MenuFile_2_1_Callback(hObject, eventdata, handles) 585 % ----------------------------------------------------------------------- 586 fileinput_1=get(handles.MenuFile_2_1,'Label'); 587 set(handles.SubField,'Value',1) 588 display_file_name(handles,fileinput_1,2) 589 590 % ----------------------------------------------------------------------- 591 % --- Open again as second field the file whose name has been recorded in MenuFile_3 592 function MenuFile_3_1_Callback(hObject, eventdata, handles) 593 % ----------------------------------------------------------------------- 594 fileinput_1=get(handles.MenuFile_3_1,'Label'); 595 set(handles.SubField,'Value',1) 596 display_file_name(handles,fileinput_1,2) 597 598 % ----------------------------------------------------------------------- 599 % --- Open again as second field the file whose name has been recorded in MenuFile_4 600 function MenuFile_4_1_Callback(hObject, eventdata, handles) 601 % ----------------------------------------------------------------------- 602 fileinput_1=get(handles.MenuFile_4_1,'Label'); 603 set(handles.SubField,'Value',1) 604 display_file_name(handles,fileinput_1,2) 605 606 % ----------------------------------------------------------------------- 607 % --- Open again as second field the file whose name has been recorded in MenuFile_5 608 function MenuFile_5_1_Callback(hObject, eventdata, handles) 609 % ----------------------------------------------------------------------- 610 fileinput_1=get(handles.MenuFile_5_1,'Label'); 611 set(handles.SubField,'Value',1) 612 display_file_name(handles,fileinput_1,2) 570 display_file_name(handles,fullfile(DirName,FileName)) 571 set(handles.MenuOpenCampaign,'ForegroundColor',[0 0 0]) 613 572 614 573 %------------------------------------------------------------------------ … … 855 814 856 815 %enable other menus 857 set(handles.MenuOpen _1,'Enable','on')858 set(handles.MenuFile_1_1,'Enable','on')859 set(handles.MenuFile_2_1,'Enable','on')860 set(handles.MenuFile_3_1,'Enable','on')861 set(handles.MenuFile_4_1,'Enable','on')862 set(handles.MenuFile_5_1,'Enable','on')816 set(handles.MenuOpenCampaign,'Enable','on') 817 % set(handles.MenuCampaign_1,'Enable','on') 818 % set(handles.MenuCampaign_2,'Enable','on') 819 % set(handles.MenuCampaign_3,'Enable','on') 820 % set(handles.MenuCampaign_4,'Enable','on') 821 % set(handles.MenuCampaign_5,'Enable','on') 863 822 set(handles.MenuExport,'Enable','on') 864 823 set(handles.MenuExportFigure,'Enable','on') … … 880 839 for ifile=1:min(length(MenuFile),5) 881 840 set(handles.(['MenuFile_' num2str(ifile)]),'Label',MenuFile{ifile}); 882 set(handles.(['MenuFile_' num2str(ifile) '_1']),'Label',MenuFile{ifile});841 %set(handles.(['MenuFile_' num2str(ifile) '_1']),'Label',MenuFile{ifile}); 883 842 end 884 843 dir_perso=prefdir; … … 2570 2529 end 2571 2530 UvData.Field.CoordMesh=min(Mesh); 2572 UvData.Field.XMax=max(CoordMax( ind,end));2573 UvData.Field.XMin=min(CoordMin( ind,end));2574 UvData.Field.YMax=max(CoordMax( ind,end-1));2575 UvData.Field.YMin=m ax(CoordMin(ind,end-1));2531 UvData.Field.XMax=max(CoordMax(:,end)); 2532 UvData.Field.XMin=min(CoordMin(:,end)); 2533 UvData.Field.YMax=max(CoordMax(:,end-1)); 2534 UvData.Field.YMin=min(CoordMin(:,end-1)); 2576 2535 if NbDim==3 2577 2536 UvData.Field.ZMax=max(CoordMax(ind,1)); … … 3073 3032 if strcmp(transform_fct,'sub_field') 3074 3033 set(handles.TransformName,'Value',1)%suppress the sub_field transform 3075 T 3076 3077 3078 ransformName_Callback(hObject, eventdata, handles); 3034 TransformName_Callback(hObject, eventdata, handles); 3079 3035 else 3080 3036 run0_Callback(hObject, eventdata, handles) 3081 3037 end 3082 3038 else 3083 MenuBrowse_1_Callback(hObject, eventdata, handles) 3039 %RootPath=get(handles.RootPath,'String'); 3040 %SubDir=get(handles.SubDir,'String'); 3041 fileinput_1=uigetfile_uvmat('select a second input file:',get(handles.RootPath,'String')); 3042 if isempty(fileinput_1) 3043 set(handles.SubField,'Value',0) 3044 else 3045 3046 % refresh the current displayed field 3047 set(handles.SubField,'Value',1) 3048 display_file_name(handles,fileinput_1,2) 3049 3050 %update list of recent files in the menubar 3051 MenuFile_1=fileinput_1; 3052 MenuFile_2=get(handles.MenuFile_1,'Label'); 3053 MenuFile_3=get(handles.MenuFile_2,'Label'); 3054 MenuFile_4=get(handles.MenuFile_3,'Label'); 3055 MenuFile_5=get(handles.MenuFile_4,'Label'); 3056 set(handles.MenuFile_1,'Label',MenuFile_1) 3057 set(handles.MenuFile_2,'Label',MenuFile_2) 3058 set(handles.MenuFile_3,'Label',MenuFile_3) 3059 set(handles.MenuFile_4,'Label',MenuFile_4) 3060 set(handles.MenuFile_5,'Label',MenuFile_5) 3061 end 3062 % MenuBrowse_1_Callback(hObject, eventdata, handles) 3084 3063 end 3085 3064 … … 3244 3223 % display the selected field and related information 3245 3224 display_file_name(handles,imagename)%display the image 3246 %otherwise3225 otherwise 3247 3226 % ext=get(handles.FileExt,'String'); 3248 3227 % if ~isequal(ext,'.nc') %find the new NomType if the previous display was not already a netcdf file … … 3254 3233 % if ~ischar(FileName),return,end %abandon if the browser is cancelled 3255 3234 % FullFileName=[PathName FileName]; 3256 % % display the selected field and related information 3257 % display_file_name( handles,FullFileName) 3258 % return 3259 % end 3260 end 3261 % indices=fullfile_uvmat('','','','',NomType,i1,i2,j1,j2); 3262 % set(handles.FileIndex,'String',indices) 3263 % 3264 % %common to Fields_1_Callback 3265 % list_fields_1=get(handles.FieldName_1,'String');% list menu fields 3266 % field_1=''; 3267 % if ~isempty(list_fields_1) 3268 % field_1= list_fields_1{get(handles.FieldName_1,'Value')}; % selected string 3269 % end 3270 % if isequal(field,'image')||isequal(field_1,'image') 3271 % set(handles.TitleNpxy,'Visible','on')% visible npx,pxcm... buttons 3272 % set(handles.num_Npx,'Visible','on') 3273 % set(handles.num_Npy,'Visible','on') 3274 % else 3275 % set(handles.TitleNpxy,'Visible','off')% visible npx,pxcm... buttons 3276 % set(handles.num_Npx,'Visible','off') 3277 % set(handles.num_Npy,'Visible','off') 3278 % end 3279 % if ~(isfield(UvData,'NewSeries')&&isequal(UvData.NewSeries,1)) 3280 % run0_Callback(hObject, eventdata, handles) 3281 % end 3235 % display the selected field and related information 3236 run0_Callback(hObject, eventdata, handles) 3237 end 3282 3238 3283 3239 %---------------------------------------------------------------- … … 5240 5196 function MenuSeries_Callback(hObject, eventdata, handles) 5241 5197 %------------------------------------------------------------------------ 5198 Param=read_param(handles); 5199 series(Param); %run the series interface 5200 5201 % -------------------------------------------------------------------- 5202 function MenuPIV_Callback(hObject, eventdata, handles) 5203 Param=read_param(handles); 5204 Param.ActionName='civ_series'; 5205 series(Param) 5206 5207 %------------------------------------------------------------------------ 5208 % -- open the GUI civ.fig for PIV 5209 function MenuCIVx_Callback(hObject, eventdata, handles) 5210 %------------------------------------------------------------------------ 5211 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles); 5212 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt]; 5213 civ(FileName);% interface de civ(not in the uvmat file) 5214 5215 function Param=read_param(handles) 5216 5242 5217 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles); 5243 5218 Param.FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];%first input file name … … 5282 5257 Param.Coord_x_str=get(handles.Coord_x,'String'); 5283 5258 Param.Coord_x_val=get(handles.Coord_x,'Value'); 5284 %Param.Coord_y_str=get(handles.Coord_y,'String');5285 5259 Param.Coord_y_str=get(handles.Coord_y,'Data'); 5286 %Param.Coord_y_val=get(handles.Coord_y,'Value');5287 series(Param); %run the series interface5288 5289 %------------------------------------------------------------------------5290 % -- open the GUI civ.fig for PIV5291 function MenuCIVx_Callback(hObject, eventdata, handles)5292 %------------------------------------------------------------------------5293 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles);5294 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];5295 civ(FileName);% interface de civ(not in the uvmat file)5296 5297 5298 % --------------------------------------------------------------------5299 function MenuPIV_Callback(hObject, eventdata, handles)5300 MenuSeries_Callback(hObject, eventdata, handles)5301 5302 5260 5303 5261 % -------------------------------------------------------------------- … … 5435 5393 end 5436 5394 end 5437 5438
Note: See TracChangeset
for help on using the changeset viewer.