Changeset 667
- Timestamp:
- Jul 15, 2013, 2:50:08 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 1 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/calc_field_interp.m
r654 r667 88 88 case 'vec' 89 89 if exist('XI','var') 90 if check_interp 90 if check_interp(ilist) 91 91 VarVal{nbvar+1}=F.(UName{ilist})(XI,YI); 92 92 VarVal{nbvar+2}=F.(VName{ilist})(XI,YI); … … 102 102 case 'norm' 103 103 if exist('XI','var') 104 if check_interp 104 if check_interp(ilist) 105 105 U2=F.(UName{ilist})(XI,YI).*F.(UName{ilist})(XI,YI); 106 106 V2=F.(VName{ilist})(XI,YI).*F.(VName{ilist})(XI,YI); … … 115 115 case {'curl','div','strain'} 116 116 if exist('XI','var') 117 if check_interp 117 if check_interp(ilist) 118 118 VarVal{nbvar+1}=F.(UName{ilist})(XI,YI); 119 119 end … … 126 126 if ~isempty(FieldName{ilist}) 127 127 if exist('XI','var') 128 if check_interp 128 if check_interp(ilist) 129 129 VarVal{nbvar+1}=F.(FieldName{ilist})(XI,YI); 130 130 end … … 141 141 %% put an error flag to indicate NaN data 142 142 if exist('XI','var')&&~isempty(VarVal) 143 nbvar=numel( ListVarName);143 nbvar=numel(VarVal); 144 144 ListVarName{nbvar+1}='FF'; 145 145 VarVal{nbvar+1}=isnan(VarVal{nbvar}); -
trunk/src/check_files.m
r660 r667 48 48 'create_grid';...% called by the GUI geometry_calib to create a physical grid 49 49 'create_grid.fig';...% GUI corresponding to create_grid.m 50 'disp l_uvmat';...% display a message using msgbox_uvmat or on the log file in batch mode50 'disp_uvmat';...% display a message using msgbox_uvmat or on the log file in batch mode 51 51 'editxml';...% display and edit xml files using a xls schema 52 52 'editxml.fig';...% interface for editxml -
trunk/src/fill_GUI.m
r664 r667 25 25 UserData=get(GUI_handle,'UserData'); 26 26 fields=fieldnames(Param);%list of fields in Param 27 % loop on the elements of the input structure Param 27 28 %-------------------------------------------------------------------------------------- 29 %----------------- loop on the elements of the input structure Param ------------------ 30 %-------------------------------------------------------------------------------------- 28 31 for ifield=1:numel(fields) 29 % case of a sub-structure --> fill a panel30 32 if isstruct(Param.(fields{ifield}))% case of a sub-structure 33 %% case of a sub-structure --> fill a panel 31 34 if isfield(handles,fields{ifield}) 32 35 set(handles.(fields{ifield}),'Visible','on') 33 errormsg=fill_GUI(Param.(fields{ifield}),handles.(fields{ifield}));% apply the function to the substructure36 errormsg=fill_GUI(Param.(fields{ifield}),handles.(fields{ifield}));% recursively apply the function to the substructure 34 37 elseif isfield(UserData,fields{ifield})&& isfield(handles,fields{ifield})&&isfield(Param.(fields{ifield}),'Name') 35 38 UserData.(fields{ifield})=Param.(fields{ifield}); 36 39 set(handles.(fields{ifield}),'String',Param.(fields{ifield}).Name) 37 40 end 38 % case of an element39 41 else 42 %% case of an element 40 43 hh=[]; 41 44 input_data=Param.(fields{ifield}); 42 45 check_done=0; 43 46 if isfield(handles,fields{ifield}) 47 % a GUI element has a tag name equal to the key name in the element of Param 44 48 hh=handles.(fields{ifield}); 45 49 if strcmp(get(hh,'Type'),'uitable') 50 % case of a table 46 51 set(hh,'Visible','on') 47 52 if ischar(input_data) … … 52 57 end 53 58 elseif isnumeric(input_data) 54 if numel(input_data)>155 %deals with array displayed in multiple boxes labeled by an index59 % for numeric input element, look for a GUI element with the same tag name preceded by 'num_' 60 if numel(input_data)>1 % deals with array displayed in multiple boxes labeled by an index 56 61 for ibox=1:numel(input_data) 57 62 if isfield(handles,['num_' fields{ifield} '_' num2str(ibox)]) … … 66 71 end 67 72 for ibox=1:numel(hh) 73 % finalise the update of GUI uicontrol filled by the input element 68 74 if ~isempty(hh(ibox))&& ~check_done 69 set(hh(ibox),'Visible','on') 70 % input_data 75 set(hh(ibox),'Visible','on')% make the filled GUI element visible 71 76 if isfield(get(hh(ibox)),'Style') 72 77 switch get(hh(ibox),'Style') -
trunk/src/find_field_bounds.m
r654 r667 12 12 13 13 function FieldOut=find_field_bounds(Field) 14 14 15 FieldOut=Field;%default 15 16 %% analyse input field … … 25 26 NbDim=double(Field.NbDim);% deal with plane fields containing z coordinates 26 27 end 28 FieldOut.NbDim=NbDim; 29 if NbDim<=1; return; end% stop here for 1D fields 27 30 28 31 %% get bounds and mesh (needed to propose default options for projection objects) -
trunk/src/find_file_series.m
r635 r667 20 20 % RootPath: path to the directory to be scanned 21 21 % fileinput: name (without path) of the input file sample 22 % checkxml: =1(default) take into account xml file existence to possibly include indexes in RootFile 23 % =0: do not take into account xml file existence 22 24 % 23 25 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA … … 37 39 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 38 40 39 function [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,FileInfo,MovieObject,i1_input,i2_input,j1_input,j2_input]=find_file_series(FilePath,fileinput )41 function [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,FileInfo,MovieObject,i1_input,i2_input,j1_input,j2_input]=find_file_series(FilePath,fileinput,checkxml) 40 42 %------------------------------------------------------------------------ 41 43 … … 62 64 end 63 65 else 64 %% possibly include the first index in the root name, if there exists a corresponding xml file 65 r=regexp(NomType,'^(?<tiretnum>_|\d+)','names');%look for a number or _1 at the beginning of NomType 66 if ~isempty(r) %if NomType begins by a number or _1 67 fileinput_end=regexprep(fileinput,['^' RootFile],'');%remove RootFile at the beginning of fileinput 68 if isempty(regexp(r.tiretnum,'^_','once'))% if a separator '_' is not detected 69 rr=regexp(fileinput_end,'^(?<i1>\d+)','names'); 70 else% if a separator '_' is detected 71 rr=regexp(fileinput_end,'^(?<i1>_\d+)','names'); 72 end 73 if ~isempty(rr) 74 RootFile_i=[RootFile rr.i1];% new root file 75 %look for an xml file correspoonding to the new root name 76 if exist(fullfile(RootPath,SubDir,[RootFile_i '.xml']),'file') || (strcmp(FileExt,'.nc') && exist(fullfile(RootPath,[RootFile_i '.xml']),'file')) 77 RootFile=RootFile_i; 78 NomTypePref=r.tiretnum; 79 NomType=regexprep(NomType,['^' NomTypePref],''); 80 i1_input=j1_input; 81 i2_input=j2_input; 82 j1_input=[]; 83 j2_input=[]; 84 end 66 %% if checkxml=1, possibly include the first index in the root name, if there exists a corresponding xml file 67 if ~exist('checkxml','var')||checkxml 68 r=regexp(NomType,'^(?<tiretnum>_|\d+)','names');%look for a number or _1 at the beginning of NomType 69 if ~isempty(r) %if NomType begins by a number or _1 70 fileinput_end=regexprep(fileinput,['^' RootFile],'');%remove RootFile at the beginning of fileinput 71 if isempty(regexp(r.tiretnum,'^_','once'))% if a separator '_' is not detected 72 rr=regexp(fileinput_end,'^(?<i1>\d+)','names'); 73 else% if a separator '_' is detected 74 rr=regexp(fileinput_end,'^(?<i1>_\d+)','names'); 75 end 76 if ~isempty(rr) 77 RootFile_i=[RootFile rr.i1];% new root file 78 %look for an xml file correspoonding to the new root name 79 if exist(fullfile(RootPath,SubDir,[RootFile_i '.xml']),'file') || (strcmp(FileExt,'.nc') && exist(fullfile(RootPath,[RootFile_i '.xml']),'file')) 80 RootFile=RootFile_i; 81 NomTypePref=r.tiretnum; 82 NomType=regexprep(NomType,['^' NomTypePref],''); 83 i1_input=j1_input; 84 i2_input=j2_input; 85 j1_input=[]; 86 j2_input=[]; 87 end 88 end 85 89 end 86 90 end -
trunk/src/mask_proj.m
r646 r667 70 70 [XMask,YMask]=meshgrid(XMask,YMask); 71 71 Mask = interp2(XMask,YMask,MaskData.A,XArray,YArray','nearest'); 72 figure(1)73 image(MaskData.A)72 % figure(1) 73 % image(MaskData.A) 74 74 Mask=Mask>200; 75 75 if ~isfield(FieldData,'FF') -
trunk/src/read_field.m
r654 r667 74 74 ListVar=[ListVar InputField(ilist)]; 75 75 if check_colorvar(ilist) 76 77 ProjModeRequest{numel(ListVar)}='';76 Role{numel(ListVar)}='ancillary';% not projected with interpolation 77 ProjModeRequest{numel(ListVar)}=''; 78 78 else 79 Role{numel(ListVar)}='scalar';80 ProjModeRequest{numel(ListVar)}='interp_lin';%scalar field (requires interpolation for plot)79 Role{numel(ListVar)}='scalar'; 80 ProjModeRequest{numel(ListVar)}='interp_lin';%scalar field (requires interpolation for plot) 81 81 end 82 82 else % an operator 'vec' or 'norm' is used … … 84 84 Role{numel(ListVar)}='vector_y'; 85 85 Role{numel(ListVar)-1}='vector_x'; 86 87 88 89 90 91 92 86 if ~check_colorvar(ilist) && strcmp(r.Operator,'norm') 87 ProjModeRequest{numel(ListVar)-1}='interp_lin';%scalar field (requires interpolation for plot) 88 ProjModeRequest{numel(ListVar)}='interp_lin'; 89 else 90 ProjModeRequest{numel(ListVar)-1}=''; 91 ProjModeRequest{numel(ListVar)}=''; 92 end 93 93 end 94 94 end … … 96 96 [Field,var_detect,ichoice]=nc2struct(FileName,'TimeDimName',ParamIn.TimeDimName,num,[ParamIn.Coord_x (ParamIn.Coord_y) ListVar]); 97 97 else 98 [Field,var_detect,ichoice]=nc2struct(FileName,[ParamIn.Coord_x (ParamIn.Coord_y) ListVar]);98 [Field,var_detect,ichoice]=nc2struct(FileName,[ParamIn.Coord_x (ParamIn.Coord_y) ListVar]); 99 99 end 100 100 if isfield(Field,'Txt') … … 108 108 end 109 109 Field.VarAttribute{ivar+2}.ProjModeRequest=ProjModeRequest{ivar}; 110 end 110 end 111 111 case 'video' 112 112 if strcmp(class(ParamIn),'VideoReader') -
trunk/src/series.m
r664 r667 75 75 RescaleFactor=min((ScreenSize(3)-80)/Width,(ScreenSize(4)-80)/Height); 76 76 if RescaleFactor>1 77 %RescaleFactor=RescaleFactor/2+1/2; %reduce the rescale factor to provide an increased margin for a big screen78 77 RescaleFactor=min(RescaleFactor,1); 79 78 end … … 89 88 set(handles.MinIndex_i,'ColumnEditable',false) 90 89 set(handles.MinIndex_i,'ColumnName',{'i min'}) 90 set(handles.MinIndex_i,'Data',[])% initiate Data to double (not cell) 91 91 92 92 % settings of table MinIndex_j … … 94 94 set(handles.MinIndex_j,'ColumnEditable',false) 95 95 set(handles.MinIndex_j,'ColumnName',{'j min'}) 96 set(handles.MinIndex_j,'Data',[])% initiate Data to double (not cell) 96 97 97 98 % settings of table MaxIndex_i … … 99 100 set(handles.MaxIndex_i,'ColumnEditable',false) 100 101 set(handles.MaxIndex_i,'ColumnName',{'i max'}) 102 set(handles.MaxIndex_i,'Data',[])% initiate Data to double (not cell) 101 103 102 104 % settings of table MaxIndex_j … … 104 106 set(handles.MaxIndex_j,'ColumnEditable',false) 105 107 set(handles.MaxIndex_j,'ColumnName',{'j max'}) 108 set(handles.MaxIndex_j,'Data',[])% initiate Data to double (not cell) 106 109 107 110 % settings of table PairString 108 111 set(handles.PairString,'ColumnName',{'pairs'}) 112 set(handles.PairString,'ColumnEditable',false) 113 set(handles.PairString,'ColumnFormat',{'char'}) 114 set(handles.PairString,'Data',{''}) 115 116 % settings of table MaskTable 117 set(handles.MaskTable,'ColumnName',{'mask name'}) 109 118 set(handles.PairString,'ColumnEditable',false) 110 119 set(handles.PairString,'ColumnFormat',{'char'}) … … 154 163 for ifile=1:min(length(h.MenuFile),5) 155 164 set(handles.(['MenuFile_' num2str(ifile)]),'Label',h.MenuFile{ifile}); 165 set(handles.(['MenuFile_' num2str(ifile+5)]),'Label',h.MenuFile{ifile}); 156 166 end 157 167 end … … 306 316 fileinput=uigetfile_uvmat('pick a file to append in the input table',oldfile); 307 317 if ~isempty(fileinput) 308 if get(handles.CheckAppend,'Value') 318 % if get(handles.CheckAppend,'Value') 319 % display_file_name(handles,fileinput,'append') 320 % else 321 display_file_name(handles,fileinput,'one') 322 % end 323 end 324 325 % -------------------------------------------------------------------- 326 function MenuBrowseAppend_Callback(hObject, eventdata, handles) 327 328 %% look for the previously opened file 'oldfile' 329 InputTable=get(handles.InputTable,'Data'); 330 RootPathCell=InputTable(:,1); 331 if isempty(RootPathCell{1})% no input file in the table 332 MenuBrowse_Callback(hObject, eventdata, handles)%refresh the input table, not append 333 return 334 end 335 SubDirCell=InputTable(:,2); 336 % oldfile=''; %default 337 % if ~(isempty(RootPathCell) || isequal(RootPathCell,{''}))%loads the previously stored file name and set it as default in the file_input box 338 oldfile=fullfile(RootPathCell{1},SubDirCell{1}); 339 % end 340 341 %% use a file name stored in prefdir 342 dir_perso=prefdir; 343 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 344 if exist(profil_perso,'file') 345 h=load (profil_perso); 346 if isfield(h,'RootPath') && ischar(h.RootPath) 347 oldfile=h.RootPath; 348 end 349 end 350 351 %% launch the browser 352 fileinput=uigetfile_uvmat('pick a file to append in the input table',oldfile); 353 if ~isempty(fileinput) 309 354 display_file_name(handles,fileinput,'append') 310 else311 display_file_name(handles,fileinput,'one')312 end313 355 end 314 356 … … 318 360 function MenuFile_Callback(hObject, eventdata, handles) 319 361 320 fileinput=get(hObject,'Label'); 321 if get(handles.CheckAppend,'Value') 322 display_file_name(handles,fileinput,'append') 362 display_file_name(handles,get(hObject,'Label'),'one') 363 364 %------------------------------------------------------------------------ 365 % --- fct activated by selecting a previous file under the menu Open/append 366 %------------------------------------------------------------------------ 367 function MenuFile_append_Callback(hObject, eventdata, handles) 368 369 InputTable=get(handles.InputTable,'Data'); 370 if isempty(InputTable{1,1})% no input file in the table 371 display_file_name(handles,get(hObject,'Label'),'one') %refresh the input table, not append 323 372 else 324 display_file_name(handles, fileinput,'one')373 display_file_name(handles,get(hObject,'Label'),'append')% append the selected file to the current list of InputTable 325 374 end 326 375 … … 424 473 %------------------------------------------------------------------------ 425 474 set(handles.REFRESH,'Visible','on') 426 set(handles.REFRESH_title,'Visible','on')475 % set(handles.REFRESH_title,'Visible','on') 427 476 iview=eventdata.Indices(1); 428 477 view_set=get(handles.REFRESH,'UserData'); … … 489 538 % iview: line index in the input table 490 539 % or 'one': refresh the list 491 % 'checkappend': add a new line to the list540 % 'append': add a new line to the input table 492 541 493 542 %% get the input root name, indices, file extension and nomenclature NomType … … 581 630 ref_j=floor((j1+j2)/2);% reference image number corresponding to the file 582 631 set(handles.num_ref_j,'String',num2str(ref_j)); 583 % set(handles.num_ref_j,'UserData',[j1 j2]);%store the indices for future opening584 632 585 633 %% update the list of recent files in the menubar and save it for future opening … … 629 677 ref_i=squeeze(max(i1_series(1,:,:),[],2));% select ref_j index for each ref_i 630 678 ref_j=squeeze(max(j1_series(1,:,:),[],3));% select ref_i index for each ref_j 631 % [ref_j,ref_i]=find(squeeze(i1_series(1,:,:)));632 % [ref_j,ref_i]=find(squeeze(i1_series(1,:,:)))633 679 MinIndex_i=min(find(ref_i))-1; 634 680 MaxIndex_i=max(find(ref_i))-1; 635 % MinIndex_j=min(ref_j)-1;636 681 MaxIndex_j=max(find(ref_j))-1; 637 % MinIndex_j=min(find(j1_series_j))-1;638 % MaxIndex_j=max(find(j1_series_j))-1;639 % MaxIndex_i=max(i1_series_i)-1;640 % MinIndex_j=min(i1_series_j)-1;641 % MaxIndex_j=max(i1_series_j)-1;642 % MaxIndex_i=max(ref_i)-1;643 682 MinIndex_j=min(find(ref_j))-1; 644 % MaxIndex_j=max(ref_j)-1;645 683 diff_j_max=diff(ref_j); 646 684 diff_i_max=diff(ref_i); … … 668 706 MinIndex_j=0; 669 707 end 670 MinIndex_i_ cell=get(handles.MinIndex_i,'Data');%retrieve the min indices in the table MinIndex671 MinIndex_j_ cell=get(handles.MinIndex_j,'Data');%retrieve the min indices in the table MinIndex672 MaxIndex_i_ cell=get(handles.MaxIndex_i,'Data');%retrieve the min indices in the table MinIndex673 MaxIndex_j_ cell=get(handles.MaxIndex_j,'Data');%retrieve the min indices in the table MinIndex674 MinIndex_i_ cell(iview,1)=MinIndex_i;675 MinIndex_j_ cell(iview,1)=MinIndex_j;676 MaxIndex_i_ cell(iview,1)=MaxIndex_i;677 MaxIndex_j_ cell(iview,1)=MaxIndex_j;678 set(handles.MinIndex_i,'Data',MinIndex_i_ cell)%display the min indices in the table MinIndex679 set(handles.MinIndex_j,'Data',MinIndex_j_ cell)%display the max indices in the table MaxIndex680 set(handles.MaxIndex_i,'Data',MaxIndex_i_ cell)%display the min indices in the table MinIndex681 set(handles.MaxIndex_j,'Data',MaxIndex_j_ cell)%display the max indices in the table MaxIndex708 MinIndex_i_table=get(handles.MinIndex_i,'Data');%retrieve the min indices in the table MinIndex 709 MinIndex_j_table=get(handles.MinIndex_j,'Data');%retrieve the min indices in the table MinIndex 710 MaxIndex_i_table=get(handles.MaxIndex_i,'Data');%retrieve the min indices in the table MinIndex 711 MaxIndex_j_table=get(handles.MaxIndex_j,'Data');%retrieve the min indices in the table MinIndex 712 MinIndex_i_table(iview,1)=MinIndex_i; 713 MinIndex_j_table(iview,1)=MinIndex_j; 714 MaxIndex_i_table(iview,1)=MaxIndex_i; 715 MaxIndex_j_table(iview,1)=MaxIndex_j; 716 set(handles.MinIndex_i,'Data',MinIndex_i_table)%display the min indices in the table MinIndex 717 set(handles.MinIndex_j,'Data',MinIndex_j_table)%display the max indices in the table MaxIndex 718 set(handles.MaxIndex_i,'Data',MaxIndex_i_table)%display the min indices in the table MinIndex 719 set(handles.MaxIndex_j,'Data',MaxIndex_j_table)%display the max indices in the table MaxIndex 682 720 683 721 %% adjust the first and last indices for the selected series, only if requested by the bounds … … 787 825 %% read timing and total frame number from the current file (movie files) if not already set by the xml file (prioritary) 788 826 InputTable=get(handles.InputTable,'Data'); 789 % FileBase=fullfile(InputTable{iview,1},InputTable{iview,3});790 827 791 828 % case of movies 792 % if strcmp(InputTable{iview,4},'*')793 829 if isempty(Time) 794 830 if ~isempty(VideoObject) … … 801 837 end 802 838 TimeSource='video'; 803 % set(han:dles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec804 % ColorType='truecolor';805 % elseif ~isempty(imformats(regexprep(InputTable{iview,5},'^.',''))) || isequal(InputTable{iview,5},'.vol')%&& isequal(NomType,'*')% multi-frame image806 % if ~isempty(InputTable{iview,2})807 % imainfo=imfinfo(fullfile(InputTable{iview,1},InputTable{iview,2},[InputTable{iview,3} InputTable{iview,5}]));808 % else809 % imainfo=imfinfo([FileBase InputTable{iview,5}]);810 % end811 % % ColorType=imainfo.ColorType;%='truecolor' for color images812 % % if length(imainfo) >1 %case of image with multiple frames813 % % nbfield=length(imainfo);814 % % nbfield_j=1;815 % % end816 839 end 817 840 end … … 820 843 if ~isempty(Time) 821 844 TimeTable=get(handles.TimeTable,'Data'); 822 % first_i=str2num(get(handles.num_first_i,'String'));823 % last_i=str2num(get(handles.num_last_i,'String'));824 % first_j=str2num(get(handles.num_first_j,'String'));825 % last_j=str2num(get(handles.num_last_j,'String'));826 % MinIndex_i=get(handles.MinIndex_i,'Data');827 % MinIndex_j=get(handles.MinIndex_j,'Data');828 % MaxIndex_i=get(handles.MaxIndex_i,'Data');829 % MaxIndex_j=get(handles.MaxIndex_j,'Data');830 845 TimeTable{iview,1}=Time(MinIndex_i+1,MinIndex_j+1); 831 846 if size(Time)>=[first_i+1 first_j+1] … … 840 855 set(handles.TimeTable,'Data',TimeTable) 841 856 end 842 843 857 844 858 %% update the series info in 'UserData' … … 1986 2000 %% Detect the types of input files 1987 2001 SeriesData=get(handles.series,'UserData'); 1988 nb_civ=0;nb_netcdf=0;2002 iview_civ=[];nb_netcdf=0; 1989 2003 if ~isempty(SeriesData) 1990 nb_civ=numel(find(strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType)));2004 iview_civ=find(strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType)); 1991 2005 nb_netcdf=numel(find(strcmp('netcdf',SeriesData.FileType))); 1992 2006 end 1993 if nb_civ>=1 1994 menu=set_veltype_display(SeriesData.FileInfo{1}.CivStage,SeriesData.FileType{1}); 2007 %menu={''}; 2008 if numel(iview_civ)>=1 2009 menu=set_veltype_display(SeriesData.FileInfo{iview_civ(1)}.CivStage,SeriesData.FileType{iview_civ(1)}); 1995 2010 set(handles.VelType,'String',[{'*'};menu]) 1996 if n b_civ>=21997 menu=set_veltype_display(SeriesData.FileInfo{ 2}.CivStage,SeriesData.FileType{2});2011 if numel(iview_civ)>=2 2012 menu=set_veltype_display(SeriesData.FileInfo{iview_civ(2)}.CivStage,SeriesData.FileType{iview_civ(2)}); 1998 2013 set(handles.VelType_1,'String',[{'*'};menu]) 1999 2014 end 2000 end 2001 2002 2015 end 2003 2016 2004 2017 %% Check whether alphabetical sorting of input Subdir is alowed by the Action fct (for multiples series entries) … … 2065 2078 if isfield(ParamOut,'VelType') 2066 2079 if strcmp( ParamOut.VelType,'one')||strcmp( ParamOut.VelType,'two') 2067 if n b_civ>=12080 if numel(iview_civ)>=1 2068 2081 VelTypeVisible='on'; 2069 2082 InputFieldsVisible='on'; … … 2071 2084 end 2072 2085 if strcmp( ParamOut.VelType,'two') 2073 if n b_civ>=22086 if numel(iview_civ)>=2 2074 2087 VelType_1Visible='on'; 2075 2088 end … … 2086 2099 if isfield(ParamOut,'FieldName') 2087 2100 if strcmp( ParamOut.FieldName,'one')||strcmp( ParamOut.FieldName,'two') 2088 if (n b_civ+nb_netcdf)>=12101 if (numel(iview_civ)+nb_netcdf)>=1 2089 2102 InputFieldsVisible='on'; 2090 2103 FieldNameVisible='on'; … … 2092 2105 end 2093 2106 if strcmp( ParamOut.FieldName,'two') 2094 if (n b_civ+nb_netcdf)>=12107 if (numel(iview_civ)+nb_netcdf)>=1 2095 2108 FieldName_1Visible='on'; 2096 2109 end … … 2360 2373 defaultname={''}; 2361 2374 end 2362 [FileName, PathName] = uigetfile( ... 2363 {'*.xml;*.mat', ' (*.xml,*.mat)'; 2364 '*.xml', '.xml files '; ... 2365 '*.mat', '.mat matlab files '}, ... 2366 'Pick an xml object file (or use uvmat to create it)',defaultname); 2367 fileinput=[PathName FileName];%complete file name 2368 sizf=size(fileinput); 2369 if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end 2375 fileinput=uigetfile_uvmat('pick a xml object file (or use uvmat to create it)',defaultname,'.xml'); 2376 % [FileName, PathName] = uigetfile( ... 2377 % {'*.xml;*.mat', ' (*.xml,*.mat)'; 2378 % '*.xml', '.xml files '; ... 2379 % '*.mat', '.mat matlab files '}, ... 2380 % 'Pick an xml object file (or use uvmat to create it)',defaultname); 2381 % fileinput=[PathName FileName];%complete file name 2382 % sizf=size(fileinput); 2383 if isempty(fileinput),return;end 2370 2384 %read the file 2371 2385 data=xml2struct(fileinput); … … 2404 2418 function ViewObject_Callback(hObject, eventdata, handles) 2405 2419 2406 if get(handles.ViewObject,'Value')2407 set(handles.EditObject,'Value',0)2420 % if get(handles.ViewObject,'Value') 2421 % set(handles.EditObject,'Value',0) 2408 2422 UserData=get(handles.series,'UserData'); 2423 hset_object=findobj(allchild(0),'Tag','set_object'); 2424 if ~isempty(hset_object) 2425 delete(hset_object)% refresh set_object if already opened 2426 end 2409 2427 hset_object=set_object(UserData.ProjObject); 2410 2428 set(hset_object,'Name','view_object_series') 2411 else2412 hset_object=findobj(allchild(0),'Tag','set_object');2413 if ~isempty(hset_object)2414 delete(hset_object)2415 end2416 end2429 % else 2430 % hset_object=findobj(allchild(0),'Tag','set_object'); 2431 % if ~isempty(hset_object) 2432 % delete(hset_object) 2433 % end 2434 % end 2417 2435 2418 2436 %------------------------------------------------------------------------ … … 2428 2446 set(get(hset_object,'Children'),'Enable','on') 2429 2447 else 2430 hset_object=findobj(allchild(0),'Tag','set_object'); 2448 hset_object=findobj(allchild(0),'Tag','set_object'); 2431 2449 if ~isempty(hset_object) 2432 delete(hset_object)2450 set(get(hset_object,'Children'),'Enable','off') 2433 2451 end 2434 2452 end … … 2439 2457 function DeleteObject_Callback(hObject, eventdata, handles) 2440 2458 2441 if get(handles.DeleteObject,'Value')2459 % if get(handles.DeleteObject,'Value') 2442 2460 SeriesData=get(handles.series,'UserData'); 2443 2461 SeriesData.ProjObject=[]; … … 2445 2463 set(handles.ProjObject,'String','') 2446 2464 set(handles.CheckObject,'Value',0) 2465 set(handles.ViewObject,'Visible','off') 2466 set(handles.EditObject,'Visible','off') 2467 hset_object=findobj(allchild(0),'Tag','set_object'); 2468 if ~isempty(hset_object) 2469 delete(hset_object) 2470 end 2447 2471 set(handles.DeleteObject,'Visible','off') 2448 set(handles.ViewObject,'Visible','off') 2449 set(handles.DeleteObject,'Value',0) 2450 end 2451 2452 %-------------------------------------------------------------- 2472 % set(handles.DeleteObject,'Value',0) 2473 % end 2474 2475 %------------------------------------------------------------------------ 2476 % --- Executed when CheckMask is activated 2477 %------------------------------------------------------------------------ 2453 2478 function CheckMask_Callback(hObject, eventdata, handles) 2479 2454 2480 if get(handles.CheckMask,'Value') 2481 MaskData=get(handles.MaskTable,'Data'); 2455 2482 InputTable=get(handles.InputTable,'Data'); 2456 for iview=1:size(InputTable,1) 2483 nbview=size(InputTable,1); 2484 % MaskTable=cell(nbview,1); 2485 for iview=1:nbview 2457 2486 RootPath=InputTable{iview,1}; 2458 SubDir=InputTable{iview,2}; 2459 MaskSubDir=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.' 2460 MaskName=fullfile(RootPath,[MaskSubDir '.mask'],'mask_1.png'); 2461 if ~exist(MaskName,'file') 2462 msgbox_uvmat('WARNING',['mask file ' MaskName ' not found']) 2463 return 2464 end 2465 end 2466 end 2467 %-------------------------------------------------------------- 2487 if ~isempty(RootPath) 2488 if isempty(MaskData{iview}) 2489 SubDir=InputTable{iview,2}; 2490 MaskSubDir=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.' 2491 MaskName=fullfile(RootPath,[MaskSubDir '.mask'],'mask_1.png'); 2492 if ~exist(MaskName,'file') 2493 MaskName=uigetfile_uvmat('select a mask file:',RootPath,'image'); 2494 end 2495 MaskTable{iview,1}=MaskName ; 2496 ListMask{iview,1}=num2str(iview); 2497 end 2498 end 2499 end 2500 nbview=size(MaskTable,1); 2501 set(handles.MaskTable,'Data',MaskTable) 2502 % set(handles.MaskTable,'ColumnFormat',{MaskTable'}) 2503 set(handles.MaskTable,'Visible','on') 2504 set(handles.MaskBrowse,'Visible','on') 2505 set(handles.ListMask,'Visible','on') 2506 set(handles.ListMask,'String',ListMask) 2507 set(handles.ListMask,'Value',numel(ListMask)) 2508 else 2509 set(handles.MaskTable,'Visible','off') 2510 set(handles.MaskBrowse,'Visible','off') 2511 set(handles.ListMask,'Visible','off') 2512 end 2513 2514 %------------------------------------------------------------------------ 2515 % --- Executes on button press in MaskBrowse. 2516 %------------------------------------------------------------------------ 2517 function MaskBrowse_Callback(hObject, eventdata, handles) 2518 InputTable=get(handles.InputTable,'Data'); 2519 iview=get(handles.ListMask,'Value'); 2520 % MaskTable=cell(nbview,1); 2521 2522 RootPath=InputTable{iview,1}; 2523 % if ~isempty(RootPath) 2524 % SubDir=InputTable{iview,2}; 2525 % MaskSubDir=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.' 2526 % MaskName=fullfile(RootPath,[MaskSubDir '.mask'],'mask_1.png'); 2527 % if ~exist(MaskName,'file') 2528 MaskName=uigetfile_uvmat('select a mask file:',RootPath,'image'); 2529 % end 2530 if ~isempty(MaskName) 2531 MaskTable=get(handles.MaskTable,'Data'); 2532 MaskTable{iview,1}=MaskName ; 2533 % end 2534 set(handles.MaskTable,'Data',MaskTable) 2535 end 2536 % set(handles.MaskTable,'ColumnFormat',{MaskTable'}) 2537 2538 %------------------------------------------------------------------------ 2539 % --- Executes when selected cell(s) is changed in MaskTable. 2540 %------------------------------------------------------------------------ 2541 function MaskTable_CellSelectionCallback(hObject, eventdata, handles) 2542 2543 if numel(eventdata.Indices)>=1 2544 set(handles.ListMask,'Value',eventdata.Indices(1)) 2545 end 2468 2546 2469 2547 %------------------------------------------------------------------- 2470 %'uv_ncbrowser': interactively calls the netcdf file browser 'get_field.m'2471 function ncbrowser_uvmat(hObject, eventdata)2472 %-------------------------------------------------------------------2473 bla=get(gcbo,'String');2474 ind=get(gcbo,'Value');2475 filename=cell2mat(bla(ind));2476 blank=find(filename==' ');2477 filename=filename(1:blank-1);2478 get_field(filename)2479 2480 % ------------------------------------------------------------------2481 2548 function MenuHelp_Callback(hObject, eventdata, handles) 2482 2549 %------------------------------------------------------------------- … … 2624 2691 set(handles.PairString,'Unit','normalized') 2625 2692 set(handles.PairString,'ColumnWidth',{Pos(3)-5}) 2693 2694 %% MaskTable 2695 set(handles.MaskTable,'Unit','pixel') 2696 Pos=get(handles.MaskTable,'Position'); 2697 set(handles.MaskTable,'Unit','normalized') 2698 set(handles.MaskTable,'ColumnWidth',{Pos(3)-5}) 2626 2699 2627 2700 %------------------------------------------------------------------------ -
trunk/src/set_object.m
r657 r667 211 211 if ~isempty(hseries) 212 212 hhseries=guidata(hseries); 213 set(hhseries. ViewObject,'Value',0)213 set(hhseries.EditObject,'Value',0) 214 214 end 215 215 … … 618 618 function SAVE_Callback(hObject, eventdata, handles) 619 619 % ------------------------------------------------------ 620 %Object=read_set_object(handles);621 620 Object=read_GUI(handles.set_object); 622 621 huvmat=findobj('Tag','uvmat'); 623 % UvData=get(huvmat,'UserData');624 622 if isempty(huvmat) 625 623 huvmat=findobj(allchild(0),'Name','series'); … … 636 634 end 637 635 title={'object name'}; 638 dir_save=uigetdir(RootPath); 639 ObjectName=get(handles.Name,'String'); 640 if ~isempty(ObjectName)&&~strcmp(ObjectName,'') 641 def={fullfile(dir_save,[ObjectName '.xml'])}; 642 else 643 def={fullfile(dir_save,[Object.Style '.xml'])}; 644 end 645 displ_txt='save object as an .xml file';%default display 646 menu=get(handles.ProjMode,'String'); 647 value=get(handles.ProjMode,'Value'); 648 ProjMode=menu{value}; 649 if strcmp(ProjMode,'mask_inside')||strcmp(ProjMode,'mask_outside') 650 displ_txt='save mask contour as an .xml file: to create a mask image, use save_mask on the GUI uvmat (lower right)'; 651 end 652 answer=msgbox_uvmat('INPUT_TXT','save object as an .xml file',def); 653 if ~isempty(answer) 654 t=struct2xml(Object); 655 t=set(t,1,'name','ProjObject'); 656 save(t,answer{1}) 657 end 658 msgbox_uvmat('CONFIRMATION',[answer{1} ' saved']) 636 dir_save=uigetfile_uvmat('select the folder for the new xml object file:',RootPath,'uigetdir'); 637 if ~isempty(dir_save) 638 % dir_save=uigetdir(RootPath); 639 ObjectName=get(handles.Name,'String'); 640 if ~isempty(ObjectName)&&~strcmp(ObjectName,'') 641 def={fullfile(dir_save,[ObjectName '.xml'])}; 642 else 643 def={fullfile(dir_save,[Object.Style '.xml'])}; 644 end 645 displ_txt='save object as an .xml file';%default display 646 menu=get(handles.ProjMode,'String'); 647 value=get(handles.ProjMode,'Value'); 648 ProjMode=menu{value}; 649 if strcmp(ProjMode,'mask_inside')||strcmp(ProjMode,'mask_outside') 650 displ_txt='save mask contour as an .xml file: to create a mask image, use save_mask on the GUI uvmat (lower right)'; 651 end 652 answer=msgbox_uvmat('INPUT_TXT','save object as an .xml file',def); 653 if ~isempty(answer) 654 t=struct2xml(Object); 655 t=set(t,1,'name','ProjObject'); 656 save(t,answer{1}) 657 end 658 msgbox_uvmat('CONFIRMATION',[answer{1} ' saved']) 659 end 659 660 660 661 %------------------------------------------------------------------------ -
trunk/src/uvmat.m
r660 r667 985 985 end 986 986 end 987 if ( isfield(XmlData,'Time')&& ~isempty(XmlData.Time))987 if (strcmp(FileType,'civdata')||strcmp(FileType,'civx')) && ((isfield(XmlData,'Time')&& ~isempty(XmlData.Time))) 988 988 if index==1 989 989 set(handles.TimeName,'String','xml') … … 1182 1182 %------------------------------------------------------------------------ 1183 1183 % --- switch file index scanning options scan_i and scan_j in an exclusive way 1184 %------------------------------------------------------------------------ 1184 1185 function scan_i_Callback(hObject, eventdata, handles) 1185 %------------------------------------------------------------------------ 1186 1186 1187 if get(handles.scan_i,'Value')==1 1187 % set(handles.scan_i,'BackgroundColor',[1 1 0])1188 1188 set(handles.scan_j,'Value',0) 1189 1189 else 1190 % set(handles.scan_i,'BackgroundColor',[0.831 0.816 0.784])1191 1190 set(handles.scan_j,'Value',1) 1192 1191 end … … 1195 1194 %------------------------------------------------------------------------ 1196 1195 % --- switch file index scanning options scan_i and scan_j in an exclusive way 1196 %------------------------------------------------------------------------ 1197 1197 function scan_j_Callback(hObject, eventdata, handles) 1198 %------------------------------------------------------------------------ 1198 1199 1199 if get(handles.scan_j,'Value')==1 1200 % set(handles.scan_j,'BackgroundColor',[1 1 0])1201 1200 set(handles.scan_i,'Value',0) 1202 % set(handles.scan_i,'BackgroundColor',[0.831 0.816 0.784])1203 % NomType=get(handles.NomType,'String');1204 % switch NomType1205 % case {'_1_1-2','#_ab','%3dab'},% pair with j index1206 % set(handles.CheckFixPair,'Visible','on')% option fixed pair on/off made visible (choice of avaible pair with buttons + and - if ='off')1207 % otherwise1208 % set(handles.CheckFixPair,'Visible','off')1209 % end1210 1201 else 1211 % set(handles.scan_j,'BackgroundColor',[0.831 0.816 0.784])1212 1202 set(handles.scan_i,'Value',1) 1213 % set(handles.scan_i,'BackgroundColor',[1 1 0])1214 1203 set(handles.CheckFixPair,'Visible','off') 1215 1204 end … … 1345 1334 ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray 1346 1335 check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files 1347 ListFiles=ListCells(1,:);%list of file names1348 ListFiles=ListFiles(~check_dir); 1336 ListFiles=ListCells(1,:);%list of file and dri names 1337 ListFiles=ListFiles(~check_dir);%list of file names (excluding dir) 1349 1338 if ~isempty(ListFiles) 1350 1339 [tild,tild,MaskExt]=fileparts(ListFiles{1}); 1351 [tild,tild,MaskFile,i1_series,i2_series,j1_series,j2_series,MaskNomType,MaskFileType]=find_file_series(MaskPath,ListFiles{1} );1340 [tild,tild,MaskFile,i1_series,i2_series,j1_series,j2_series,MaskNomType,MaskFileType]=find_file_series(MaskPath,ListFiles{1},0); 1352 1341 if strcmp(MaskFileType,'image') && isempty(i2_series) && isempty(j2_series) 1353 1342 mdetect=1; … … 1356 1345 end 1357 1346 if mdetect==0 1358 MaskFullName=uigetfile_uvmat('pick a mask image file:', fullfile(RootPath,SubDir),'image');1347 MaskFullName=uigetfile_uvmat('pick a mask image file:',RootPath,'image'); 1359 1348 if isempty(MaskFullName) 1360 1349 set(handles.CheckMask,'Value',0) 1361 1350 end 1362 1351 [MaskPath,MaskName,MaskExt]=fileparts(MaskFullName); 1363 [tild,tild,MaskFile,i1_series,i2_series,j1_series,j2_series,MaskNomType]=find_file_series(MaskPath,[MaskName MaskExt] );1352 [tild,tild,MaskFile,i1_series,i2_series,j1_series,j2_series,MaskNomType]=find_file_series(MaskPath,[MaskName MaskExt],0); 1364 1353 if ~(isempty(i2_series) && isempty(j2_series)) 1365 1354 MaskNomType='*'; … … 2149 2138 set(handles.num_Npy,'String',num2str(ParamOut.Npy)); 2150 2139 end 2151 %2152 % if isfield(ParamOut,'TimeIndex')% case of time obtained from get_field2153 % set(handles.i1,'String',num2str(ParamOut.TimeIndex))2154 % end2155 % if isfield(ParamOut,'TimeValue')2156 % Field{1}.Time=ParamOut.TimeValue;% case of time obtained from get_field2157 % end2158 2140 Field{1}.ZIndex=z_index; %used for multiplane 3D calibration 2159 2160 2141 2161 2142 %% choose and read a second field FileName_1 if defined … … 2275 2256 set(handles.VelType,'Visible','off') 2276 2257 end 2277 % display the FieldName menu from the input file and pick the selected one:2278 % if isstruct(ParamOut)2279 % field_index=strcmp(ParamOut.FieldName,ParamOut.FieldList);2280 % set(handles.FieldName,'String',ParamOut.FieldList); %update the field menu2281 % set(handles.FieldName,'Value',find(field_index,1))2282 % end2283 2258 2284 2259 %% update the display menu for the second velocity type (second menuline) … … 2302 2277 % update the second field menu: the same quantity 2303 2278 if isstruct(ParamOut_1) 2304 % set(handles.FieldName_1,'String',[{''};ParamOut_1.FieldList]); %update the field menu2305 2279 % display the FieldName menu from the input file and pick the selected one: 2306 2280 FieldList=get(handles.FieldName_1,'String'); … … 2316 2290 set(handles.FixVelType,'Visible','off') 2317 2291 end 2318 2319 % field_index=strcmp(ParamOut_1.FieldName,ParamOut_1.FieldList);2320 % set(handles.FieldName,'String',ParamOut.FieldList); %update the field menu2321 % set(handles.FieldName,'Value',find(field_index,1))2322 2292 2323 2293 %% introduce w as background image by default for a new series (only for nbdim=2) … … 2387 2357 end 2388 2358 end 2389 % if isfield(Field{1},'Time') 2390 % abstime=Field{1}.Time;%time read from the netcdf input file 2391 % end 2392 % if numel(Field)==2 && isfield(Field{2},'Time') 2393 % abstime_1=Field{2}.Time;%time read from the netcdf input file 2394 % end 2395 2396 % look for timing in the input file if not defined in a xml file or movie 2359 2360 %% look for timing in the input file if not defined in a xml file or movie 2397 2361 if isempty(abstime) 2398 2362 TimeName=get(handles.TimeName,'String'); … … 2411 2375 end 2412 2376 end 2413 end 2414 % if ~isequal(numel(abstime),1) 2415 % abstime=[]; 2416 % end 2417 % if ~isequal(numel(abstime_1),1) 2418 % abstime_1=[]; 2419 % end 2377 end 2420 2378 set(handles.TimeValue,'String',num2str(abstime)) 2421 2379 abstime_1=[]; … … 2434 2392 end 2435 2393 end 2436 2437 2394 2438 2395 %% store the current open names, fieldname and vel types in uvmat interface … … 2480 2437 UvData.Field=tps_coeff_field(UvData.Field,check_proj_tps); 2481 2438 2482 %% analyse input field 2483 % [CellInfo,NbDimArray,errormsg]=find_field_cells(UvData.Field);% analyse the input field structure 2484 % if ~isempty(errormsg) 2485 % errormsg=['uvmat /refresh_field / find_field_cells / ' errormsg];% display error 2486 % return 2487 % end 2488 % 2489 % NbDim=max(NbDimArray);% spatial dimension of the input field 2490 % imax=find(NbDimArray==NbDim);% indices of field cells to consider 2491 % if isfield(UvData.Field,'NbDim') 2492 % NbDim=double(UvData.Field.NbDim);% deal with plane fields containing z coordinates 2493 % end 2494 % 2495 % %% get bounds and mesh (needed to propose default options for projection objects) 2496 % if NbDim>1 2497 % CoordMax=zeros(numel(imax),NbDim); 2498 % CoordMin=zeros(numel(imax),NbDim); 2499 % Mesh=zeros(1,numel(imax)); 2500 % for ind=1:numel(imax) 2501 % if strcmp(CellInfo{imax(ind)}.CoordType,'tps') 2502 % CoordName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex};% X,Y coordinates in a single variable 2503 % CoordMax(ind,NbDim)=max(max(UvData.Field.(CoordName)(1:end-3,1,:),[],1),[],3);% max of x component (2D case) 2504 % CoordMax(ind,NbDim-1)=max(max(UvData.Field.(CoordName)(1:end-3,2,:),[],1),[],3);% max of y component (2D case) 2505 % CoordMin(ind,NbDim)=min(min(UvData.Field.(CoordName)(1:end-3,1,:),[],1),[],3); 2506 % CoordMin(ind,NbDim-1)=min(min(UvData.Field.(CoordName)(1:end-3,2,:),[],1),[],3);% min of y component (2D case) 2507 % else 2508 % XName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(end)}; 2509 % YName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(end-1)}; 2510 % CoordMax(ind,NbDim)=max(max(UvData.Field.(XName))); 2511 % CoordMin(ind,NbDim)=min(min(UvData.Field.(XName))); 2512 % CoordMax(ind,NbDim-1)=max(max(UvData.Field.(YName))); 2513 % CoordMin(ind,NbDim-1)=min(min(UvData.Field.(YName))); 2514 % % test_x=1;%test for unstructured coordinates 2515 % if NbDim==3 2516 % ZName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(1)}; 2517 % CoordMax(imax(ind),1)=max(max(UvData.Field.(ZName))); 2518 % CoordMin(ind,1)=min(min(UvData.Field.(ZName))); 2519 % end 2520 % end 2521 % switch CellInfo{imax(ind)}.CoordType 2522 % 2523 % case {'scattered','tps'} %unstructured coordinates 2524 % NbPoints=CellInfo{imax(ind)}.CoordSize;% total nbre of points 2525 % Mesh(ind)=(prod(CoordMax(ind,:)-CoordMin(ind,:))/NbPoints)^(1/NbDim); %(volume or area per point)^(1/NbDim) 2526 % case 'grid'%structured coordinate 2527 % NbPoints=CellInfo{imax(ind)}.CoordSize;% nbre of points in each direction 2528 % Mesh(ind)=min((CoordMax(ind,:)-CoordMin(ind,:))./(NbPoints-1)); 2529 % end 2530 % end 2531 % UvData.Field.CoordMesh=min(Mesh); 2532 % UvData.Field.XMax=max(CoordMax(:,end)); 2533 % UvData.Field.XMin=min(CoordMin(:,end)); 2534 % UvData.Field.YMax=max(CoordMax(:,end-1)); 2535 % UvData.Field.YMin=min(CoordMin(:,end-1)); 2536 % if NbDim==3 2537 % UvData.Field.ZMax=max(CoordMax(ind,1)); 2538 % UvData.Field.ZMin=max(CoordMin(ind,1)); 2539 % end 2540 % % adjust the mesh to a value 1, 2 , 5 *10^n 2541 % ord=10^(floor(log10(UvData.Field.CoordMesh)));%order of magnitude 2542 % if UvData.Field.CoordMesh/ord>=5 2543 % UvData.Field.CoordMesh=5*ord; 2544 % elseif UvData.Field.CoordMesh/ord>=2 2545 % UvData.Field.CoordMesh=2*ord; 2546 % else 2547 % UvData.Field.CoordMesh=ord; 2548 % end 2549 if ~isfield(UvData.Field,'NbDim') 2550 UvData.Field.NbDim=1; 2551 end 2439 %% get bounds and dimensions of the input field 2440 UvData.Field=find_field_bounds(UvData.Field); 2441 2552 2442 if UvData.Field.NbDim>1 2553 UvData.Field=find_field_bounds(UvData.Field);2554 2443 % default projection plane 2555 2444 if isempty(UvData.ProjObject{1}) … … 4836 4725 %------------------------------------------------------------------------ 4837 4726 %get the object file 4838 [FileName, PathName, filterindex] = uigetfile( ... 4839 {'*.xml;*.mat', ' (*.xml,*.mat)'; 4840 '*.xml', '.xml files '; ... 4841 '*.mat', '.mat matlab files '}, ... 4842 'Pick an xml Object file',get(handles.RootPath,'String')); 4843 fileinput=[PathName FileName];%complete file name 4844 sizf=size(fileinput); 4845 if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end 4846 4847 %read the file 4848 [data,heading]=xml2struct(fileinput); 4849 if ~strcmp(heading,'ProjObject') 4850 msgbox_uvmat('WARNING','The xml file does not have the heading ProjObject for projection objects') 4851 end 4852 [tild,data.Name]=fileparts(FileName);% object name set as file name 4853 ListObject=get(handles.ListObject,'String'); 4854 if ~strcmp(ListObject{end},'') 4855 ListObject=[ListObject;{''}]; %append a blank to the list (if not already done) to indicate the creation of a new object 4856 set(handles.ListObject,'String',ListObject) 4857 end 4858 IndexObj=length(ListObject); 4859 4860 UvData=get(handles.uvmat,'UserData'); 4861 UvData.ProjObject{IndexObj}=[]; %create a new empty object 4862 UvData.ProjObject{IndexObj}.DisplayHandle.uvmat=[]; %no plot handle before plot_field operation 4863 UvData.ProjObject{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation 4864 set(handles.uvmat,'UserData',UvData) 4865 set(handles.ListObject,'Value',IndexObj) 4866 hset_object=set_object(data);% call the set_object interface 4867 set(get(hset_object,'children'),'enable','on')% enable edit action on elements on GUI set_object 4868 set(handles.CheckEditObject,'Value',0); %suppress the object edit mode 4869 CheckEditObject_Callback([],[],handles) 4870 % set(handles.CheckEditObject,'BackgroundColor',[0.7,0.7,0.7]) 4871 set(handles.DeleteObject,'Visible','on') 4872 4727 fileinput=uigetfile_uvmat('pick an xml object file:',get(handles.RootPath,'String'),'.xml'); 4728 4729 if ~isempty(fileinput) 4730 %read the file 4731 [data,heading]=xml2struct(fileinput); 4732 if ~strcmp(heading,'ProjObject') 4733 msgbox_uvmat('WARNING','The xml file does not have the heading ProjObject for projection objects') 4734 end 4735 % [tild,data.Name]=fileparts(fileinput);% object name set as file name 4736 ListObject=get(handles.ListObject,'String'); 4737 4738 % if ~strcmp(ListObject{end},'') 4739 % ListObject=[ListObject;{''}]; %append a blank to the list (if not already done) to indicate the creation of a new object 4740 % set(handles.ListObject,'String',ListObject) 4741 % end 4742 ListObject=[ListObject;{data.Name}]; 4743 IndexObj=length(ListObject); 4744 UvData=get(handles.uvmat,'UserData'); 4745 UvData.ProjObject{IndexObj}=[]; %create a new empty object 4746 UvData.ProjObject{IndexObj}.DisplayHandle.uvmat=[]; %no plot handle before plot_field operation 4747 UvData.ProjObject{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation 4748 set(handles.uvmat,'UserData',UvData) 4749 % set(handles.ListObject,'String',ListObject) 4750 % set(handles.ListObject,'Value',IndexObj) 4751 set(handles.CheckViewObject,'Value',1) 4752 set(handles.CheckViewField,'Value',1) 4753 hset_object=set_object(data);% call the set_object interface 4754 hhset_object=guidata(hset_object); 4755 set_object('PLOT_Callback',hObject,eventdata,hhset_object);% plot projection 4756 %set(get(hset_object,'children'),'enable','on')% enable edit action on elements on GUI set_object 4757 set(handles.CheckEditObject,'Value',0); %suppress the object edit mode 4758 CheckEditObject_Callback([],[],handles) 4759 set(handles.DeleteObject,'Visible','on') 4760 end 4873 4761 4874 4762 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracChangeset
for help on using the changeset viewer.