Changeset 515 for trunk/src/uvmat.m
- Timestamp:
- Aug 15, 2012, 11:36:12 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r512 r515 70 70 % (calc_tps.m) calculate tps coefficients (for filter projection or spatial derivatives). 71 71 % | 72 % (calc_field.m) calculate field73 % |74 72 % UvData.Field-------------->histogram 75 73 % _____________|____________ 76 74 % | | 77 % proj_field.m proj_field.m project the field on the projection objects 75 % proj_field.m proj_field.m project the field on the projection objects (use calc_field.m) 78 76 % | | 79 77 % UvData.PlotAxes ViewData.PlotAxes (on view_field) 80 78 % | | 81 79 % plot_field.m (uvmat) plot_field.m (view_field) plot the projected fields 82 %83 % rmq: calc_field can be performed instead at the level of proj_field when needed84 80 % 85 81 % … … 209 205 210 206 %% TRANSFORM menu: builtin fcts 211 transform_menu={'';' phys';'px';'phys_polar'};207 transform_menu={'';'sub_field';'phys';'phys_polar'}; 212 208 UvData.OpenParam.NbBuiltin=numel(transform_menu); %number of functions 213 209 path_list=(num2cell(blanks(UvData.OpenParam.NbBuiltin)))';%initialize a cell array of nbvar blanks … … 299 295 300 296 %% plot input field if exists 301 if testinputfield302 %delete drawn objects303 hother=findobj(handles.PlotAxes,'Tag','proj_object');%find all the proj objects304 for iobj=1:length(hother)305 delete_object(hother(iobj))306 end307 if isempty(inputfile)308 errormsg=refresh_field(handles,[],[],[],[],[],[],{Field});309 set(handles.MenuTools,'Enable','on')310 set(handles.OBJECT_txt,'Visible','on')311 set(handles.edit_object,'Visible','on')312 % set(handles.ListObject_1,'Visible','on')313 set(handles.frame_object,'Visible','on')314 if ~isempty(errormsg)315 msgbox_uvmat('ERROR',errormsg)316 end317 end318 end297 % if testinputfield 298 % %delete drawn objects 299 % hother=findobj(handles.PlotAxes,'Tag','proj_object');%find all the proj objects 300 % for iobj=1:length(hother) 301 % delete_object(hother(iobj)) 302 % end 303 % if isempty(inputfile) 304 % errormsg=refresh_field(handles,[],[],[],[],[],[],{Field}); 305 % set(handles.MenuTools,'Enable','on') 306 % set(handles.OBJECT_txt,'Visible','on') 307 % set(handles.edit_object,'Visible','on') 308 % % set(handles.ListObject_1,'Visible','on') 309 % set(handles.frame_object,'Visible','on') 310 % if ~isempty(errormsg) 311 % msgbox_uvmat('ERROR',errormsg) 312 % end 313 % end 314 % end 319 315 320 316 set_vec_col_bar(handles) %update the display of color code for vectors … … 679 675 set(handles.j1,'String',num2stra(j1,NomType)); 680 676 set(handles.j2,'String',num2stra(j2,NomType)); 681 else %read the current field index if the second file series is opened 682 i1=str2num(get(handles.i1,'String')); 683 i2=str2num(get(handles.i2,'String')); 684 j1=stra2num(get(handles.j1,'String')); 685 j2=stra2num(get(handles.j2,'String')); 677 else %read the current field index to synchronise with the first series 678 i1_s=str2num(get(handles.i1,'String')); 679 i2_0=str2num(get(handles.i2,'String')); 680 if ~isempty(i2_0) 681 i2_s=i2_0; 682 else 683 i2_s=i2; 684 end 685 j1_0=stra2num(get(handles.j1,'String')); 686 if ~isempty(j1_0) 687 j1_s=j1_0; 688 else 689 j1_s=j1; 690 end 691 j2_0=stra2num(get(handles.j2,'String')); 692 if ~isempty(j2_0) 693 j2_s=j2_0; 694 else 695 j2_s=j2; 696 end 686 697 end 687 698 … … 705 716 end 706 717 %updtate the indices of the second field series to correspond to the newly opened one 707 FileName_1=fullfile_uvmat(Input.RootPath_1,Input.SubDir_1,Input.RootFile_1,Input.FileExt_1,Input.NomType_1,i1 ,i2,j1,j2);718 FileName_1=fullfile_uvmat(Input.RootPath_1,Input.SubDir_1,Input.RootFile_1,Input.FileExt_1,Input.NomType_1,i1_s,i2_s,j1_s,j2_s); 708 719 if exist(FileName_1,'file') 720 FileIndex_1=fullfile_uvmat('','','','',Input.NomType_1,i1_s,i2_s,j1_s,j2_s); 721 else 709 722 FileIndex_1=fullfile_uvmat('','','','',Input.NomType_1,i1,i2,j1,j2); 710 set(handles.FileIndex_1,'String',FileIndex_1)711 else712 723 msgbox_uvmat('WARNING','unable to synchronise the indices of the two series') 713 724 end 725 set(handles.FileIndex_1,'String',FileIndex_1) 714 726 end 715 727 … … 757 769 % --- Update information about a new field series (indices to scan, timing, 758 770 % calibration from an xml file, then refresh current plots 771 759 772 function update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,VideoObject,index) 760 773 %------------------------------------------------------------------------ … … 943 956 end 944 957 if ~get(handles.CheckFixLimits,'Value') 945 set(handles.transform_fct,'Value', 2); % phys transform by default if fixedLimits is off958 set(handles.transform_fct,'Value',3); % phys transform by default if fixedLimits is off 946 959 end 947 960 if isfield(GeometryCalib,'SliceCoord') … … 1014 1027 end 1015 1028 end 1016 [ref_j,ref_i]=find( i1_series);1029 [ref_j,ref_i]=find(squeeze(i1_series(1,:,:))); 1017 1030 if ~isempty(j1_series) 1018 1031 state_j='on'; 1019 1032 if index==1 1020 if isequal(ref_i,ref_i(1)*ones(size(ref_j)))% if ref_i is always equal to its first v zlue1033 if isequal(ref_i,ref_i(1)*ones(size(ref_j)))% if ref_i is always equal to its first value 1021 1034 scan_option='j'; %scan j indext 1022 1035 end … … 1057 1070 1058 1071 %% apply the effect of the transform fct and view the field 1072 transform=get(handles.path_transform,'UserData'); 1073 if index==2 && (~isa(transform,'function_handle')||nargin(transform)<3) 1074 set(handles.transform_fct,'value',2); % set transform to sub_field if the current fct doe not accept two input fields 1075 end 1059 1076 transform_fct_Callback([],[],handles) 1060 %run0_Callback([],[], handles); %view field1061 1077 mask_test=get(handles.CheckMask,'value'); 1062 1078 if mask_test … … 1106 1122 function i1_Callback(hObject, eventdata, handles) 1107 1123 %------------------------------------------------------------------------ 1108 set(handles.i1,'BackgroundColor',[0.7 0.7 0.7]) 1124 update_ij(handles,1) 1125 1126 %------------------------------------------------------------------------ 1127 function i2_Callback(hObject, eventdata, handles) 1128 %------------------------------------------------------------------------ 1129 update_ij(handles,2) 1130 1131 %------------------------------------------------------------------------ 1132 function j1_Callback(hObject, eventdata, handles) 1133 %------------------------------------------------------------------------ 1134 update_ij(handles,3) 1135 1136 %------------------------------------------------------------------------ 1137 function j2_Callback(hObject, eventdata, handles) 1138 %------------------------------------------------------------------------ 1139 update_ij(handles,4) 1140 1141 %------------------------------------------------------------------------ 1142 %--- update the index display after action on edit boxes i1, i2, j1 or j2 1143 function update_ij(handles,index_rank) 1109 1144 NomType=get(handles.NomType,'String'); 1110 i1=stra2num(get(handles.i1,'String')); 1111 i2=stra2num(get(handles.i2,'String')); 1112 j1=stra2num(get(handles.j1,'String')); 1113 j2=stra2num(get(handles.j2,'String')); 1114 indices=fullfile_uvmat('','','','',NomType,i1,i2,j1,j2); 1115 %indices=name_generator('',num1,num_a,'',NomType,1,num2,num_b,''); 1145 indices=get(handles.FileIndex,'String'); 1146 [tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(indices);% the indices for the second series taken from FileIndex 1147 switch index_rank 1148 case 1 1149 indices=fullfile_uvmat('','','','',NomType,stra2num(get(handles.i1,'String')),i2,j1,j2); 1150 set(handles.i1,'BackgroundColor',[0.7 0.7 0.7])% mark the edit box in grey, then RUN0 will mark it in white for confirmation 1151 case 2 1152 indices=fullfile_uvmat('','','','',NomType,i1,stra2num(get(handles.i2,'String')),j1,j2); 1153 set(handles.i2,'BackgroundColor',[0.7 0.7 0.7])% mark the edit box in grey, then RUN0 will mark it in white for confirmation 1154 case 3 1155 indices=fullfile_uvmat('','','','',NomType,i1,i2,stra2num(get(handles.j1,'String')),j2); 1156 set(handles.j1,'BackgroundColor',[0.7 0.7 0.7])% mark the edit box in grey, then RUN0 will mark it in white for confirmation 1157 case 4 1158 indices=fullfile_uvmat('','','','',NomType,i1,i2,j1,stra2num(get(handles.j2,'String'))); 1159 set(handles.j2,'BackgroundColor',[0.7 0.7 0.7])% mark the edit box in grey, then RUN0 will mark it in white for confirmation 1160 end 1116 1161 set(handles.FileIndex,'String',indices) 1117 set(handles.FileIndex,'BackgroundColor',[0.7 0.7 0.7]) 1118 if get(handles.SubField,'Value')==1 1162 set(handles.FileIndex,'BackgroundColor',[0.7 0.7 0.7])% mark the edit box in grey, then RUN0 will mark it in white for confirmation 1163 % update the second index if relevant 1164 if strcmp(get(handles.FileIndex_1,'Visible'),'on') 1119 1165 NomType_1=get(handles.NomType_1,'String'); 1120 indices=fullfile_uvmat('','','','',NomType,i1,i2,j1,j2); 1121 %indices=name_generator('',num1,num_a,'',NomType_1,1,num2,num_b,''); 1122 set(handles.FileIndex_1,'String',indices) 1123 set(handles.FileIndex_1,'BackgroundColor',[0.7 0.7 0.7]) 1124 end 1125 1126 %------------------------------------------------------------------------ 1127 function i2_Callback(hObject, eventdata, handles) 1128 %------------------------------------------------------------------------ 1129 set(handles.i2,'BackgroundColor',[0.7 0.7 0.7]) 1130 i1_Callback(hObject, eventdata, handles) 1131 1132 %------------------------------------------------------------------------ 1133 function j1_Callback(hObject, eventdata, handles) 1134 %------------------------------------------------------------------------ 1135 set(handles.j1,'BackgroundColor',[0.7 0.7 0.7]) 1136 i1_Callback(hObject, eventdata, handles) 1137 1138 %------------------------------------------------------------------------ 1139 function j2_Callback(hObject, eventdata, handles) 1140 %------------------------------------------------------------------------ 1141 set(handles.j2,'BackgroundColor',[0.7 0.7 0.7]) 1142 i1_Callback(hObject, eventdata, handles) 1166 indices_1=get(handles.FileIndex_1,'String'); 1167 [tild,tild,tild,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(indices_1);% the indices for the second series taken from FileIndex_1 1168 switch index_rank 1169 case 1 1170 indices_1=fullfile_uvmat('','','','',NomType_1,stra2num(get(handles.i1,'String')),i2_1,j1_1,j2_1); 1171 case 2 1172 indices_1=fullfile_uvmat('','','','',NomType_1,i1_1,stra2num(get(handles.i2,'String')),j1_1,j2_1); 1173 case 3 1174 indices_1=fullfile_uvmat('','','','',NomType_1,i1_1,i2_1,stra2num(get(handles.j1,'String')),j2_1); 1175 case 4 1176 indices_1=fullfile_uvmat('','','','',NomType_1,i1_1,i2_1,j1_1,stra2num(get(handles.j2,'String'))); 1177 end 1178 set(handles.FileIndex_1,'String',indices_1) 1179 set(handles.FileIndex_1,'BackgroundColor',[0.7 0.7 0.7])% mark the edit box in grey, then RUN0 will mark it in white for confirmation 1180 end 1181 1182 %------------------------------------------------------------------------ 1143 1183 1144 1184 %------------------------------------------------------------------------ … … 1523 1563 if sub_value % a second input file has been entered 1524 1564 [InputFile.RootPath_1,InputFile.SubDir_1,InputFile.RootFile_1,InputFile.FileIndex_1,InputFile.FileExt_1,InputFile.NomType_1]=read_file_boxes_1(handles); 1525 [tild,tild,tild,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(InputFile.FileIndex_1); 1565 [tild,tild,tild,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(InputFile.FileIndex_1);% the indices for the second series taken from FileIndex_1 1526 1566 else 1527 1567 filename_1=[]; … … 1529 1569 1530 1570 %% increment (or decrement) the field indices and update the input filename(s) 1531 CheckSearch=0;1532 1571 if isempty(increment) 1533 CheckSearch=1;% search for the next available file1534 1572 set(handles.CheckFixPair,'Value',0) 1535 1573 end … … 1545 1583 i2_1=i2_1+increment; 1546 1584 end 1585 1547 1586 else % case of scanning along index j (burst numbers) 1548 1587 j1=j1+increment; … … 1604 1643 if ~isempty(errormsg),return,end 1605 1644 siz=size(UvData.i1_series{1}); 1606 ref_indices=ref_i*siz(1)*siz(2)+ref_j*siz(1)+1:ref_i*siz(1)*siz(2)+(ref_j+1)*siz(1); 1645 ref_indices=ref_i*siz(1)*siz(2)+ref_j*siz(1)+1:ref_i*siz(1)*siz(2)+(ref_j+1)*siz(1); 1607 1646 i1_subseries=UvData.i1_series{1}(ref_indices); 1608 1647 ref_indices=ref_indices(i1_subseries>0); 1609 1648 if isempty(ref_indices)% case of pairs (free index i) 1610 ref_indices=ref_i*siz(1)*siz(2)+1:(ref_i+1)*siz(1)*siz(2); 1649 ref_indices=ref_i*siz(1)*siz(2)+1:(ref_i+1)*siz(1)*siz(2); 1611 1650 i1_subseries=UvData.i1_series{1}(ref_indices); 1612 1651 ref_indices=ref_indices(i1_subseries>0); … … 1623 1662 if ~isempty(UvData.j2_series{1}) 1624 1663 j2=UvData.j2_series{1}(ref_indices(end)); 1625 end 1626 % case of a second file series (TODO:revise) 1627 if numel(UvData.i1_series)>=2 1628 i1_subseries=UvData.i1_series{2}(ref_i+1,ref_j+1,:); 1629 i1_subseries=i1_subseries(i1_subseries>0); 1630 i1_1=i1_subseries(end); 1664 end 1665 1666 % case of a second file series 1667 if sub_value 1668 ref_i_1=i1_1; 1669 if ~isempty(i2_1) 1670 ref_i_1=floor((i1_1+i2_1)/2);% current reference index i 1671 end 1672 ref_j_1=1; 1673 if ~isempty(j1_1) 1674 ref_j_1=j1_1; 1675 if ~isempty(j2_1) 1676 ref_j_1=floor((j1_1+j2_1)/2);% current reference index j 1677 end 1678 end 1679 if ~isempty(increment) 1680 if get(handles.scan_i,'Value')==1% case of scanning along index i 1681 ref_i_1=ref_i_1+increment;% increment the current reference index i 1682 else % case of scanning along index j (burst numbers) 1683 ref_j_1=ref_j_1+increment;% increment the current reference index j if scan_j option is used 1684 end 1685 else % free increment, synchronise the ref indices with the first series 1686 ref_i_1=ref_i; 1687 ref_j_1=ref_j; 1688 end 1689 if numel(UvData.i1_series)==1 1690 UvData.i1_series{2}=UvData.i1_series{1}; 1691 UvData.j1_series{2}=UvData.j1_series{1}; 1692 UvData.i2_series{2}=UvData.i2_series{1}; 1693 UvData.j2_series{2}=UvData.j2_series{1}; 1694 end 1695 if ref_i_1<0 1696 errormsg='minimum i index reached'; 1697 elseif ref_j_1<0 1698 errormsg='minimum j index reached'; 1699 elseif ref_i_1+1>size(UvData.i1_series{2},3) 1700 errormsg='maximum i index reached for the second series (reload the input file to update the index bound)'; 1701 elseif ref_j_1+1>size(UvData.i1_series{2},2) 1702 errormsg='maximum j index reached for the second series(reload the input file to update the index bound)'; 1703 end 1704 if ~isempty(errormsg),return,end 1705 siz=size(UvData.i1_series{2}); 1706 ref_indices=ref_i_1*siz(1)*siz(2)+ref_j_1*siz(1)+1:ref_i_1*siz(1)*siz(2)+(ref_j_1+1)*siz(1); 1707 i1_subseries=UvData.i1_series{2}(ref_indices); 1708 ref_indices=ref_indices(i1_subseries>0); 1709 if isempty(ref_indices)% case of pairs (free index i) 1710 ref_indices=ref_i_1*siz(1)*siz(2)+1:(ref_i_1+1)*siz(1)*siz(2); 1711 i1_subseries=UvData.i1_series{2}(ref_indices); 1712 ref_indices=ref_indices(i1_subseries>0); 1713 end 1714 i1_1=UvData.i1_series{2}(ref_indices(end)); 1631 1715 if ~isempty(UvData.i2_series{2}) 1632 i2_subseries=UvData.i2_series{2}(ref_i+1,ref_j+1,:); 1633 i2_subseries=i2_subseries(i2_subseries>0); 1634 i2_1=i2_subseries(end); 1716 i2_1=UvData.i2_series{2}(ref_indices(end)); 1635 1717 end 1636 1718 if ~isempty(UvData.j1_series{2}) 1637 j1_subseries=UvData.j1_series{2}(ref_i+1,ref_j+1,:); 1638 j1_subseries=j1_subseries(j1_subseries>0); 1639 j1_1=j1_subseries(end); 1719 j1_1=UvData.j1_series{2}(ref_indices(end)); 1640 1720 end 1641 1721 if ~isempty(UvData.j2_series{2}) 1642 j2_subseries=UvData.j2_series{2}(ref_i+1,ref_j+1,:); 1643 j2_subseries=j2_subseries(j2_subseries>0); 1644 j2_1=j2_subseries(end); 1645 end 1722 j2_1=UvData.j2_series{1}(ref_indices(end)); 1723 end 1724 else% the second series (if needed) is the same file as the first 1725 i1_1=i1; 1726 i2_1=i2; 1727 j1_1=j1; 1728 j2_1=j2; 1646 1729 end 1647 1730 end … … 1652 1735 1653 1736 %% refresh plots 1654 errormsg=refresh_field(handles,filename,filename_1,i1,i2,j1,j2 );1737 errormsg=refresh_field(handles,filename,filename_1,i1,i2,j1,j2,i1_1,i2_1,j1_1,j2_1); 1655 1738 1656 1739 %% update the index counters if the index move is successfull … … 1846 1929 set(handles.run0,'BackgroundColor',[1 1 0])%paint the command button in yellow 1847 1930 drawnow 1848 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 1849 filename=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 1850 filename_1=[];%default 1931 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles); 1932 filename=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt]; 1933 filename_1='';%default 1934 FileIndex_1=''; 1851 1935 if get(handles.SubField,'Value') 1852 [RootPath_1,SubDir_1,RootFile_1,FileInd ices_1,FileExt_1]=read_file_boxes_1(handles);1853 filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileInd ices_1 FileExt_1];1936 [RootPath_1,SubDir_1,RootFile_1,FileIndex_1,FileExt_1]=read_file_boxes_1(handles); 1937 filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1]; 1854 1938 end 1855 1939 num_i1=stra2num(get(handles.i1,'String')); … … 1857 1941 num_j1=stra2num(get(handles.j1,'String')); 1858 1942 num_j2=stra2num(get(handles.j2,'String')); 1859 1860 errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2); 1943 [tild,tild,tild,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(FileIndex_1); 1944 1945 errormsg=refresh_field(handles,filename,filename_1,num_i1,num_i2,num_j1,num_j2,i1_1,i2_1,j1_1,j2_1); 1861 1946 1862 1947 if ~isempty(errormsg) … … 1883 1968 % Field: structure describing an optional input field (then replace the input file) 1884 1969 1885 function errormsg=refresh_field(handles,FileName,FileName_1,num_i1,num_i2,num_j1,num_j2, Field)1970 function errormsg=refresh_field(handles,FileName,FileName_1,num_i1,num_i2,num_j1,num_j2,i1_1,i2_1,j1_1,j2_1) 1886 1971 %------------------------------------------------------------------------ 1887 1972 … … 1923 2008 if length(masknumber)>=z_index 1924 2009 set(handles.masklevel,'Value',z_index) 2010 end 2011 2012 %% test for need of tps 2013 check_proj_tps=0; 2014 if (strcmp(UvData.FileType{1},'civdata')||strcmp(UvData.FileType{1},'civx')) 2015 for iobj=1:numel(UvData.Object) 2016 if isfield(UvData.Object{iobj},'ProjMode')&& strcmp(UvData.Object{iobj}.ProjMode,'filter') 2017 check_proj_tps=1; 2018 break 2019 end 2020 end 1925 2021 end 1926 2022 … … 1977 2073 ParamIn.VelType=VelType; 1978 2074 ParamIn.GUIName='get_field'; 2075 end 2076 check_tps=0; 2077 if strcmp(UvData.FileType{1},'civdata')&&~strcmp(ParamIn.FieldName,'velocity')&&~strcmp(ParamIn.FieldName,'get_field...') 2078 check_tps=1;%tps needed to get the requested field 1979 2079 end 1980 2080 [Field{1},ParamOut,errormsg] = read_field(FileName,UvData.FileType{1},ParamIn,frame_index); … … 2030 2130 ParamIn_1=UvData.MovieObject{2}; 2031 2131 if ~strcmp(NomType_1,'*') 2032 frame_index_1= num_j1;%frame index for movies or multimage2132 frame_index_1=j1_1;%frame index for movies or multimage 2033 2133 else 2034 frame_index_1= num_i1;2134 frame_index_1=i1_1; 2035 2135 end 2036 2136 case 'multimage' 2037 2137 if ~strcmp(NomType_1,'*') 2038 frame_index_1= num_j1;%frame index for movies or multimage2138 frame_index_1=j1_1;%frame index for movies or multimage 2039 2139 else 2040 frame_index_1= num_i1;2140 frame_index_1=i1_1; 2041 2141 end 2042 2142 case 'vol' %TODO: update … … 2055 2155 end 2056 2156 test_keepdata_1=0;% test for keeping the previous stored data if the input files are unchanged 2057 if ~isequal(NomType_1,'*')%in case of a series of files (not avi movie) 2058 if isfield(UvData,'FileName_1')%&& isfield(UvData,'VelType_1') && isfield(UvData,'FieldName_1') 2059 test_keepdata_1= strcmp(FileName_1,UvData.FileName_1) ;%&& strcmp(FieldName_1,UvData.FieldName_1); 2060 end 2157 if ~isequal(NomType_1,'*')&& isfield(UvData,'FileName_1') 2158 test_keepdata_1= strcmp(FileName_1,UvData.FileName_1) ;%&& strcmp(FieldName_1,UvData.FieldName_1); 2061 2159 end 2062 2160 if test_keepdata_1 … … 2068 2166 ParamIn_1.VelType=VelType_1; 2069 2167 ParamIn_1.GUIName='get_field_1'; 2070 end 2168 end 2071 2169 [Field{2},ParamOut_1,errormsg] = read_field(Name,UvData.FileType{2},ParamIn_1,frame_index_1); 2072 2170 if ~isempty(errormsg) 2073 2171 errormsg=['error in reading ' FieldName_1 ' in ' FileName_1 ': ' errormsg]; 2074 2172 return 2173 end 2174 if isstruct(ParamOut_1)&&~strcmp(ParamOut_1.FieldName,'get_field...')&& (strcmp(UvData.FileType{2},'civdata')||strcmp(UvData.FileType{2},'civx'))... 2175 &&~strcmp(ParamOut_1.FieldName,'velocity') && ~strcmp(ParamOut_1.FieldName,'get_field...') 2176 if ~check_proj_tps 2177 % Field{2}=calc_field([{ParamOut_1.FieldName} {ParamOut_1.ColorVar}],Field{2}); 2178 end 2075 2179 end 2076 2180 end … … 2130 2234 test_veltype_1=1; 2131 2235 set(handles.VelType_1,'Visible','on') 2132 menu=set_veltype_display(ParamOut_1.CivStage );2236 menu=set_veltype_display(ParamOut_1.CivStage,UvData.FileType{2}); 2133 2237 index_menu=strcmp(ParamOut_1.VelType,menu); 2134 2238 set(handles.VelType_1,'Value',1+find(index_menu,1)) … … 2219 2323 end 2220 2324 if numel(UvData.XmlData)==2 2221 [tild,tild,tild,num_i1,num_i2,num_j1,num_j2]=fileparts_uvmat(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]); 2222 if isempty(num_i2) 2223 num_i2=num_i1; 2224 end 2225 if isempty(num_j1) 2226 num_j1=1; 2227 end 2228 if isempty(num_j2) 2229 num_j2=num_j1; 2325 if isempty(i2_1) 2326 i2_1=num_i1; 2327 end 2328 if isempty(j1_1) 2329 j1_1=1; 2330 end 2331 if isempty(j2_1) 2332 j2_1=j1_1; 2230 2333 end 2231 2334 siz=size(UvData.XmlData{2}.Time); 2232 if ~isempty( num_i1) && siz(1)>=max(num_i1,num_i2) && siz(2)>=max(num_j1,num_j2)2233 abstime_1=(UvData.XmlData{2}.Time( num_i1,num_j1)+UvData.XmlData{2}.Time(num_i2,num_j2))/2;%overset the time read from files2234 Field{2}.Dt=(UvData.XmlData{2}.Time( num_i2,num_j2)-UvData.XmlData{2}.Time(num_i1,num_j1));2335 if ~isempty(i1_1) && siz(1)>=max(i1_1,i2_1) && siz(2)>=max(j1_1,j2_1) 2336 abstime_1=(UvData.XmlData{2}.Time(i1_1,j1_1)+UvData.XmlData{2}.Time(i2_1,j2_1))/2;%overset the time read from files 2337 Field{2}.Dt=(UvData.XmlData{2}.Time(i2_1,j2_1)-UvData.XmlData{2}.Time(i1_1,j1_1)); 2235 2338 end 2236 2339 end … … 2264 2367 %% apply coordinate transform or other user fct 2265 2368 transform=get(handles.path_transform,'UserData'); 2266 if ~isempty(transform) 2369 if isempty(transform) 2370 UvData.Field=Field{1}; 2371 else 2267 2372 XmlData=[];%default 2268 2373 XmlData_1=[];%default … … 2294 2399 end 2295 2400 2296 %% check whether tps is needed, then calculate tps coefficients if needed 2297 check_proj_tps=0; 2298 if (strcmp(UvData.FileType{1},'civdata')||strcmp(UvData.FileType{1},'civx')) 2299 for iobj=1:numel(UvData.Object) 2300 if isfield(UvData.Object{iobj},'ProjMode')&& strcmp(UvData.Object{iobj}.ProjMode,'filter') 2301 check_proj_tps=1; 2302 break 2303 end 2304 end 2305 end 2306 check_tps=0; 2307 if strcmp(UvData.FileType{1},'civdata')&&~strcmp(ParamOut.FieldName,'velocity')&&~strcmp(ParamOut.FieldName,'get_field...') 2308 check_tps=1;%tps needed to get the requested field 2309 end 2310 if (check_tps ||check_proj_tps)&&~isfield(UvData.Field,'Coord_tps') 2311 UvData.Field=calc_tps(UvData.Field); 2312 end 2313 UvData.Field.FieldList=[{ParamOut.FieldName} {ParamOut.ColorVar}]; 2314 2315 %% calculate scalar 2316 if isstruct(ParamOut)&&~strcmp(ParamOut.FieldName,'get_field...')&& (strcmp(UvData.FileType{1},'civdata')||strcmp(UvData.FileType{1},'civx'))... 2317 &&~strcmp(ParamOut.FieldName,'velocity') && ~strcmp(ParamOut.FieldName,'get_field...') 2318 if ~check_proj_tps 2319 UvData.Field=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],UvData.Field); 2320 end 2321 end 2322 if isstruct(ParamOut_1)&& numel(Field)==2 && ~strcmp(ParamOut_1.FieldName,'get_field...')&& ~test_keepdata_1 && (strcmp(UvData.FileType{2},'civdata')||strcmp(UvData.FileType{2},'civx'))... 2323 &&~strcmp(ParamOut_1.FieldName,'velocity') && ~strcmp(ParamOut_1.FieldName,'get_field...') 2324 if check_proj_tps 2325 Field{2}.FieldList=[{ParamOut_1.FieldName} {ParamOut_1.ColorVar}]; 2326 else 2327 Field{2}=calc_field([{ParamOut_1.FieldName} {ParamOut_1.ColorVar}],Field{2}); 2328 end 2329 end 2330 2401 %% calculate tps coefficients if needed 2402 UvData.Field=calc_tps(UvData.Field,check_proj_tps); 2331 2403 2332 2404 %% analyse input field … … 2942 3014 end 2943 3015 set(handles.uvmat,'UserData',UvData); 2944 run0_Callback(hObject, eventdata, handles); %run 3016 transform_fct_list=get(handles.transform_fct,'String'); 3017 transform_fct=transform_fct_list(get(handles.transform_fct,'Value')); 3018 if strcmp(transform_fct,'sub_field') 3019 set(handles.transform_fct,'Value',1)%suppress the sub_field transform 3020 transform_fct_Callback(hObject, eventdata, handles); 3021 else 3022 run0_Callback(hObject, eventdata, handles) 3023 end 2945 3024 else 2946 3025 MenuBrowse_1_Callback(hObject, eventdata, handles) … … 3114 3193 FileName_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1]; 3115 3194 [tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(get(handles.FileIndex,'String')); 3116 % set(handles.FileIndex_1,'Visible','on')3117 % set(handles.FileExt_1,'Visible','on')3118 3195 switch field_1 3119 3196 case 'get_field...' … … 3128 3205 set(hhget_field.list_fig,'Value',1) 3129 3206 set(hhget_field.list_fig,'String',{'uvmat'}) 3130 % set(handles.transform_fct,'Value',1)% no transform by default3131 % set(handles.path_transform,'String','')3132 3207 if check_new 3133 3208 UvData.FileType{2}=UvData.FileType{1}; 3134 3209 set(handles.FileIndex_1,'String',get(handles.FileIndex,'String')) 3135 % set(handles.FileExt_1,'String',get(handles.FileExt,'String'))3136 3210 set(handles.uvmat,'UserData',UvData) 3137 3211 end … … 3239 3313 3240 3314 %------------------------------------------------------------------------ 3241 % --- Executes on button pressin VelType_1.3315 % --- Executes on choice selection in VelType_1. 3242 3316 function VelType_1_Callback(hObject, eventdata, handles) 3243 3317 %------------------------------------------------------------------------ 3244 3318 set(handles.FixVelType,'Value',1)% the velocity type is now imposed by the GUI (not automatic) 3245 3319 UvData=get(handles.uvmat,'UserData'); 3246 %refresh field with a second FileName=first file name 3247 set(handles.run0,'BackgroundColor',[1 1 0])%paint the command button in yellow 3320 set(handles.run0,'BackgroundColor',[1 1 0])%paint run0 button in yellow to indicate its activation 3248 3321 drawnow 3249 InputFile=read_GUI(handles.InputFile); 3250 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 3251 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 3252 3322 InputFile=read_GUI(handles.InputFile);% read the input file parameters 3323 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles); 3324 [RootPath_1,SubDir_1,RootFile_1,FileIndex_1,FileExt_1]=read_file_boxes_1(handles); 3325 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];% name of the first input file 3326 3327 check_refresh=0; 3253 3328 if isempty(InputFile.VelType_1) 3254 FileName_1='';% we plot the current field without the second field3329 FileName_1='';% we plot the first input field without the second field 3255 3330 set(handles.SubField,'Value',0) 3256 SubField_Callback(hObject, eventdata, handles) 3331 SubField_Callback(hObject, eventdata, handles)% activate SubField_Callback and refresh current display, removing the second field 3257 3332 elseif get(handles.SubField,'Value')% if subfield is already 'on' 3258 [RootPath_1,SubDir_1,RootFile_1,FileIndices_1,FileExt_1]=read_file_boxes_1(handles);3259 FileName_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndices_1 FileExt_1];3260 else 3261 FileName_1=FileName;% we compare two fields in the same file by default3333 FileName_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1];% name of the second input file 3334 check_refresh=1;%will refresh the current display 3335 else% we introduce the same file (with a different field) for the second series 3336 FileName_1=FileName;% we compare two fields in the same file 3262 3337 UvData.FileType{2}=UvData.FileType{1}; 3338 UvData.XmlData{2}= UvData.XmlData{1}; 3263 3339 set(handles.SubField,'Value',1) 3264 end 3265 if isfield(UvData,'Field_1') 3266 UvData=rmfield(UvData,'Field_1');% removes the stored second field if it exists 3267 end 3268 UvData.FileName_1='';% desactivate the use of a constant second file 3269 set(handles.uvmat,'UserData',UvData) 3270 num_i1=stra2num(get(handles.i1,'String')); 3271 num_i2=stra2num(get(handles.i2,'String')); 3272 num_j1=stra2num(get(handles.j1,'String')); 3273 num_j2=stra2num(get(handles.j2,'String')); 3274 3275 errormsg=refresh_field(handles,FileName,FileName_1,num_i1,num_i2,num_j1,num_j2); 3276 3277 if ~isempty(errormsg) 3278 msgbox_uvmat('ERROR',errormsg); 3279 else 3280 set(handles.i1,'BackgroundColor',[1 1 1]) 3281 set(handles.i2,'BackgroundColor',[1 1 1]) 3282 set(handles.j1,'BackgroundColor',[1 1 1]) 3283 set(handles.j2,'BackgroundColor',[1 1 1]) 3284 set(handles.FileIndex,'BackgroundColor',[1 1 1]) 3285 set(handles.FileIndex_1,'BackgroundColor',[1 1 1]) 3286 end 3287 set(handles.run0,'BackgroundColor',[1 0 0]) 3340 transform=get(handles.path_transform,'UserData'); 3341 if (~isa(transform,'function_handle')||nargin(transform)<3) 3342 set(handles.transform_fct,'value',2); % set transform to sub_field if the current fct doe not accept two input fields 3343 transform_fct_Callback(hObject, eventdata, handles)% activate transform_fct_Callback and refresh current display 3344 else 3345 check_refresh=1; 3346 end 3347 end 3348 3349 % refresh the current display if it has not been done previously 3350 if check_refresh 3351 UvData.FileName_1='';% desactivate the use of a constant second file 3352 set(handles.uvmat,'UserData',UvData) 3353 num_i1=stra2num(get(handles.i1,'String')); 3354 num_i2=stra2num(get(handles.i2,'String')); 3355 num_j1=stra2num(get(handles.j1,'String')); 3356 num_j2=stra2num(get(handles.j2,'String')); 3357 [tild,tild,tild,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(['xx' FileIndex_1]); 3358 errormsg=refresh_field(handles,FileName,FileName_1,num_i1,num_i2,num_j1,num_j2,i1_1,i2_1,j1_1,j2_1); 3359 if ~isempty(errormsg) 3360 msgbox_uvmat('ERROR',errormsg); 3361 else 3362 set(handles.i1,'BackgroundColor',[1 1 1]) 3363 set(handles.i2,'BackgroundColor',[1 1 1]) 3364 set(handles.j1,'BackgroundColor',[1 1 1]) 3365 set(handles.j2,'BackgroundColor',[1 1 1]) 3366 set(handles.FileIndex,'BackgroundColor',[1 1 1]) 3367 set(handles.FileIndex_1,'BackgroundColor',[1 1 1]) 3368 end 3369 set(handles.run0,'BackgroundColor',[1 0 0]) 3370 end 3288 3371 3289 3372 %----------------------------------------------- … … 3605 3688 3606 3689 %% refresh the current plot 3607 run0_Callback(hObject, eventdata, handles) 3608 3609 3690 if isempty(list_path{ichoice}) || nargin(transform_handle)<3 3691 set(handles.SubField,'Value',0) 3692 SubField_Callback(hObject, eventdata, handles) 3693 else 3694 run0_Callback(hObject, eventdata, handles) 3695 end 3610 3696 3611 3697 %------------------------------------------------ … … 3961 4047 %replot all the objects within the new projected field 3962 4048 for IndexObj=1:numel(list_str) 3963 IndexObj 3964 hobject=UvData.Object{IndexObj}.DisplayHandle.uvmat 4049 hobject=UvData.Object{IndexObj}.DisplayHandle.uvmat; 3965 4050 if isempty(hobject) || ~ishandle(hobject) 3966 hobject=handles.PlotAxes 4051 hobject=handles.PlotAxes; 3967 4052 end 3968 4053 if isequal(IndexObj,get(handles.ListObject,'Value')) … … 4151 4236 data.Type='plane'; 4152 4237 end 4153 if isfield(UvData,'Field')4154 Field=UvData.Field;4155 if isfield(UvData.Field,'Mesh')&&~isempty(UvData.Field.Mesh)4156 data.RangeX=[UvData.Field.XMin UvData.Field.XMax];4157 if strcmp(data.Type,'line')||strcmp(data.Type,'polyline')4158 data.RangeY=UvData.Field.Mesh;4159 else4160 data.RangeY=[UvData.Field.YMin UvData.Field.YMax];4161 end4162 data.DX=UvData.Field.Mesh;4163 data.DY=UvData.Field.Mesh;4164 end4165 if isfield(Field,'NbDim')&& isequal(Field.NbDim,3)4166 data.Coord=[0 0 0]; %default4167 end4168 if isfield(Field,'CoordUnit')4169 data.CoordUnit=Field.CoordUnit;4170 end4171 end4238 % if isfield(UvData,'Field') 4239 % Field=UvData.Field; 4240 % if isfield(UvData.Field,'Mesh')&&~isempty(UvData.Field.Mesh) 4241 % data.RangeX=[UvData.Field.XMin UvData.Field.XMax]; 4242 % if strcmp(data.Type,'line')||strcmp(data.Type,'polyline') 4243 % data.RangeY=UvData.Field.Mesh; 4244 % else 4245 % data.RangeY=[UvData.Field.YMin UvData.Field.YMax]; 4246 % end 4247 % data.DX=UvData.Field.Mesh; 4248 % data.DY=UvData.Field.Mesh; 4249 % end 4250 % if isfield(Field,'NbDim')&& isequal(Field.NbDim,3) 4251 % data.Coord=[0 0 0]; %default 4252 % end 4253 % if isfield(Field,'CoordUnit') 4254 % data.CoordUnit=Field.CoordUnit; 4255 % end 4256 % end 4172 4257 hset_object=set_object(data,[],ZBounds); 4173 4258 hhset_object=guidata(hset_object); … … 4297 4382 UvData=get(huvmat,'UserData'); 4298 4383 %[xx,xx,FileBase]=read_file_boxes(handles); 4299 [RootPath,SubDir,RootFile,FileInd ices,FileExt]=read_file_boxes(handles);4384 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles); 4300 4385 FileBase=fullfile(RootPath,RootFile); 4301 4386 %read the current input file name … … 4587 4672 pos(1)=pos(1)+pos(3)-0.311+0.04; %0.311= width of the geometry_calib interface (units relative to the srcreen) 4588 4673 pos(2)=pos(2)-0.02; 4589 [RootPath,SubDir,RootFile,FileInd ices,FileExt]=read_file_boxes(handles);4590 FileName=[fullfile(RootPath,SubDir,RootFile) FileInd icesFileExt];4674 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles); 4675 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt]; 4591 4676 set(handles.view_xml,'Backgroundcolor',[1 1 0])%indicate the reading of the current xml file by geometry_calib 4592 4677 if isfield(UvData.OpenParam,'CalOrigin') … … 4720 4805 4721 4806 %prepare display of the set_grid GUI 4722 [RootPath,SubDir,RootFile,FileInd ices,FileExt]=read_file_boxes(handles);4723 FileName=[fullfile(RootPath,SubDir,RootFile) FileInd icesFileExt];4807 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles); 4808 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt]; 4724 4809 CoordList=get(handles.transform_fct,'String'); 4725 4810 val=get(handles.transform_fct,'Value'); … … 4746 4831 %------------------------------------------------------------------------ 4747 4832 series; %first display of the GUI to fill waiting time 4748 [RootPath,SubDir,RootFile,FileInd ices,FileExt]=read_file_boxes(handles);4749 param.FileName=[fullfile(RootPath,SubDir,RootFile) FileInd icesFileExt];4833 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles); 4834 param.FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt]; 4750 4835 if isequal(get(handles.SubField,'Value'),1) 4751 [RootPath_1,SubDir_1,RootFile_1,FileInd ices_1,FileExt_1]=read_file_boxes_1(handles);4752 FileName_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileInd ices_1 FileExt_1];4836 [RootPath_1,SubDir_1,RootFile_1,FileIndex_1,FileExt_1]=read_file_boxes_1(handles); 4837 FileName_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1]; 4753 4838 if ~isequal(FileName_1,param.FileName) 4754 4839 param.FileName_1=FileName_1; … … 4788 4873 function MenuPIV_Callback(hObject, eventdata, handles) 4789 4874 %------------------------------------------------------------------------ 4790 [RootPath,SubDir,RootFile,FileInd ices,FileExt]=read_file_boxes(handles);4791 FileName=[fullfile(RootPath,SubDir,RootFile) FileInd icesFileExt];4875 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles); 4876 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt]; 4792 4877 civ(FileName);% interface de civ(not in the uvmat file) 4793 4878
Note: See TracChangeset
for help on using the changeset viewer.