- Timestamp:
- Dec 23, 2010, 8:09:20 AM (14 years ago)
- Location:
- trunk/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/check_field_structure.m
r158 r159 112 112 else % DimName is detected in the current list of dimension names 113 113 if ~isequal(Data.DimValue(iprev),sizvar(idim)) 114 RangeTest(iprev)115 Data.DimValue(iprev)116 114 if isequal(Data.DimValue(iprev),2)&& RangeTest(iprev) % the dimension has been already detected as a range [min max] 117 115 Data.DimValue(iprev)=sizvar(idim); %update with actual value -
trunk/src/civ.m
r153 r159 1597 1597 index_first=min(index); 1598 1598 index_last=max(index); 1599 box_used=box_test( [index_first : index_last]);1599 box_used=box_test(index_first : index_last); 1600 1600 [box_missing,ind_missing]=min(box_used); 1601 1601 if isequal(box_missing,0) … … 1870 1870 filename_cmx=filecell.nc.civ1{ifile,j};%output netcdf file 1871 1871 filename_cmx(end-1:end+1)='cmx';%name of cmx file 1872 if batch 1873 [Rootbat,Filebat,extbat]=fileparts(filename_cmx); 1874 filename_bat=fullfile(Rootbat,['job_' Filebat extbat]); 1875 else 1876 filename_bat=filename_cmx; 1877 end 1878 filename_bat(end-2:end)='bat'; 1872 1879 1873 1880 %CIV1 … … 2211 2218 end 2212 2219 % create the .bat file: 2213 if batch 2214 [Rootbat,Filebat,extbat]=fileparts(filename_cmx); 2215 filename_bat=fullfile(Rootbat,['job_' Filebat extbat]); 2216 else 2217 filename_bat=filename_cmx; 2218 end 2219 filename_bat(end-2:end)='bat'; 2220 fid=fopen(filename_bat,'w'); 2220 [fid,message]=fopen(filename_bat,'w'); 2221 if isequal(fid,-1) 2222 msgbox_uvmat('ERROR', ['creation of .bat file: ' message]) 2223 return 2224 end 2221 2225 fprintf(fid,cmd); 2222 2226 fclose(fid); … … 2246 2250 2247 2251 if ~batch 2248 [Rootbat,Filebat,extbat]=fileparts(filename_ cmx);2252 [Rootbat,Filebat,extbat]=fileparts(filename_bat); 2249 2253 filename_superbat=fullfile(Rootbat,['job_list.bat']); 2250 2254 fid=fopen(filename_superbat,'w'); -
trunk/src/geometry_calib.m
r158 r159 1099 1099 function MenuDetectGrid_Callback(hObject, eventdata, handles) 1100 1100 %------------------------------------------------------------------------ 1101 %% initiate the grid 1101 1102 CalibData=get(handles.geometry_calib,'UserData');%get information stored on the GUI geometry_calib 1102 1103 grid_input=[];%default … … 1105 1106 end 1106 1107 [T,CalibData.grid,white_test]=create_grid(grid_input,'detect_grid');%display the GUI create_grid, read the set of phys coordinates T 1107 1108 1108 set(handles.geometry_calib,'UserData',CalibData)%store the phys grid parameters for later use 1109 1109 1110 % read the four last point coordinates in pixels1110 %% read the four last point coordinates in pixels 1111 1111 Coord_cell=get(handles.ListCoord,'String');%read list of coordinates on geometry_calib 1112 1112 data=read_geometry_calib(Coord_cell); 1113 1113 nbpoints=size(data.Coord,1); %nbre of calibration points 1114 1114 if nbpoints~=4 1115 msgbox_uvmat('ERROR','four points must be selected by the mouse, beginning by the new x axis, to delimitate the phs grid area')1115 msgbox_uvmat('ERROR','four points must have be selected by the mouse, beginning by the new x axis, to delimitate the phys grid area') 1116 1116 return 1117 1117 end … … 1130 1130 end 1131 1131 1132 % read the current image, displayed in the GUI uvmat1132 %% read the current image, displayed in the GUI uvmat 1133 1133 huvmat=findobj(allchild(0),'Name','uvmat'); 1134 1134 UvData=get(huvmat,'UserData'); 1135 1135 A=UvData.Field.A; 1136 1136 npxy=size(A); 1137 %linear transform on the current image 1138 X=[CalibData.grid.x_0 CalibData.grid.x_1 CalibData.grid.x_0 CalibData.grid.x_1]';%corner absissa in the phys coordinates 1139 Y=[CalibData.grid.y_0 CalibData.grid.y_0 CalibData.grid.y_1 CalibData.grid.y_1]';%corner ordinates in the phys coordinates 1140 1141 %calculate transform matrices: 1137 X=[CalibData.grid.x_0 CalibData.grid.x_1 CalibData.grid.x_0 CalibData.grid.x_1]';%corner absissa in the phys coordinates (cm) 1138 Y=[CalibData.grid.y_0 CalibData.grid.y_0 CalibData.grid.y_1 CalibData.grid.y_1]';%corner ordinates in the phys coordinates (cm) 1139 1140 %calculate transform matrices for plane projection 1142 1141 % reference: http://alumni.media.mit.edu/~cwren/interpolator/ by Christopher R. Wren 1143 1142 B = [ X Y ones(size(X)) zeros(4,3) -X.*corners_X -Y.*corners_X ... … … 1146 1145 D = [ corners_X , corners_Y ]; 1147 1146 D = reshape (D', 8 , 1 ); 1148 %l = inv(B' * B) * B' * D;1149 1147 l = (B' * B)\B' * D; 1150 1148 Amat = reshape([l(1:6)' 0 0 1 ],3,3)'; 1151 1149 C = [l(7:8)' 1]; 1152 1150 1153 %GeometryCalib.CalibrationType='tsai'; 1154 %GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function 1155 % GeometryCalib.f=1; 1156 % GeometryCalib.dpx=1; 1157 % GeometryCalib.dpy=1; 1158 % GeometryCalib.sx=1; 1159 % GeometryCalib.Cx=0; 1160 % GeometryCalib.Cy=0; 1161 % GeometryCalib.kappa1=0; 1162 % GeometryCalib.Tx=Amat(1,3); 1163 % GeometryCalib.Ty=Amat(2,3); 1164 % GeometryCalib.Tz=1; 1165 % GeometryCalib.R=[Amat(1,1),Amat(1,2),0;Amat(2,1),Amat(2,2),0;C(1),C(2),0]; 1166 % 1167 % [Amod,Rangx,Rangy]=phys_Ima(A-min(min(A)),GeometryCalib,0); 1168 1151 % transform grid image into 'phys' coordinates 1169 1152 GeometryCalib.fx_fy=[1 1]; 1170 1153 GeometryCalib.Tx_Ty_Tz=[Amat(1,3) Amat(2,3) 1]; 1171 1154 GeometryCalib.R=[Amat(1,1),Amat(1,2),0;Amat(2,1),Amat(2,2),0;C(1),C(2),0]; 1155 GeometryCalib.CoordUnit='cm'; 1172 1156 path_uvmat=which('uvmat');% check the path detected for source file uvmat 1173 1157 path_UVMAT=fileparts(path_uvmat); %path to UVMAT … … 1188 1172 Rangx=DataOut.AX; 1189 1173 Rangy=DataOut.AY; 1190 % GeometryCalib.dpx=1;1191 % GeometryCalib.dpy=1;1192 % GeometryCalib.sx=1;1193 % GeometryCalib.Cx=0;1194 % GeometryCalib.Cy=0;1195 % GeometryCalib.kappa1=0;1196 % GeometryCalib.Tx=Amat(1,3);1197 % GeometryCalib.Ty=Amat(2,3);1198 % GeometryCalib.Tz=1;1199 % GeometryCalib.R=[Amat(1,1),Amat(1,2),0;Amat(2,1),Amat(2,2),0;C(1),C(2),0];1200 %1201 % [Amod,Rangx,Rangy]=phys_Ima(A-min(min(A)),GeometryCalib,0);1202 1203 1174 if white_test 1204 Amod=double(Amod);% will look for image maxima1175 Amod=double(Amod);%case of white grid markers: will look for image maxima 1205 1176 else 1206 Amod=-double(Amod);% will look for image minima1177 Amod=-double(Amod);%case of black grid markers: will look for image minima 1207 1178 end 1208 1179 % figure(12) %display corrected image … … 1210 1181 % image(Rangx,Rangy,uint8(255*Amod/Amax)) 1211 1182 1183 %% detection of local image extrema in each direction 1212 1184 Dx=(Rangx(2)-Rangx(1))/(npxy(2)-1); %x mesh in real space 1213 1185 Dy=(Rangy(2)-Rangy(1))/(npxy(1)-1); %y mesh in real space … … 1230 1202 x_shift=0; 1231 1203 y_shift=0; 1232 %if ind_x_max+2<=2*ind_range_x+1 && ind_x_max-2>=11233 1204 if ind_x_max+2<=numel(x_profile) && ind_x_max-2>=1 1234 1205 Atop=x_profile(ind_x_max-2:ind_x_max+2); -
trunk/src/proj_field.m
r158 r159 1337 1337 % case with no rotation and interpolation 1338 1338 if isequal(ProjMode,'projection') && isequal(Phi,0) && isequal(Theta,0) && isequal(Psi,0) 1339 if test_direct(1) 1340 min_ind1=ceil((YMin-Coord{1}(1))/DYinit)+1; 1341 max_ind1=floor((YMax-Coord{1}(1))/DYinit)+1; 1342 Ybound(1)=Coord{1}(1)+DYinit*(min_ind1-1); 1343 Ybound(2)=Coord{1}(1)+DYinit*(max_ind1-1); 1339 if ~testXMin && ~testXMax && ~testYMin && ~testYMax 1340 ProjData=FieldData; 1344 1341 else 1345 min_ind1=ceil((Coord{1}(1)-YMax)/DYinit)+1; 1346 max_ind1=floor((Coord{1}(1)-YMin)/DYinit)+1; 1347 Ybound(2)=Coord{1}(1)-DYinit*(max_ind1-1); 1348 Ybound(1)=Coord{1}(1)-DYinit*(min_ind1-1); 1349 end 1350 if test_direct(2)==1 1351 min_ind2=ceil((XMin-Coord{2}(1))/DXinit)+1; 1352 max_ind2=floor((XMax-Coord{2}(1))/DXinit)+1; 1353 Xbound(1)=Coord{2}(1)+DXinit*(min_ind2-1); 1354 Xbound(2)=Coord{2}(1)+DXinit*(max_ind2-1); 1355 else 1356 min_ind2=ceil((Coord{2}(1)-XMax)/DXinit)+1; 1357 max_ind2=floor((Coord{2}(1)-XMin)/DXinit)+1; 1358 Xbound(2)=Coord{2}(1)+DXinit*(max_ind2-1); 1359 Xbound(1)=Coord{2}(1)+DXinit*(min_ind2-1); 1360 end 1361 min_ind1=max(min_ind1,1);% deals with margin (bound lower than the first index) 1362 min_ind2=max(min_ind2,1); 1363 max_ind1=min(max_ind1,DimValue(1)); 1364 max_ind2=min(max_ind2,DimValue(2)); 1365 for ivar=VarIndex 1366 VarName=FieldData.ListVarName{ivar}; 1367 ProjData.ListVarName=[ProjData.ListVarName VarName]; 1368 ProjData.VarDimName=[ProjData.VarDimName {DimCell}]; 1369 if isfield(FieldData,'VarAttribute') && length(FieldData.VarAttribute)>=ivar 1370 ProjData.VarAttribute{length(ProjData.ListVarName)}=FieldData.VarAttribute{ivar}; 1371 end 1372 eval(['ProjData.' VarName '=FieldData.' VarName '(min_ind1:max_ind1,min_ind2:max_ind2) ;']); 1373 end 1374 eval(['ProjData.' AYName '=FieldData.' AYName ';']) %record the new (projected ) y coordinates 1375 eval(['ProjData.' AXName '=FieldData.' AXName ';']) %record the new (projected ) x coordinates 1342 if test_direct(1) 1343 min_ind1=ceil((YMin-Coord{1}(1))/DYinit)+1; 1344 max_ind1=floor((YMax-Coord{1}(1))/DYinit)+1; 1345 Ybound(1)=Coord{1}(1)+DYinit*(min_ind1-1); 1346 Ybound(2)=Coord{1}(1)+DYinit*(max_ind1-1); 1347 else 1348 min_ind1=ceil((Coord{1}(1)-YMax)/DYinit)+1; 1349 max_ind1=floor((Coord{1}(1)-YMin)/DYinit)+1; 1350 Ybound(2)=Coord{1}(1)-DYinit*(max_ind1-1); 1351 Ybound(1)=Coord{1}(1)-DYinit*(min_ind1-1); 1352 end 1353 if test_direct(2)==1 1354 min_ind2=ceil((XMin-Coord{2}(1))/DXinit)+1; 1355 max_ind2=floor((XMax-Coord{2}(1))/DXinit)+1; 1356 Xbound(1)=Coord{2}(1)+DXinit*(min_ind2-1); 1357 Xbound(2)=Coord{2}(1)+DXinit*(max_ind2-1); 1358 else 1359 min_ind2=ceil((Coord{2}(1)-XMax)/DXinit)+1; 1360 max_ind2=floor((Coord{2}(1)-XMin)/DXinit)+1; 1361 Xbound(2)=Coord{2}(1)+DXinit*(max_ind2-1); 1362 Xbound(1)=Coord{2}(1)+DXinit*(min_ind2-1); 1363 end 1364 min_ind1=max(min_ind1,1);% deals with margin (bound lower than the first index) 1365 min_ind2=max(min_ind2,1); 1366 max_ind1=min(max_ind1,DimValue(1)); 1367 max_ind2=min(max_ind2,DimValue(2)); 1368 for ivar=VarIndex 1369 VarName=FieldData.ListVarName{ivar}; 1370 ProjData.ListVarName=[ProjData.ListVarName VarName]; 1371 ProjData.VarDimName=[ProjData.VarDimName {DimCell}]; 1372 if isfield(FieldData,'VarAttribute') && length(FieldData.VarAttribute)>=ivar 1373 ProjData.VarAttribute{length(ProjData.ListVarName)}=FieldData.VarAttribute{ivar}; 1374 end 1375 eval(['ProjData.' VarName '=FieldData.' VarName '(min_ind1:max_ind1,min_ind2:max_ind2,:) ;']); 1376 end 1377 eval(['ProjData.' AYName '=[Ybound(1) Ybound(2)];']) %record the new (projected ) y coordinates 1378 eval(['ProjData.' AXName '=[Xbound(1) Xbound(2)];']) %record the new (projected ) x coordinates 1379 end 1376 1380 else % case with rotation and/or interpolation 1377 1381 if isempty(Coord_z) %2D case -
trunk/src/read_civxdata.m
r158 r159 1 1 %'read_civxdata': reads civx data from netcdf files 2 2 %------------------------------------------------------------------ 3 % 4 % function [Field,VelTypeOut]=read_civxdata(filename,FieldNames,VelType) 5 % 3 6 % OUTPUT: 4 7 % nb_coord,nb_dim, -
trunk/src/set_object.m
r158 r159 46 46 'gui_LayoutFcn', [] , ... 47 47 'gui_Callback', []); 48 if nargin & is str(varargin{1})48 if nargin & ischar(varargin{1}) 49 49 gui_State.gui_Callback = str2func(varargin{1}); 50 50 end … … 318 318 end 319 319 if isequal(style,'line') 320 if isequal(style_prev,'rectangle')|isequal(style_prev,'ellipse')320 if strcmp(style_prev,'rectangle')||strcmp(style_prev,'ellipse') 321 321 XMax=get(handles.XMax,'String'); 322 322 YMax=get(handles.YMax,'String'); … … 328 328 end 329 329 elseif isequal(style,'polyline') 330 elseif isequal(style,'rectangle')| isequal(style,'ellipse')330 elseif strcmp(style,'rectangle')|| strcmp(style,'ellipse') 331 331 set(handles.XObject,'String',x_new) 332 332 set(handles.YObject,'String',y_new) … … 387 387 set(handles.YMax,'Visible','on') 388 388 end 389 if isequal(ObjectStyle,'rectangle')|isequal(ObjectStyle,'ellipse')389 if strcmp(ObjectStyle,'rectangle')||strcmp(ObjectStyle,'ellipse') 390 390 set(handles.XMax,'Visible','on') 391 391 else … … 731 731 ListObject=get(hhuvmat.list_object_1,'String');%position in the objet list 732 732 IndexObj_1=get(hhuvmat.list_object_1,'Value'); 733 IndexObj_2=get(hhuvmat.list_object_2,'Value'); 733 if isequal(get(hhuvmat.list_object_2,'Visible'),'on') 734 IndexObj_2=get(hhuvmat.list_object_2,'Value'); 735 else 736 IndexObj_2=[]; 737 end 734 738 testnew=0; 735 739 PlotHandles=get_plot_handles(hhuvmat); … … 741 745 projview='uvmat'; 742 746 plotaxes=hhuvmat.axes3;%handle of axes3 in view_field 743 elseif IndexObj_2<=numel(ListObject)&& strcmp(ListObject{IndexObj_2},ObjectName)% we are editing the object whose projection is viewed in view_field 744 747 elseif ~isempty(IndexObj_2) && IndexObj_2<=numel(ListObject)&& strcmp(ListObject{IndexObj_2},ObjectName)% we are editing the object whose projection is viewed in view_field 745 748 IndexObj=IndexObj_2; 746 749 % projview='view_field'; … … 756 759 end 757 760 if strcmp(projview,'view_field') 758 hview_field=findobj(allchild(0),'tag','view_field') 761 hview_field=findobj(allchild(0),'tag','view_field'); 759 762 if isempty(hview_field) 760 hview_field=view_field 763 hview_field=view_field; 761 764 end 762 765 PlotHandles=guidata(hview_field); … … 792 795 793 796 %% update the object plot and projection field 794 if testnew 797 if testnew 795 798 set(hhuvmat.list_object_2,'Value',IndexObj) 796 799 ObjectData.DisplayHandle_uvmat=hhuvmat.axes3; 797 800 ObjectData.DisplayHandle_view_field=[]; 798 else 801 elseif ~isfield(UvData.Object{IndexObj},'DisplayHandle_uvmat')% save the previous object graph handles 799 802 ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj}.DisplayHandle_uvmat; 800 803 ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj}.DisplayHandle_view_field; 804 else 805 ObjectData.DisplayHandle_uvmat=hhuvmat.axes3; 806 ObjectData.DisplayHandle_view_field=[]; 801 807 end 802 808 UvData.Object{IndexObj}=ObjectData;%update the current object properties 803 IndexObj804 ObjectData805 809 UvData.Object=update_obj(UvData,IndexObj_1,IndexObj_2); 806 810 807 811 %% plot the field projected on the object and store it the corresponding figue 808 812 get(plotaxes,'tag') 809 ProjData= proj_field(UvData.Field,ObjectData) %project the current interface field on ObjectData813 ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData 810 814 [PlotType,Object_out{IndexObj}.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotHandles);%update an existing field plot 811 815 if strcmp(projview,'view_field') … … 880 884 def={fullfile(dir_save,[Object.Style '.xml'])}; 881 885 end 882 options.Resize='on';883 886 displ_txt='save object as an .xml file';%default display 884 887 menu=get(handles.ProjMode,'String'); … … 889 892 end 890 893 answer=msgbox_uvmat('INPUT_TXT','save object as an .xml file',def); 891 %answer=inputdlg('','save object in a new .xml file',1,def,'on');892 894 if ~isempty(answer) 893 895 t=struct2xml(Object); -
trunk/src/update_obj.m
r156 r159 48 48 49 49 %% representation of the different objects in the plots uvmat and view_field 50 %hfig=get(plotaxes,'parent');51 %tagfig=get(hfig,'tag');52 % if length(Object_set)<IndexObj53 %Object_set{IndexObj}=ObjectData;54 % end55 % plot the updated object in uvmat56 % hobject=[];57 % if isfield(Object_set{IndexObj},'DisplayHandle_uvmat') && ~isempty(Object_set{IndexObj}.DisplayHandle_uvmat) && ishandle(Object_set{IndexObj}.DisplayHandle_uvmat)58 % hobject=Object_set{IndexObj}.DisplayHandle_uvmat;59 % % else60 % % hobject=plotaxes;61 % end62 % Object_out{IndexObj}.DisplayHandle_uvmat=plot_object(Object_set{IndexObj},Object_set{1},hobject,'m');%update the object representation63 50 64 % if strcmp(tagfig,'uvmat')%plot uvmat51 %plot uvmat 65 52 for iobj=1:length(Object_out) %change the view of all existing objects on the updated current object #IndexObj_1 66 53 hobject=[]; 67 54 if isfield(Object_out{iobj},'DisplayHandle_uvmat') && ~isempty(Object_out{iobj}.DisplayHandle_uvmat) && ishandle(Object_out{iobj}.DisplayHandle_uvmat) 68 55 hobject=Object_out{iobj}.DisplayHandle_uvmat; 69 % else70 % hobject=plotaxes;71 56 end 72 57 Object_out{iobj}.DisplayHandle_uvmat=plot_object(Object_out{iobj},Object_out{IndexObj_1},hobject,'m');%update the object representation 73 58 end 74 % else%plot view_field 59 % plot view_field 60 if ~isempty(IndexObj_2) 75 61 for iobj=1:length(Object_out) %change the view of all existing objects on the updated current object #IndexObj_2 76 62 hobject=[]; … … 82 68 Object_out{iobj}.DisplayHandle_view_field=plot_object(Object_out{iobj},Object_out{IndexObj_2},hobject,'m');%update the object representation 83 69 end 70 end 84 71 % end 85 72 -
trunk/src/uvmat.m
r158 r159 31 31 % 'Strings' of all edit boxes and menus: get(handles.Tag,'String') 32 32 % 'Values' of all menus and toggle buttons: get(handles.Tag,'Value') 33 % Matlab structure stored as 'UserData' of the figure uvmat.fig,(can be obtained by right mouse click on the interface).33 % Matlab structure called UvData stored as 'UserData' of the figure uvmat.fig,(can be obtained by right mouse click on the interface). 34 34 % It contains the following fields: 35 35 % - Fixed specifiacation of plotting figures and axes (defined bu uvmat_OpeningFcn) … … 47 47 % .FieldName_1:(char string) second field selected('image', 'velocity'...) 48 48 % .CName: (char string)name of the scalar used for vector colors 49 % .CoordType: (char string) coordinate transform: e.g. 'phys' or 'px' 50 % .MouseAction: store the current effect of mouse button (create or edit objects) 49 % .MovieObject: movie object representing an input movie 50 % .MovieObject_1: idem for a second input series (_1) 51 % .filename_1 : last second input file name (to deal with a constant second input without reading again the file) 52 % .VelType_1: last velocity type (civ1, civ2...) for the second input series 53 % .FieldName_1: last field name(velocity, vorticity...) for the second input series 54 % .NbDim: number of space dimensions of the input field 55 % .ZMin, .ZMax: range of the z coordinate 56 %..... to complement 51 57 % - Information on projection objects 52 58 % .Object: {[1x1 struct]} … … 79 85 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DATA FLOW (for run0_Callback) %%%%%%%%%%%%%%%%%%%%: 80 86 % 87 % fields are opened and visualised by the sub-function refresh_field.m 88 % (called by uvmat_opening, RUN0, runp and runm) 89 % The function first reads the name of the input file from the edit boxes of the GUI 90 % A second input file can be introduced for filed comparison 91 % It then reads the input file(s) with the appropriate function, read for 92 % images, read_civxdata.m for CIVx PIV data, nc2struct for other netcdf 93 % files. 81 94 % Main input open second input open(_1) second image (pair animation) 82 % read_ncfield.m| |83 % read image.m| |95 % | | 96 % | | 84 97 % Field{1} Field{2} 85 98 % | … … 2058 2071 end 2059 2072 UvData=get(handles.uvmat,'UserData'); 2060 %UvData =structure containing information stored outside the uicontrol of uvmat 2061 % .NewSeries: =1 for a new series (new root fiel introduced), 0 else 2062 % .MovieObject: movie object representing an input movie 2063 % .MovieObject_1: idem for a second input series (_1) 2064 % .filename_1 : last second input file name (to deal with a constant second input without reading again the file) 2065 % .VelType_1: last velocity type (civ1, civ2...) for the second input series 2066 % .FieldName_1: last field name(velocity, vorticity...) for the second input series 2067 % .NbDim: number of space dimensions of the input field 2068 % .ZMin, .ZMax: range of the z coordinate 2069 %..... to complement 2073 2070 2074 2071 2075 if ishandle(handles.UVMAT_title) %remove title panel on uvmat … … 2135 2139 end 2136 2140 end 2141 2137 2142 %% choose a second field if Subfield option is 'on' 2138 2143 FieldName_1=[]; … … 2493 2498 [CellVarIndex,NbDim,VarType]=find_field_indices(UvData.Field); 2494 2499 [NbDim,imax]=max(NbDim); 2495 if isempty(imax)2496 % DimVarIndex=0;2497 coord_x=[];2498 else2499 % VarIndex=CellVarIndex{imax};2500 coord_x=VarType{imax}.coord_x;2501 end2502 if isfield(UvData,'NbDim') && ~isempty(UvData.NbDim)2503 NbDim=UvData.NbDim;2504 else2505 2506 end2507 if ~isempty( CellVarIndex) && ~isempty(VarType{imax}.coord_x) && ~isempty(VarType{imax}.coord_y) %unstructured coordinate z2500 % if isempty(imax) 2501 % % DimVarIndex=0; 2502 % coord_x=[]; 2503 % else 2504 % % VarIndex=CellVarIndex{imax}; 2505 % coord_x=VarType{imax}.coord_x; 2506 % end 2507 % if isfield(UvData,'NbDim') && ~isempty(UvData.NbDim) 2508 % NbDim=UvData.NbDim; 2509 % else 2510 UvData.NbDim=NbDim; 2511 % end 2512 if ~isempty(VarType{imax}.coord_x) && ~isempty(VarType{imax}.coord_y) %unstructured coordinates 2508 2513 XName=UvData.Field.ListVarName{VarType{imax}.coord_x}; 2509 2514 YName=UvData.Field.ListVarName{VarType{imax}.coord_y}; 2510 test_x=1; 2511 elseif isfield(UvData.Field,'X') && isfield(UvData.Field,'Y') 2512 XName='X'; 2513 YName='Y'; 2514 test_x=1; 2515 end 2516 if test_x 2517 eval(['UvData.XMax=max(UvData.Field.' XName ');']) 2518 eval(['UvData.XMin=min(UvData.Field.' XName ');']) 2519 eval(['UvData.YMax=max(UvData.Field.' YName ');']) 2520 eval(['UvData.YMin=min(UvData.Field.' YName ');']) 2521 eval(['nbvec=length(UvData.Field.' XName ');']) 2522 if NbDim==3% 2523 if ~isempty(CellVarIndex) && ~isempty(VarType{imax}.coord_z)%unstructured coordinate z 2524 ZName=UvData.Field.ListVarName{VarType{imax}.coord_z}; 2525 eval(['UvData.ZMax=max(UvData.Field.' ZName ');']) 2526 eval(['UvData.ZMin=min(UvData.Field.' ZName ');']) 2527 test_z=1; 2528 elseif isfield(UvData,'Z')% usual civ data 2529 UvData.ZMax=max(UvData.Z); 2530 UvData.ZMin=min(UvData.Z); 2531 test_z=1; 2532 end 2533 end 2534 if isequal(UvData.ZMin,UvData.ZMax)%no z dependency 2515 eval(['nbvec=length(UvData.Field.' XName ');'])%nbre of measurement points (e.g. vectors) 2516 test_x=1;%test for unstructured coordinates 2517 elseif NbDim==2 2518 YName=UvData.Field.ListVarName{VarType{imax}.coord(1)}; %structured coordinates 2519 XName=UvData.Field.ListVarName{VarType{imax}.coord(2)}; 2520 elseif NbDim==3 2521 ZName=UvData.Field.ListVarName{VarType{imax}.coord(1)};%structured coordinates in 3D 2522 YName=UvData.Field.ListVarName{VarType{imax}.coord(2)}; 2523 XName=UvData.Field.ListVarName{VarType{imax}.coord(3)}; 2524 end 2525 2526 eval(['XMax=max(UvData.Field.' XName ');']) 2527 eval(['XMin=min(UvData.Field.' XName ');']) 2528 eval(['YMax=max(UvData.Field.' YName ');']) 2529 eval(['YMin=min(UvData.Field.' YName ');']) 2530 eval(['nbvec=length(UvData.Field.' XName ');']) 2531 if NbDim==3% 2532 if ~isempty(CellVarIndex) && ~isempty(VarType{imax}.coord_z)%unstructured coordinate z 2533 % ZName=UvData.Field.ListVarName{VarType{imax}.coord_z}; 2534 eval(['ZMax=max(UvData.Field.' ZName ');']) 2535 eval(['ZMin=min(UvData.Field.' ZName ');']) 2536 test_z=1; 2537 elseif isfield(UvData,'Z')% usual civ data 2538 ZMax=max(UvData.Z); 2539 ZMin=min(UvData.Z); 2540 test_z=1; 2541 end 2542 if isequal(ZMin,ZMax)%no z dependency 2535 2543 NbDim=2; 2536 2544 test_z=0; 2537 end 2545 end 2546 end 2547 if test_x 2538 2548 if test_z 2539 Field.Mesh=((UvData.XMax-UvData.XMin)*(UvData.YMax-UvData.YMin)*(UvData.ZMax-UvData.ZMin))/nbvec;% volume per vector2540 Field.Mesh=(Field.Mesh)^(1/3);2549 UvData.Field.Mesh=((XMax-XMin)*(YMax-YMin)*(ZMax-ZMin))/nbvec;% volume per vector 2550 UvData.Field.Mesh=(UvData.Field.Mesh)^(1/3); 2541 2551 else 2542 Field.Mesh=sqrt((UvData.XMax-UvData.XMin)*(UvData.YMax-UvData.YMin)/nbvec);%2D 2543 end 2544 end 2545 2546 %case of structured coordinates 2547 'TESTfield' 2548 UvData.Field 2549 if isfield(UvData.Field,'AX') && isfield(UvData.Field,'AY')&& isfield(UvData.Field,'A') 2550 UvData.XMax=max(UvData.Field.AX); 2551 UvData.XMin=min(UvData.Field.AX); 2552 UvData.YMax=max(UvData.Field.AY); 2553 UvData.YMin=min(UvData.Field.AY); 2554 np_A=size(UvData.Field.A); 2555 Field.Mesh=sqrt((UvData.XMax-UvData.XMin)*(UvData.YMax-UvData.YMin)/((np_A(1)-1) * (np_A(2)-1))) ; 2556 end 2557 if isempty(coord_x) && ~isempty(CellVarIndex) 2552 UvData.Field.Mesh=sqrt((XMax-XMin)*(YMax-YMin)/nbvec);%2D 2553 end 2554 else 2558 2555 VarIndex=CellVarIndex{imax}; % list of variable indices 2559 2556 DimIndex=UvData.Field.VarDimIndex{VarIndex(1)}; %list of dim indices for the variable 2560 if NbDim==3 2561 nbpoints=UvData.Field.DimValue(DimIndex(1)); 2562 if isfield(VarType{imax},'coord_3')&& ~isequal(VarType{imax}.coord_3,0) % z is a dimension variable 2563 ZName=UvData.Field.ListVarName{VarType{imax}.coord_3}; 2564 eval(['UvData.ZMax=max(UvData.Field.' ZName ');']) 2565 eval(['UvData.ZMin=min(UvData.Field.' ZName ');']) 2566 else 2567 testcoord_z=0; 2568 if length(UvData.Field.VarAttribute)>=VarIndex(1) 2569 if isfield(UvData.Field.VarAttribute{VarIndex(1)},'Coord_1')%regular grid 2570 Coord_z=UvData.Field.VarAttribute{VarIndex(1)}.Coord_1; 2571 UvData.ZMax=max(Coord_z); 2572 UvData.ZMin=min(Coord_z); 2573 testcoord_z=1; 2574 end 2575 end 2576 if ~testcoord_z 2577 UvData.ZMin=1; 2578 UvData.ZMax=UvData.Field.DimValue(DimIndex(1)); 2579 end 2580 end 2581 Field.Mesh=(UvData.ZMax-UvData.ZMin)/(nbpoints-1); 2582 elseif NbDim==2 2583 nbpoints_y=UvData.Field.DimValue(DimIndex(1)); 2584 Yvar=VarType{imax}.coord_y; 2585 if Yvar~=0 % x is a dimension variable 2586 YName=UvData.Field.ListVarName{Yvar}; 2587 eval(['UvData.YMax=max(UvData.Field.' YName ');']) 2588 eval(['UvData.YMin=min(UvData.Field.' YName ');']) 2589 else 2590 testcoord_y=0; 2591 if ~testcoord_y 2592 UvData.YMin=1; 2593 UvData.YMax=UvData.Field.DimValue(DimIndex(1)); 2594 end 2595 end 2596 DY=(UvData.YMax-UvData.YMin)/(nbpoints_y-1); 2597 nbpoints_x=UvData.Field.DimValue(DimIndex(2)); 2598 Xvar=VarType{imax}.coord_x; 2599 if Xvar~=0 % x is a dimension variable 2600 XName=UvData.Field.ListVarName{Xvar}; 2601 eval(['UvData.XMax=max(UvData.Field.' XName ');']) 2602 eval(['UvData.XMin=min(UvData.Field.' XName ');']) 2603 else 2604 testcoord_x=0; 2605 if ~testcoord_x 2606 UvData.XMin=1; 2607 UvData.XMax=UvData.Field.DimValue(DimIndex(2)); 2608 end 2609 end 2610 DX=(UvData.XMax-UvData.XMin)/(nbpoints_x-1); 2611 Field.Mesh= sqrt(DX*DY); 2612 end 2613 end 2557 nbpoints_y=UvData.Field.DimValue(DimIndex(1)); 2558 nbpoints_x=UvData.Field.DimValue(DimIndex(2)); 2559 DX=(XMax-XMin)/nbpoints_x; 2560 DY=(YMax-YMin)/nbpoints_y; 2561 UvData.Field.Mesh=sqrt(DX*DY); 2562 end 2563 UvData.Field.XMax=XMax; 2564 UvData.Field.XMin=XMin; 2565 UvData.Field.YMax=XMax; 2566 UvData.Field.YMin=XMin; 2567 if test_z 2568 UvData.Field.ZMax=ZMax; 2569 UvData.Field.ZMin=ZMin; 2570 end 2571 2572 %case of structured coordinates 2573 2574 % if isempty(coord_x) && ~isempty(CellVarIndex) 2575 % VarIndex=CellVarIndex{imax}; % list of variable indices 2576 % DimIndex=UvData.Field.VarDimIndex{VarIndex(1)}; %list of dim indices for the variable 2577 % if NbDim==3 2578 % nbpoints=UvData.Field.DimValue(DimIndex(1)); 2579 % if isfield(VarType{imax},'coord_3')&& ~isequal(VarType{imax}.coord_3,0) % z is a dimension variable 2580 % ZName=UvData.Field.ListVarName{VarType{imax}.coord_3}; 2581 % eval(['UvData.ZMax=max(UvData.Field.' ZName ');']) 2582 % eval(['UvData.ZMin=min(UvData.Field.' ZName ');']) 2583 % else 2584 % testcoord_z=0; 2585 % if length(UvData.Field.VarAttribute)>=VarIndex(1) 2586 % if isfield(UvData.Field.VarAttribute{VarIndex(1)},'Coord_1')%regular grid 2587 % Coord_z=UvData.Field.VarAttribute{VarIndex(1)}.Coord_1; 2588 % UvData.ZMax=max(Coord_z); 2589 % UvData.ZMin=min(Coord_z); 2590 % testcoord_z=1; 2591 % end 2592 % end 2593 % if ~testcoord_z 2594 % UvData.ZMin=1; 2595 % UvData.ZMax=UvData.Field.DimValue(DimIndex(1)); 2596 % end 2597 % end 2598 % Field.Mesh=(UvData.ZMax-UvData.ZMin)/(nbpoints-1); 2599 % elseif NbDim==2 2600 % nbpoints_y=UvData.Field.DimValue(DimIndex(1)); 2601 % Yvar=VarType{imax}.coord_y; 2602 % if Yvar~=0 % x is a dimension variable 2603 % YName=UvData.Field.ListVarName{Yvar}; 2604 % eval(['UvData.YMax=max(UvData.Field.' YName ');']) 2605 % eval(['UvData.YMin=min(UvData.Field.' YName ');']) 2606 % else 2607 % testcoord_y=0; 2608 % if ~testcoord_y 2609 % UvData.YMin=1; 2610 % UvData.YMax=UvData.Field.DimValue(DimIndex(1)); 2611 % end 2612 % end 2613 % DY=(UvData.YMax-UvData.YMin)/(nbpoints_y-1); 2614 % nbpoints_x=UvData.Field.DimValue(DimIndex(2)); 2615 % Xvar=VarType{imax}.coord_x; 2616 % if Xvar~=0 % x is a dimension variable 2617 % XName=UvData.Field.ListVarName{Xvar}; 2618 % eval(['UvData.XMax=max(UvData.Field.' XName ');']) 2619 % eval(['UvData.XMin=min(UvData.Field.' XName ');']) 2620 % else 2621 % testcoord_x=0; 2622 % if ~testcoord_x 2623 % UvData.XMin=1; 2624 % UvData.XMax=UvData.Field.DimValue(DimIndex(2)); 2625 % end 2626 % end 2627 % DX=(UvData.XMax-UvData.XMin)/(nbpoints_x-1); 2628 % Field.Mesh= sqrt(DX*DY); 2629 % end 2630 % end 2614 2631 2615 2632 %create a default projection menuplane … … 2680 2697 IndexObj_2=get(handles.list_object_2,'Value');%selected projection object for the second view 2681 2698 if isequal(get(handles.list_object_2,'Visible'),'on') && IndexObj_2 <= numel(UvData.Object)&& ~isempty(UvData.Object{IndexObj_2}) 2682 UvData.Object{IndexObj_2}2683 2699 IndexObj(2)=IndexObj_2; 2684 2700 view_field_handle=findobj(allchild(0),'tag','view_field');%handles of the view_field GUI … … 4419 4435 list_str=get(handles.list_object_2,'String'); 4420 4436 IndexObj=get(handles.list_object_2,'Value'); 4421 if strcmp(list_str{IndexObj},'...')4437 if ischar(list_str) || strcmp(list_str{IndexObj},'...') 4422 4438 hview_field=findobj(allchild(0),'Tag','view_field'); 4423 4439 if ~isempty(hview_field) … … 4655 4671 % ------------------------------------------------------------------ 4656 4672 function MenuCalib_Callback(hObject, eventdata, handles) 4657 %geometry_calib; %display the GUI as a waiting display4658 4673 4659 4674 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface … … 4662 4677 set(handles.zoom,'Value',0) 4663 4678 set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7]) 4664 % set(handles.MenuMask,'enable','off')4665 % set(handles.MenuGrid,'enable','off')4666 % set(handles.MenuObject,'enable','off')4667 % set(handles.MenuEdit,'enable','off')4668 4679 set(handles.list_object_1,'Value',1) 4669 4680 % initiate display of GUI geometry_calib … … 4682 4693 pos_cal(2)=pos_uvmat(2)+UvData.CalOrigin(2)*pos_uvmat(4); 4683 4694 pos_cal(3:4)=UvData.CalSize .* pos_uvmat(3:4); 4684 %set(UvData.hset_object,'Position',pos_cal)4685 4695 end 4686 4696 geometry_calib(FileName,pos_cal);% call the geometry_calib interface 4687 4697 set(handles.view_xml,'Backgroundcolor',[1 1 1])%indicate the end of reading of the current xml file by geometry_calib 4688 4698 set(handles.MenuCalib,'checked','on')% indicate that MenuCalib is activated, test used by mouse action 4689 4690 %UvData.MouseAction='calib';4691 % set(handles.uvmat,'UserData',UvData);4692 4699 4693 4700 … … 4721 4728 flagobj=1; 4722 4729 testphys=0; %coordinates in pixels by default 4723 if isfield(ObjectData,'Coord Type') && isequal(ObjectData.CoordType,'phys')4730 if isfield(ObjectData,'CoordUnit') && ~isequal(ObjectData.CoordUnit,'pixel') 4724 4731 if isfield(UvData,'XmlData')&& isfield(UvData.XmlData,'GeometryCalib') 4725 4732 Calib=UvData.XmlData.GeometryCalib;
Note: See TracChangeset
for help on using the changeset viewer.