- Timestamp:
- Jan 18, 2011, 10:50:40 PM (14 years ago)
- Location:
- trunk/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/calc_field.m
r156 r180 67 67 units_cell={}; 68 68 for ilist=1:length(FieldName) 69 [VarName,Value,Role,units]=feval(FieldName{ilist},DataIn);%calculate field with appropriate function named FieldName{ilist} 70 ListVarName=[ListVarName VarName]; 71 ValueList=[ValueList Value]; 72 RoleList=[RoleList Role]; 73 units_cell=[units_cell units]; 69 if ~isempty(FieldName{ilist}) 70 [VarName,Value,Role,units]=feval(FieldName{ilist},DataIn);%calculate field with appropriate function named FieldName{ilist} 71 ListVarName=[ListVarName VarName]; 72 ValueList=[ValueList Value]; 73 RoleList=[RoleList Role]; 74 units_cell=[units_cell units]; 75 end 74 76 end 75 77 %erase previous data (except coordinates) -
trunk/src/civ.m
r179 r180 1598 1598 box_test(5)=get(handles.FIX2,'Value'); 1599 1599 box_test(6)=get(handles.PATCH2,'Value'); 1600 index =find(box_test==1);1601 if isempty(index )1600 index_first=find(box_test==1,1); 1601 if isempty(index_first) 1602 1602 msgbox_uvmat('ERROR','no selected operation') 1603 1603 return 1604 1604 end 1605 index_first=min(index); 1606 index_last=max(index); 1605 index_last=find(box_test==1,1,'last'); 1607 1606 box_used=box_test(index_first : index_last); 1608 1607 [box_missing,ind_missing]=min(box_used); 1609 if isequal(box_missing,0) 1608 if isequal(box_missing,0); %there is a missing step in the sequence of operations 1610 1609 msgbox_uvmat('ERROR',['missing' cell2mat(operations(ind_missing))]); 1611 1610 return … … 1640 1639 %% reinitialise status callback 1641 1640 if isfield(handles,'status') 1642 set(handles.status,'Value',0);%suppress status display1643 status_Callback(hObject, eventdata, handles)1641 set(handles.status,'Value',0);%suppress status display 1642 status_Callback(hObject, eventdata, handles) 1644 1643 end 1645 1644 1646 1645 %% set the list of files and check them 1647 1646 display('checking the files...') 1648 %compare=get(handles.compare,'Value');%test for usual PIV (compare=1) or displacement (=2) or stereo PIV (=3)1649 1647 [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc]=... 1650 1648 set_civ_filenames(handles,box_test); … … 4623 4621 box_test(4)=get(handles.CIV2,'Value'); 4624 4622 box_test(5)=get(handles.FIX2,'Value'); 4625 box_test(6)=get(handles.PATCH2,'Value') 4626 find(box_test) 4627 option_civ=max(find(box_test)) 4623 box_test(6)=get(handles.PATCH2,'Value'); 4624 option_civ=find(box_test,1,'last');%last selected option (non-zero index of box_test) 4628 4625 filecell=get(handles.civ,'UserData'); 4629 4626 if ~isfield(filecell,'nc') -
trunk/src/editxml.m
r153 r180 330 330 head_name=get(t,1,'name'); 331 331 %Path to shemas: 332 path_uvmat=which('editxml');% check the path detected for source file uvmat 333 path_UVMAT=fileparts(path_uvmat); %path to UVMAT 334 xmlparam=fullfile(path_UVMAT,'PARAM.xml'); 332 % path_uvmat=which('editxml');% check the path detected for source file uvmat 333 % path_UVMAT=fileparts(path_uvmat); %path to UVMAT 334 % xmlparam=fullfile(path_UVMAT,'PARAM.xml'); 335 xmlparam='PARAM.xml'; %will find PARAM.xml whose path is set in priority 335 336 if exist(xmlparam,'file') 336 337 tparam=xmltree(xmlparam); … … 350 351 '*.xsd', '.xsd files '; ... 351 352 '*.*', 'All Files (*.*)'}, ... 352 'Pick a .xsd schema' ,schema path); %file browser353 'Pick a .xsd schema' ,schemafile); %file browser 353 354 if ischar(PathName) && ischar(FileName) && exist(fullfile(PathName,FileName),'file') 354 355 DataIn.Schema=fullfile(PathName,FileName); -
trunk/src/get_field.m
r179 r180 45 45 %------------------------------------------------------------------------ 46 46 % --- Executes just before get_field is made visible. 47 function get_field_OpeningFcn(hObject, eventdata, handles,filename, Field,haxes)48 %------------------------------------------------------------------------ 49 global nb_builtin 50 51 %% look at the existing figu es in the work space47 function get_field_OpeningFcn(hObject, eventdata, handles,filename,multiple) 48 %------------------------------------------------------------------------ 49 global nb_builtin % nbre of functions to include by default in the menu of functions called by RUN 50 51 %% look at the existing figures in the work space 52 52 browse_fig(handles.list_fig) 53 53 … … 61 61 set(hObject,'WindowButtonUpFcn',{@mouse_up_gui,handles}) 62 62 63 %% prepare the list of builtin fcts and set their paths 64 menu_str={'PLOT';'FFT';'filter_band';'histogram'}; %list of functions included by default in 'get_field.m' 63 %% prepare the list of RUN fcts and set their paths 64 % functions included by default in 'get_field.m 65 menu_str={'PLOT';'FFT';'filter_band';'histogram'}; 65 66 nb_builtin=numel(menu_str); 66 67 path_uvmat=fileparts(which('uvmat'));%path of the function 'uvmat' … … 78 79 rmpath(fullfile(path_uvmat,'get_field')) 79 80 dir_perso=prefdir; 81 82 % look for functions previously used (names and paths saved in the personal file uvmat_perso.mat): 80 83 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 81 84 if exist(profil_perso,'file') 82 % menu={'RUN';'raw2phys';'histogram';'FFT';'peaklocking'};83 85 h=load (profil_perso); 84 86 if isfield(h,'get_field_fct') && iscell(h.get_field_fct) … … 99 101 end 100 102 end 103 101 104 menu_str=menu_str(testexist==1);%=menu_str(testexist~=0) 102 105 fct_handle=fct_handle(testexist==1); … … 110 113 if exist('filename','var') && ischar(filename) %transfer input file name in slave mode 111 114 set(handles.inputfile,'String',filename)% prefill the input file name 112 set(handles.inputfile,'Enable','off')% desactivate the input file edit box 113 % set(handles.list_fig,'Value',2)% plotting axes =uvmat selected 114 % set(handles.list_fig,'Visible','off')% 115 set(handles.RUN,'String','REFRESH')% passive mode, get_field used to define the field for uvamt 116 set(handles.MenuOpen,'Visible','off') 117 set(handles.MenuExport,'Visible','off') 118 set(handles.MenuHelp,'Visible','off') 119 inputfile_Callback(hObject, eventdata, handles) 115 Field=nc2struct(filename);% reads the whole field 116 if isfield(Field,'Txt') 117 msgbox_uvmat('ERROR',Field.Txt) 118 else 119 set(handles.figure1,'UserData',Field); 120 Field_input(eventdata,handles,Field); 121 end 120 122 else %master mode 121 123 set(handles.inputfile,'String','') 122 set(handles.RUN,'String','RUN')%124 % set(handles.RUN,'String','RUN')% 123 125 % load the list of previously browsed files for the upper bar menu Open 124 126 dir_perso=prefdir; … … 143 145 end 144 146 end 145 %transfer input field in slave mode 146 if exist('Field','var') && isstruct(Field) 147 Field_input(eventdata,handles,Field) 148 % if exist('haxes','var') 149 % 'TESTget' 150 % get(haxes,'Tag') 151 % Field.PlotAxes=haxes; 152 % end 153 set(hObject,'UserData',Field); 154 end 155 147 148 %% remove already opened get_field GUI with name get_field 149 if ~(exist('multiple','var') && isequal(multiple,1)) %set single occurrence 150 hget_field=findobj(allchild(0),'Name','get_field'); %hget_field(1)= new GUI 151 if length(hget_field)>1 152 delete(hget_field(2)) 153 end 154 else 155 set(hObject,'name','get_field_1') 156 end 156 157 157 158 … … 163 164 164 165 %------------------------------------------------------------------------ 165 % --- Executes on button press in browse. 166 function browse_Callback(hObject, eventdata, handles) 167 %------------------------------------------------------------------------ 168 169 %------------------------------------------------------------------------ 166 % --- Executes when a new input file name is introduced. 170 167 function inputfile_Callback(hObject, eventdata, handles) 171 168 %------------------------------------------------------------------------ … … 178 175 Field_input(eventdata,handles,Field); 179 176 end 180 181 %------------------------------------------------------------------------ 177 huvmat=findobj(allchild(0),'tag','uvmat'); 178 if ~isempty(huvmat) 179 delete(huvmat)%delete uvmat for plot reinitialisation 180 end 181 182 %------------------------------------------------------------------------ 183 % --- update the display when a new field is introduced. 182 184 function Field_input(eventdata,handles,Field) 183 185 %------------------------------------------------------------------------ … … 256 258 set(handles.coord_y_scalar,'Value',VarType{imax}.coord_y+1) 257 259 end 260 if ~isempty(VarType{imax}.coord_z) 261 set(handles.coord_z_scalar,'Value',VarType{imax}.coord_z+1) 262 end 258 263 if ~isempty(VarType{imax}.coord) 259 set(handles.coord_y_scalar,'Value',VarType{imax}.coord(1)+1) 260 if numel(VarType{imax}.coord)>=2 261 set(handles.coord_x_scalar,'Value',VarType{imax}.coord(2)+1) 264 if numel(VarType{imax}.coord)>=maxdim-2 265 set(handles.coord_z_scalar,'Value',VarType{imax}.coord(maxdim-2)+1) 262 266 end 267 if numel(VarType{imax}.coord)>=maxdim-1 268 set(handles.coord_y_scalar,'Value',VarType{imax}.coord(maxdim-1)+1) 269 end 270 if numel(VarType{imax}.coord)>=maxdim 271 set(handles.coord_x_scalar,'Value',VarType{imax}.coord(maxdim)+1) 272 end 263 273 end 264 274 end … … 272 282 function ordinate_Callback(hObject, eventdata, handles) 273 283 %------------------------------------------------------------------------ 274 %update_field(hObject, eventdata, handles)275 % A REVOIR276 284 hselect_field=get(handles.inputfile,'parent'); 277 285 Field=get(hselect_field,'UserData'); 278 % xindex=get(handles.abscissa,'Value');279 286 list=get(handles.ordinate,'String'); 280 287 yindex=get(handles.ordinate,'Value'); … … 298 305 coord_x_index=coord_x_index(coord_x_index~=0); 299 306 set(handles.abscissa,'String',[{''}; (Field.ListVarName(coord_x_index))'; (Field.ListVarName(VarIndex))']) 300 % Field.VarIndex.y=yindex;301 % set(hselect_field,'UserData',Field);302 %update_UserData(handles)303 307 304 308 %------------------------------------------------------------------------ … … 794 798 %--------------------------------------------------------- 795 799 % --- Executes on button press in RUN. 800 796 801 function RUN_Callback(hObject, eventdata, handles) 797 802 %--------------------------------------------------------- … … 799 804 index=get(handles.list_fig,'value'); 800 805 figstring=figcell{index}; 806 807 % plot requested in uvmat 801 808 if isequal(figstring,'uvmat') 809 inputfile=get(handles.inputfile,'String'); 802 810 huvmat=findobj(allchild(0),'tag','uvmat'); 803 hhuvmat=guidata(huvmat); 804 uvmat('run0_Callback',hObject,eventdata,hhuvmat); % display field in uvmat 811 if isempty(huvmat) 812 inputfile=get(handles.inputfile,'String'); 813 uvmat(inputfile) 814 else 815 hhuvmat=guidata(huvmat); 816 uvmat('run0_Callback',hObject,eventdata,hhuvmat); % display field in uvmat 817 end 818 819 % other kind of plot 805 820 else 806 huvmat=findobj(allchild(0),'tag','uvmat');807 delete(huvmat)%808 821 index=get(handles.ACTION,'Value'); 809 822 list_func=get(handles.ACTION,'UserData'); … … 1077 1090 set(handles.attributes,'String',Tabchar); 1078 1091 1079 % list_var=get(handles.dimensions,'String');1080 % val=get(handles.dimensions,'Value');1081 1082 1092 % update dimensions; 1083 1093 if isfield(Field,'ListDimName') … … 1109 1119 end 1110 1120 1121 %------------------------------------------------------------------------ 1111 1122 % --- Executes on button press in check_1Dplot. 1112 1123 function check_1Dplot_Callback(hObject, eventdata, handles) 1124 %------------------------------------------------------------------------ 1113 1125 val=get(handles.check_1Dplot,'Value'); 1114 1126 if isequal(val,0) 1115 1127 set(handles.Panel1Dplot,'Visible','off') 1116 % set(handles.scalar,'Visible','off')1117 % set(handles.ordinate,'Max',2.0)%allow multiple ordinate input option1118 % if isequal(get(handles.check_vector,'Value'),0);1119 % set(handles.coord_z_vectors_scalar,'Visible','off')1120 % end1121 1128 else 1122 1129 set(handles.Panel1Dplot,'Visible','on') 1123 % set(handles.scalar,'Visible','on') 1124 % val=get(handles.ordinate,'Value'); 1125 % val=val(1); 1126 % set(handles.ordinate,'Value',val);%suppress multiple ordinates 1127 % set(handles.ordinate,'Max',1.0);%suppress multiple ordinate input option 1128 % set(handles.coord_z_vectors_scalar,'Visible','on') 1129 end 1130 1130 end 1131 1132 %------------------------------------------------------------------------ 1131 1133 % --- Executes on button press in check_scalar. 1132 1134 function check_scalar_Callback(hObject, eventdata, handles) 1135 %------------------------------------------------------------------------ 1133 1136 val=get(handles.check_scalar,'Value'); 1134 1137 if isequal(val,0) … … 1138 1141 end 1139 1142 1140 %--------------------------- 1143 %------------------------------------------------------------------------ 1141 1144 % --- Executes on button press in check_vector. 1142 1145 function check_vector_Callback(hObject, eventdata, handles) 1146 %------------------------------------------------------------------------ 1143 1147 val=get(handles.check_vector,'Value'); 1144 1148 if isequal(val,0) … … 1148 1152 end 1149 1153 1150 %----------------------------- 1154 %------------------------------------------------------------------------ 1151 1155 function mouse_up_gui(ggg,eventdata,handles) 1156 %------------------------------------------------------------------------ 1152 1157 if isequal(get(ggg,'SelectionType'),'alt') 1153 1158 message=''; … … 1164 1169 end 1165 1170 1166 %--------------------------------------------- 1171 %------------------------------------------------------------------------ 1167 1172 % --- Executes on selection change in ACTION. 1173 %------------------------------------------------------------------------ 1168 1174 function ACTION_Callback(hObject, eventdata, handles) 1169 1175 global nb_builtin … … 1175 1181 % add a new function to the menu 1176 1182 if isequal(ACTION,'more...') 1177 % pathfct=fileparts(path_get_field);1178 % browse_name=fullfile(path_get_field,'FIELD_FCT');1179 % if length(list_path)>nb_builtin1180 % browse_name=list_path{end};% initialize browser with the path of the last introduced function1181 % end1182 1183 [FileName, PathName] = uigetfile( ... 1183 1184 {'*.m', ' (*.m)'; … … 1300 1301 end 1301 1302 end 1302 list=[' view_field';list];1303 list=['uvmat';list]; 1303 1304 set(menu_handle,'Value',1) 1304 1305 set(menu_handle,'String',list) -
trunk/src/proj_field.m
r179 r180 1377 1377 Xbound(1)=Coord{NbDim}(1)+DXinit*(min_indx-1); 1378 1378 end 1379 iz_str=':'; %default1380 1379 if NbDim==3 1381 1380 DimCell(1)=[]; %suppress z variable -
trunk/src/read_civxdata.m
r179 r180 61 61 [var,role,units,vel_type_out_cell]=varcivx_generator(FieldNames,VelType);%determine the names of constants and variables to read 62 62 [Field,vardetect,ichoice]=nc2struct(filename,var); 63 if isfield(Field,'Txt')64 return % error in file reading65 end63 % if isfield(Field,'Txt') 64 % return % error in file reading 65 % end 66 66 if vardetect(1)==0 67 67 Field.Txt=[ 'requested field not available in ' filename '/' VelType]; 68 return69 68 end 70 69 var_ind=find(vardetect); … … 89 88 Field.NbCoord=Field.nb_coord; 90 89 Field.NbDim=Field.nb_dim; 91 92 %determine the appropriate constant for time and dt for the PIV pair93 test_civ1=isequal(VelTypeOut,'civ1')||isequal(VelTypeOut,'interp1')||isequal(VelTypeOut,'filter1');94 test_civ2=isequal(VelTypeOut,'civ2')||isequal(VelTypeOut,'interp2')||isequal(VelTypeOut,'filter2');95 if test_civ196 Field.Time=double(Field.absolut_time_T0);97 Field.dt=double(Field.dt);98 elseif test_civ299 Field.Time=double(Field.absolut_time_T0_2);100 Field.dt=double(Field.dt2);101 else102 Field.Txt='the input file is not civx';103 display(Field.Txt)104 end105 90 106 91 % CivStage … … 119 104 end 120 105 106 %determine the appropriate constant for time and dt for the PIV pair 107 test_civ1=isequal(VelTypeOut,'civ1')||isequal(VelTypeOut,'interp1')||isequal(VelTypeOut,'filter1'); 108 test_civ2=isequal(VelTypeOut,'civ2')||isequal(VelTypeOut,'interp2')||isequal(VelTypeOut,'filter2'); 109 Field.Time=0; %default 110 if test_civ1 111 if isfield(Field,'absolut_time_T0') 112 Field.Time=double(Field.absolut_time_T0); 113 Field.dt=double(Field.dt); 114 else 115 Field.Txt='the input file is not civx'; 116 Field.CivStage=0; 117 Field.dt=0; 118 end 119 elseif test_civ2 120 Field.Time=double(Field.absolut_time_T0_2); 121 Field.dt=double(Field.dt2); 122 else 123 Field.Txt='the input file is not civx'; 124 Field.CivStage=0; 125 Field.dt=0; 126 end 127 128 129 121 130 %% rescale fields to pixel coordinates 122 131 if isfield(Field,'pixcmx') -
trunk/src/set_object.m
r179 r180 426 426 set(handles.XObject,'TooltipString',['XObject: x coordinate of the axis origin for the ' ObjectStyle]) 427 427 set(handles.YObject,'TooltipString',['YObject: y coordinate of the axis origin for the ' ObjectStyle]) 428 set(handles.ZMax,'TooltipString', ['ZMax: range of projection normal to the plane'])428 set(handles.ZMax,'TooltipString','ZMax: range of projection normal to the plane') 429 429 if test3D 430 430 set(handles.Theta,'Visible','on') … … 733 733 if isequal(get(hhuvmat.list_object_2,'Visible'),'on') 734 734 IndexObj_2=get(hhuvmat.list_object_2,'Value'); 735 List2=get(hhuvmat.list_object_2,'String') 735 List2=get(hhuvmat.list_object_2,'String'); 736 736 if IndexObj_2==length(List2) 737 737 IndexObj_2=[];% '...' selected … … 803 803 ObjectData.DisplayHandle_uvmat=hhuvmat.axes3; 804 804 ObjectData.DisplayHandle_view_field=[]; 805 elseif ~isfield(UvData.Object{IndexObj},'DisplayHandle_uvmat')% save the previous object graph handles805 elseif isfield(UvData.Object{IndexObj},'DisplayHandle_uvmat')% save the previous object graph handles 806 806 ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj}.DisplayHandle_uvmat; 807 807 ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj}.DisplayHandle_view_field; -
trunk/src/sub_field.m
r179 r180 289 289 SubData.ListVarName=[SubData.ListVarName {XName_1_1} {YName_1_1} {AName_1_1}]; 290 290 DimCell=[DimCell Field_1.VarDimName(ivar_C_1)]; %(TODO: check for dimension names) 291 if testX_1 292 for icell=1:numel(DimCell) 293 if isequal(DimCell{icell}{1},SubData.VarDimName{1}{1}) 294 DimCell{icell}{1}=[DimCell{icell}{1} '_1']; 295 end 296 end 297 end 291 298 SubData.VarDimName=[SubData.VarDimName DimCell]; 292 299 if isfield(Field_1,'VarAttribute') -
trunk/src/update_obj.m
r179 r180 31 31 hobject=Object_out{iobj}.DisplayHandle_uvmat;%graphic handle of object #iobj in the uvmat plot 32 32 end 33 Object_out{iobj}.DisplayHandle_uvmat=plot_object(Object_out{iobj},Object_out{IndexObj_1},hobject,'m');%update the object representation 33 Object_out{iobj}.DisplayHandle_uvmat=plot_object(Object_out{iobj},Object_out{IndexObj_1},hobject,'m');%update the object representation of Object_out{iobj} on Object_out{IndexObj_1} 34 34 end 35 35 % plot view_field -
trunk/src/uvmat.m
r179 r180 212 212 set(hObject,'Units','Normalized') 213 213 movegui(hObject,'center') 214 UvData. PosColorbar=[0.805 0.022 0.019 0.445];215 UvData. SetObjectOrigin=[-0.05 -0.03]; %position for set_object216 UvData. SetObjectSize=[0.3 0.7];217 UvData. CalOrigin=[0.95 -0.03];%position for geometry_calib (TO IMPROVE)218 UvData. CalSize=[0.28 1];214 UvData.OpenParam.PosColorbar=[0.805 0.022 0.019 0.445]; 215 UvData.OpenParam.SetObjectOrigin=[-0.05 -0.03]; %position for set_object 216 UvData.OpenParam.SetObjectSize=[0.3 0.7]; 217 UvData.OpenParam.CalOrigin=[0.95 -0.03];%position for geometry_calib (TO IMPROVE) 218 UvData.OpenParam.CalSize=[0.28 1]; 219 219 220 220 %functions for the mouse and keyboard … … 235 235 set(handles.list_object_1,'String',{'1-PLANE'}); 236 236 end 237 set(handles.Fields,'Value',1) 238 set(handles.Fields,'string',{''})%TODO: PUT IN THE GUI 237 239 238 240 %TRANSFORM menu: builtin fcts … … 305 307 set(handles.uvmat,'UserData',UvData) 306 308 %initiates menu of vector colors 307 list_menu=calc_field;308 % list_menu=[{'ima_cor'};{'black'};{'white'};list_menu(3:end)];309 set(handles.col_vec,'String',list_menu)309 % list_menu=calc_field; 310 % %list_menu=[{'ima_cor'};{'black'};{'white'};list_menu(3:end)]; 311 % set(handles.col_vec,'String',list_menu) 310 312 311 313 %check the path and date of modification of all functions in uvmat … … 346 348 display_file_name(hObject, eventdata, handles,inputfile) 347 349 testinputfield=1; 348 % else 349 % UvData.TestInputFile=0; 350 end 351 if ~isempty(Field) 352 set(handles.Fields,'Value',1) 353 set(handles.Fields,'String',{'get_field...'}) 354 testinputfield=1; 355 356 % set the colorbar position on the interface: 357 % UvData.PosColorbar=[0.805 0.022 0.019 0.445]; 358 elseif ischar(input) 359 scan_i_Callback(handles.scan_i, eventdata, handles); 360 end 350 end 351 % if ~isempty(Field) 352 % menu_str=update_menu(handles.Fields,'get_field...'); 353 % % set(handles.Fields,'Value',1) 354 % % set(handles.Fields,'String',{'get_field...'}) 355 % testinputfield=1; 356 % elseif ischar(input) 357 % scan_i_Callback(handles.scan_i, eventdata, handles); 358 % end 361 359 else 362 360 if ishandle(handles.UVMAT_title) … … 391 389 msgbox_uvmat('ERROR',errormsg) 392 390 end 393 else394 update_rootinfo(hObject,eventdata,handles);395 391 end 396 392 end … … 874 870 875 871 % set default options in menu 'Fields' 872 876 873 if testima 877 set(handles.Fields,'Value',1) % set menu to 'image'878 set(handles.Fields,'String',{'image';'get_field...';'velocity';'vort';'div';'more...'})874 % set(handles.Fields,'Value',1) % set menu to 'image' 875 % set(handles.Fields,'String',{'image';'get_field...';'velocity';'vort';'div';'more...'}) 879 876 elseif isequal(FileExt,'.nc')||isequal(FileExt,'.cdf') 880 877 Data=nc2struct(FileName,'ListGlobalAttribute','absolut_time_T0','civ'); 881 col_vec=get(handles.col_vec,'String'); 882 if ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0) 883 set(handles.Fields,'String',{'image';'get_field...';'velocity';'vort';'div';'more...'}) 884 set(handles.Fields,'Value',3) % set menu to 'velocity' 885 col_vec{1}='ima_cor'; 878 %col_vec=get(handles.col_vec,'String'); 879 if ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0)%if the new input is Civx 880 FieldList=calc_field; 881 set(handles.Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data 882 set(handles.Fields,'Value',2) % set menu to 'velocity' 883 col_vec=FieldList; 884 col_vec(1)=[];%remove 'velocity' option for vector color (must be a scalar) 886 885 else %general netcdf file (not civx) 887 886 set(handles.Fields,'Value',1) % set menu to 'get_field... 888 887 set(handles.Fields,'String',{'get_field...'}) 889 col_vec{1}='get_field...'; 888 col_vec={'get_field...'}; 889 hget_field=findobj('Name','get_field'); 890 if ~isempty(hget_field)%delete any existing get_field GUI for reinitialisation withthe new file series 891 hhget_field=guidata(hget_field); 892 if ~strcmp(get(hhget_field.inputfile,'String'),FileName)%delete any existing get_field GUI with file name different than the input 893 delete(hget_field) 894 end 895 end 890 896 end 891 897 set(handles.col_vec,'String',col_vec) … … 963 969 % search the files, recognize their type according to their name and fill the rootfile input windows 964 970 function MenuBrowse_1_Callback(hObject, eventdata, handles) 965 %------------------------------------------------------------------- 971 %------------------------------------------------------------------------ 966 972 % huvmat=get(handles.run0,'parent'); 967 973 UvData=get(handles.uvmat,'UserData'); … … 1031 1037 % --- Open again as second field the file whose name has been recorded in MenuFile_1 1032 1038 function MenuFile_1_1_Callback(hObject, eventdata, handles) 1039 % ----------------------------------------------------------------------- 1033 1040 fileinput_1=get(handles.MenuFile_1_1,'Label'); 1034 1041 display_file_name_1(hObject,eventdata,handles,fileinput_1) … … 1037 1044 % --- Open again as second field the file whose name has been recorded in MenuFile_2 1038 1045 function MenuFile_2_1_Callback(hObject, eventdata, handles) 1046 % ----------------------------------------------------------------------- 1039 1047 fileinput_1=get(handles.MenuFile_2_1,'Label'); 1040 1048 display_file_name_1(hObject,eventdata,handles,fileinput_1) … … 1043 1051 % --- Open again as second field the file whose name has been recorded in MenuFile_3 1044 1052 function MenuFile_3_1_Callback(hObject, eventdata, handles) 1053 % ----------------------------------------------------------------------- 1045 1054 fileinput_1=get(handles.MenuFile_3_1,'Label'); 1046 1055 display_file_name_1(hObject,eventdata,handles,fileinput_1) … … 1049 1058 % --- Open again as second field the file whose name has been recorded in MenuFile_4 1050 1059 function MenuFile_4_1_Callback(hObject, eventdata, handles) 1060 % ----------------------------------------------------------------------- 1051 1061 fileinput_1=get(handles.MenuFile_4_1,'Label'); 1052 1062 display_file_name_1(hObject,eventdata,handles,fileinput_1) … … 1055 1065 % --- Open again as second field the file whose name has been recorded in MenuFile_5 1056 1066 function MenuFile_5_1_Callback(hObject, eventdata, handles) 1067 % ----------------------------------------------------------------------- 1057 1068 fileinput_1=get(handles.MenuFile_5_1,'Label'); 1058 1069 display_file_name_1(hObject,eventdata,handles,fileinput_1) … … 1160 1171 % default choice of fields 1161 1172 if isequal(ext_test,'.image') 1162 set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'})1163 set(handles.Fields_1,'Value',2) % set menu to 'image'1173 % set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'}) 1174 % set(handles.Fields_1,'Value',2) % set menu to 'image' 1164 1175 elseif strcmp(FileExt_1,'.nc')||strcmp(FileExt_1,'.cdf') 1165 1176 Data=nc2struct(fileinput_1,[]); 1166 if isfield(Data,'absolut_time_T0')1167 set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'})1168 set(handles.Fields_1,'Value',4) % set menu to 'velocity'1169 else1170 set(handles.Fields_1,'Value',2) % set menu to 'get_field...'1171 set(handles.Fields_1,'String',{'';'get_field...'});1172 end1177 % if isfield(Data,'absolut_time_T0') 1178 % set(handles.Fields_1,'String',{'';'image';'get_field...';'velocity';'vort';'div';'more...'}) 1179 % set(handles.Fields_1,'Value',4) % set menu to 'velocity' 1180 % else 1181 % set(handles.Fields_1,'Value',2) % set menu to 'get_field...' 1182 % set(handles.Fields_1,'String',{'';'get_field...'}); 1183 % end 1173 1184 end 1174 1185 set(handles.SubField,'Visible','on') … … 1179 1190 % --- Called by action in RootPath_1 edit box 1180 1191 function RootPath_1_Callback(hObject,eventdata,handles) 1192 % ----------------------------------------------------------------------- 1181 1193 update_rootinfo_1(hObject,eventdata,handles) 1182 1194 … … 1184 1196 % --- Called by action in RootFile_1 edit box 1185 1197 function RootFile_1_Callback(hObject, eventdata, handles) 1198 % ----------------------------------------------------------------------- 1186 1199 update_rootinfo_1(hObject,eventdata,handles) 1187 %-----------------------------------------------------------------------1188 1200 1189 1201 %------------------------------------------------------------------------ … … 1191 1203 function FileIndex_1_Callback(hObject, eventdata, handles) 1192 1204 %------------------------------------------------------------------------ 1193 1194 1205 run0_Callback(hObject, eventdata, handles) 1195 1206 … … 1198 1209 % calibration from an xml file, then refresh current plots 1199 1210 function update_rootinfo_1(hObject,eventdata,handles) %A REVOIR 1200 1211 % ----------------------------------------------------------------------- 1201 1212 set(handles.RootPath_1,'BackgroundColor',[1 1 0])% indicate active program by yellow color 1202 1213 drawnow … … 1472 1483 set(handles.masklevel,'Value',z) 1473 1484 1474 %------------------------------------------------------------------- 1485 %------------------------------------------------------------------------ 1475 1486 % --- Executes on button press in view_xml. 1476 1487 function view_xml_Callback(hObject, eventdata, handles) 1488 %------------------------------------------------------------------------ 1477 1489 [FileName,RootPath,FileBase,FileIndices,FileExt]=read_file_boxes(handles); 1478 1490 option=get(handles.view_xml,'String'); … … 1482 1494 end 1483 1495 1484 %------------------------------------------------------------------- 1496 %------------------------------------------------------------------------ 1485 1497 % --- Executes on button press in mask_test. 1486 1498 function mask_test_Callback(hObject, eventdata, handles) 1487 %------------------------------------------------------------------- 1499 %------------------------------------------------------------------------ 1488 1500 %case of view mask selection 1489 1501 if isequal(get(handles.mask_test,'Value'),1) … … 2061 2073 %------------------------------------------------------------------------ 2062 2074 2063 %initialisation 2064 % errormsg=[]; % default error message 2075 %% initialisation 2065 2076 abstime=[]; 2066 2077 abstime_1=[]; … … 2070 2081 end 2071 2082 UvData=get(handles.uvmat,'UserData'); 2072 2073 2074 2083 if ishandle(handles.UVMAT_title) %remove title panel on uvmat 2075 2084 delete(handles.UVMAT_title) … … 2078 2087 %% determine the main input file information for action 2079 2088 FileType=[];%default 2089 if ~exist(filename,'file') 2090 errormsg=['input file ' filename ' does not exist']; 2091 return 2092 end 2093 %Ext=get(handles.FileExt,'String'); 2094 NomType=get(handles.FileIndex,'UserData'); 2095 %update the z position index 2096 nbslice_str=get(handles.nb_slice,'String'); 2097 if isequal(nbslice_str,'volume') 2098 z_index=num_j1; 2099 set(handles.z_index,'String',num2str(z_index)) 2100 else 2101 nbslice=str2num(nbslice_str); 2102 z_index=mod(num_i1-1,nbslice)+1; 2103 set(handles.z_index,'String',num2str(z_index)) 2104 end 2105 % refresh menu for save_mask if relevant 2106 masknumber=get(handles.masklevel,'String'); 2107 if length(masknumber)>=z_index 2108 set(handles.masklevel,'Value',z_index) 2109 end 2110 2111 %% read the first input field if a filename has been introduced 2080 2112 if ~isempty(filename) 2081 if ~exist(filename,'file') 2082 errormsg=['input file ' filename ' does not exist']; 2083 return 2084 end 2113 ObjectName=filename; 2114 FieldName=[];%default 2115 VelType=[];%default 2085 2116 Ext=get(handles.FileExt,'String'); 2086 NomType=get(handles.FileIndex,'UserData'); 2087 %update the z position index 2088 nbslice_str=get(handles.nb_slice,'String'); 2089 % z_index=1;%default 2090 if isequal(nbslice_str,'volume') 2091 z_index=num_j1; 2092 set(handles.z_index,'String',num2str(z_index)) 2093 else 2094 nbslice=str2num(nbslice_str); 2095 z_index=mod(num_i1-1,nbslice)+1; 2096 set(handles.z_index,'String',num2str(z_index)) 2097 end 2098 % refresh menu for save_mask if relevant 2099 masknumber=get(handles.masklevel,'String'); 2100 if length(masknumber)>=z_index 2101 set(handles.masklevel,'Value',z_index) 2102 end 2103 2104 % determine the input file type 2105 if isequal(Ext,'.nc')||isequal(Ext,'.cdf') 2117 if strcmp(Ext,'.nc')||strcmp(Ext,'.cdf') 2106 2118 FileType='netcdf'; 2119 list_fields=get(handles.Fields,'String');% list menu fields 2120 index_fields=get(handles.Fields,'Value');% selected string index 2121 FieldName= list_fields{index_fields}; % selected field 2122 if ~strcmp(FieldName,'get_field...')% read the field names on the interface get_field... 2123 VelType=setfield(handles); 2124 end 2125 if strcmp(FieldName,'velocity') 2126 list_code=get(handles.color_code,'String');% list menu fields 2127 index_code=get(handles.color_code,'Value');% selected string index 2128 if ~strcmp(list_code{index_code},'black') && ~strcmp(list_code{index_code},'white') 2129 list_code=get(handles.col_vec,'String');% list menu fields 2130 index_code=get(handles.col_vec,'Value');% selected string index 2131 ParamIn.ColorVar= list_code{index_code}; % selected field 2132 end 2133 end 2107 2134 elseif isfield(UvData,'MovieObject') 2135 ObjectName=UvData.MovieObject; 2108 2136 FileType='movie'; 2109 FieldName='image';2110 2137 elseif isequal(lower(Ext),'.avi') 2111 2138 FileType='avi'; 2112 FieldName='image';2113 2139 elseif isequal(lower(Ext),'.vol') 2114 2140 FileType='vol'; 2115 FieldName='image'; 2141 if isfield(UvData.XmlData,'Npy') && isfield(UvData.XmlData,'Npx') 2142 ParamIn.Npy=UvData.XmlData.Npy; 2143 ParamIn.Npx=UvData.XmlData.Npx; 2144 else 2145 errormsg='Npx and Npy need to be defined in the xml file for volume images .vol'; 2146 return 2147 end 2116 2148 else 2117 2149 form=imformats(Ext(2:end)); … … 2122 2154 FileType='image'; 2123 2155 end 2124 FieldName='image';2125 2156 end 2126 2157 end 2127 else 2128 FileType='netcdf'; 2129 FieldName='get_field...'; 2130 end 2131 VelType=[];%default 2132 if isequal(FileType,'netcdf') 2133 list_fields=get(handles.Fields,'String');% list menu fields 2134 index_fields=get(handles.Fields,'Value');% selected string index 2135 FieldName= list_fields{index_fields}; % selected field 2136 if ~isequal(FieldName,'get_field...')% read the field names on the interface get_field... 2137 VelType=setfield(handles); 2138 end 2139 end 2140 2141 %% choose a second field if Subfield option is 'on' 2158 ParamIn.FieldName=FieldName; 2159 ParamIn.VelType=VelType; 2160 ParamIn.GUIName='get_field'; 2161 [Field{1},ParamOut,errormsg] = read_field(ObjectName,FileType,ParamIn); 2162 if isfield(ParamOut,'Npx')&& isfield(ParamOut,'Npy') 2163 set(handles.npx,'String',num2str(ParamOut.Npx));% display image size on the interface 2164 set(handles.npy,'String',num2str(ParamOut.Npy)); 2165 end 2166 end 2167 2168 %% choose a second field if Subfield option is 'on', and if the field has changed 2169 VelType_1=[];%default 2142 2170 FieldName_1=[]; 2143 scal_color=[]; 2144 VelType_1=setfield_1(handles); 2145 % sub_value=get(handles.SubField,'Value'); 2146 FileType_1='none';%default 2171 ParamOut_1=[]; 2147 2172 if ~isempty(filename_1) 2148 % test for a constant second field (comparison with a fixed field) 2149 NomType_1=get(handles.FileIndex_1,'UserData'); 2150 Ext_1=get(handles.FileExt_1,'String'); 2151 % determine the input file type 2152 if isequal(Ext_1,'.nc')||isequal(Ext_1,'.cdf') 2153 FileType_1='netcdf'; 2154 elseif isfield(UvData,'MovieObject_1') 2155 FileType_1='movie'; 2156 FieldName_1='image'; 2157 elseif isequal(lower(Ext_1),'.avi') 2158 FileType='avi'; 2159 FieldName_1='image'; 2160 elseif isequal(lower(Ext_1),'.vol') 2161 FileType_1='vol'; 2162 FieldName_1='image'; 2163 elseif length(Ext_1)>1 2164 form=imformats(Ext_1(2:end)); 2165 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab 2166 if isequal(NomType_1,'*'); 2167 FileType_1='multimage'; 2168 else 2169 FileType_1='image'; 2170 end 2171 FieldName_1='image'; 2172 end 2173 end 2174 if ~isequal(FieldName_1,'image') 2175 list_fields=get(handles.Fields_1,'String');% list menu fields 2176 index_fields=get(handles.Fields_1,'Value');% selected string index 2177 FieldName_1= list_fields{index_fields}; % selected field 2178 if isequal(VelType_1,'*')% free veltype choice 2179 VelType_1=[]; 2180 elseif isequal(VelType_1,'"')% veltype the same as for the first field 2181 if isempty(VelType) 2182 VelType_1=[]; 2183 else 2184 VelType_1=VelType; 2185 end 2186 end 2187 end 2188 test_keepdata_1=0;% test for keeping the previous stored data if the input files are unchanged 2189 if ~isequal(NomType_1,'*')%in case of a series of files (not avi movie) 2190 if isfield(UvData,'filename_1')&& isfield(UvData,'VelType_1') && isfield(UvData,'FieldName_1') 2191 test_keepdata_1= isequal(filename_1,UvData.filename_1)&&... 2192 isequal(VelType_1,UvData.filename_1) && isequal(FieldName_1,UvData.FieldName_1); 2193 end 2194 end 2195 if test_keepdata_1 2196 Field{2}=UvData.Field_1; 2197 elseif ~exist(filename_1,'file') 2173 if ~exist(filename_1,'file') 2198 2174 errormsg=['second file ' filename_1 ' does not exist']; 2199 2175 return 2200 end 2201 end 2202 2203 %% read the input field(s) 2204 %read images 2205 if ~isempty(filename) && isequal(FieldName,'image') 2206 Npz=1;%default 2207 switch FileType 2208 case 'movie' 2209 try 2210 A=read(UvData.MovieObject,num_i1); 2211 catch 2212 errormsg=lasterr; 2176 else 2177 Name=filename_1; 2178 FieldName_1=[];%default 2179 VelType_1=[];%default 2180 Ext_1=get(handles.FileExt_1,'String'); 2181 NomType_1=get(handles.FileIndex_1,'UserData'); 2182 if isequal(Ext_1,'.nc')||isequal(Ext_1,'.cdf') 2183 FileType_1='netcdf'; 2184 elseif isfield(UvData,'MovieObject_1') 2185 Name=UvData.MovieObject_1; 2186 FileType_1='movie'; 2187 elseif isequal(lower(Ext_1),'.avi') 2188 FileType_1='avi'; 2189 elseif isequal(lower(Ext_1),'.vol') 2190 FileType_1='vol'; 2191 if isfield(UvData.XmlData_1,'Npy') && isfield(UvData.XmlData_1,'Npx') 2192 ParamIn.Npy=UvData.XmlData_1.Npy; 2193 ParamIn.Npx=UvData.XmlData_1.Npx; 2194 else 2195 errormsg='Npx and Npy need to be defined in the xml file for volume images .vol'; 2213 2196 return 2214 2197 end 2215 case 'avi' 2216 try 2217 mov=aviread(filename,num_i1); 2218 catch 2219 errormsg=lasterr; 2220 return 2198 else 2199 form=imformats(Ext_1(2:end)); 2200 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab 2201 if isequal(NomType_1,'*'); 2202 FileType_1='multimage'; 2203 else 2204 FileType_1='image'; 2205 end 2206 end 2207 end 2208 if strcmp(FileType_1,'netcdf') 2209 list_fields=get(handles.Fields_1,'String');% list menu fields 2210 index_fields=get(handles.Fields_1,'Value');% selected string index 2211 FieldName_1= list_fields{index_fields}; % selected field 2212 if ~isequal(FieldName_1,'get_field...')% read the field names on the interface get_field... 2213 VelType_1=setfield_1(handles); 2221 2214 end 2222 A=frame2im(mov(1)); 2223 case 'vol' 2224 A=imread(filename); 2225 if isfield(UvData.XmlData,'Npy') 2226 Npz=size(A,1)/UvData.XmlData.Npy; 2227 A=reshape(A',UvData.XmlData.Npx,UvData.XmlData.Npy,Npz); 2228 A=permute(A,[3 2 1]); 2215 if strcmp(VelType_1,'*')% free veltype choice 2216 VelType_1=[]; 2217 elseif strcmp(VelType_1,'"')% veltype the same as for the first field 2218 if isempty(VelType) 2219 VelType_1=[]; 2220 else 2221 VelType_1=VelType; 2222 end 2229 2223 end 2230 case 'multimage'2231 A=imread(filename,num_i1);2232 case 'image'2233 A=imread(filename);2234 end2235 npxy=size(A);2236 set(handles.npx,'String',num2str(npxy(2)));% display image size on the interface2237 set(handles.npy,'String',num2str(npxy(1)));2238 Rangx=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers2239 Rangy=[npxy(1)-0.5 0.5]; %2240 Field{1}.NbDim=2;%default2241 Field{1}.AName='image';2242 Field{1}.ListVarName={'AY','AX','A'}; %2243 if ndims(A)==32244 if Npz==1;%color2245 Field{1}.VarDimName={'AY','AX',{'AY','AX','rgb'}}; %2246 Field{1}.AY=[npxy(1)-0.5 0.5];2247 Field{1}.AX=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers2224 if strcmp(FieldName_1,'velocity') 2225 list_code=get(handles.color_code,'String');% list menu fields 2226 index_code=get(handles.color_code,'Value');% selected string index 2227 if ~strcmp(list_code{index_code},'black') && ~strcmp(list_code{index_code},'white') 2228 list_code=get(handles.col_vec,'String');% list menu fields 2229 index_code=get(handles.col_vec,'Value');% selected string index 2230 ParamIn.ColorVar= list_code{index_code}; % selected field 2231 end 2232 end 2233 end 2234 test_keepdata_1=0;% test for keeping the previous stored data if the input files are unchanged 2235 if ~isequal(NomType_1,'*')%in case of a series of files (not avi movie) 2236 if isfield(UvData,'filename_1')&& isfield(UvData,'VelType_1') && isfield(UvData,'FieldName_1') 2237 test_keepdata_1= strcmp(filename_1,UvData.filename_1) && strcmp(VelType_1,UvData.VelType_1) && strcmp(FieldName_1,UvData.FieldName_1); 2238 end 2239 end 2240 if test_keepdata_1 2241 Field{2}=UvData.Field_1; 2248 2242 else 2249 Field{1}.NbDim=3; 2250 Field{1}.ListVarName=['AZ' Field{1}.ListVarName]; 2251 Field{1}.VarDimName={'AZ','AY','AX',{'AZ','AY','AX'}}; 2252 Field{1}.AZ=[npxy(1)-0.5 0.5]; 2253 Field{1}.AY=[npxy(2)-0.5 0.5]; 2254 Field{1}.AX=[0.5 npxy(3)-0.5]; % coordinates of the first and last pixel centers 2255 end 2256 else 2257 Field{1}.VarDimName={'AY','AX',{'AY','AX'}}; % 2258 Field{1}.AY=[npxy(1)-0.5 0.5]; 2259 Field{1}.AX=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers 2260 end 2261 Field{1}.A=A; 2262 Field{1}.CoordUnit='pixel'; %used for mouse_motion 2263 end 2264 2265 %read a second image 2266 if ~isempty(filename_1) && ~test_keepdata_1 && isequal(FieldName_1,'image') 2267 switch FileType_1 2268 case 'movie' 2269 A=read(UvData.MovieObject_1,num_i1); 2270 case 'avi' 2271 mov=aviread(filename_1,num_i1); 2272 A=frame2im(mov(1)); 2273 case 'vol' 2274 A=imread(filename_1); 2275 case 'multimage' 2276 A=imread(filename_1,num_i1); 2277 case 'image' 2278 A=imread(filename_1); 2279 case 'netcdf' 2280 otherwise 2281 errormsg=['unknown input file type ' filename_1]; 2282 end 2283 npxy=size(A); 2284 set(handles.npx,'String',num2str(npxy(2)));% display image size on the interface 2285 set(handles.npy,'String',num2str(npxy(1))); 2286 Rangx=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers 2287 Rangy=[npxy(1)-0.5 0.5]; % 2288 Field{2}.AName='image'; 2289 Field{2}.ListVarName={'AY','AX','A'}; % 2290 if size(A,3)==3;%color 2291 Field{2}.VarDimName={'AY','AX',{'AY','AX','rgb'}}; % 2292 else 2293 Field{2}.VarDimName={'AY','AX',{'AY','AX'}}; % 2294 end 2295 Field{2}.AY=Rangy; 2296 Field{2}.AX=Rangx; 2297 Field{2}.A=A; 2298 Field{2}.CoordType='px'; %used for mouse_motion 2299 Field{2}.CoordUnit='px'; %used for move_mou 2300 end 2301 2302 %read ncfile(s) 2303 CivStage_1=0;%default 2304 VelType_out_1=[]; 2305 InputField={FieldName}; 2306 InputField_1={FieldName_1}; 2307 if (~isempty(filename)&& isequal(FileType,'netcdf')) || (~isempty(filename_1)&& isequal(FileType_1,'netcdf')) ; 2308 %read the velocity field(s) from netcdf rootfile(s) 2309 list_code=get(handles.col_vec,'String');% list menu fields 2310 index_code=get(handles.col_vec,'Value');% selected string index 2311 scal_color= list_code{index_code(1)}; % selected field 2312 if isequal(FieldName,'velocity')&& ~isequal(scal_color,'black') && ~isequal(scal_color,'white') 2313 InputField=[InputField scal_color]; 2314 end 2315 if isequal(FieldName_1,'velocity') && ~isequal(scal_color,'black') && ~isequal(scal_color,'white') 2316 InputField_1=[InputField_1 scal_color]; 2317 end 2318 if isequal(FileType,'netcdf') %read the first nc field 2319 if isequal(FieldName,'get_field...')% read the field names on the interface get_field. 2320 hget_field=findobj(allchild(0),'Name','get_field');%find the get_field... GUI 2321 if isempty(hget_field) 2322 hget_field= get_field(filename);%open the get_field GUI 2323 % set(hget_field,'name','get_field') 2324 elseif UvData.NewSeries% refresh the fet_field GUI for a new series 2325 delete(hget_field) 2326 hget_field= get_field(filename);%open the get_field GUI 2327 set(hget_field,'name','get_field')%rename get_field GUI for the 'slave' mode 2328 end 2329 hhget_field=guidata(hget_field); 2330 set(hhget_field.list_fig,'Value',1) 2331 set(hhget_field.list_fig,'String',{'uvmat'}) 2332 funct_list=get(hhget_field.ACTION,'UserData'); 2333 funct_index=get(hhget_field.ACTION,'Value'); 2334 funct=funct_list{funct_index};%select the current action in get_field, e;g. PLOT 2335 Field{1}=funct(hget_field); %%activate the current action selected in get_field, e;g.read the names of the variables to plot 2336 CivStage=0; 2337 VelType_out=[]; 2338 else 2339 [Field{1},VelType_out]=read_civxdata(filename,InputField,VelType); 2340 if isfield(Field{1},'Txt') 2341 errormsg=Field{1}.Txt; 2342 return 2343 end 2344 CivStage=Field{1}.CivStage; 2345 %UvData.NbDim=Field{1}.NbDim; 2346 end 2347 end 2348 if ~isempty(filename_1) && ~test_keepdata_1 && isequal(FileType_1,'netcdf') %read the second file 2349 if isequal(FieldName_1,'get_field...')% read the field names on the interface get_field. 2350 hget_field_1=findobj(allchild(0),'Name','get_field_1');%find the get_field... GUI 2351 if isempty(hget_field_1) 2352 hget_field_1= get_field(filename_1);%open the get_field GUI 2353 set(hget_field_1,'name','get_field_1') 2354 elseif UvData.NewSeries% refresh the fet_field GUI for a new series 2355 delete(hget_field_1) 2356 hget_field_1= get_field(filename);%open the get_field GUI 2357 set(hget_field_1,'name','get_field_1')%rename get_field GUI for the 'slave' mode 2358 end 2359 hhget_field_1=guidata(hget_field_1);%handles of GUI elements in get_field 2360 set(hhget_field_1.list_fig,'Value',1) 2361 set(hhget_field_1.list_fig,'String',{'uvmat'}) 2362 funct_list=get(hhget_field_1.ACTION,'UserData'); 2363 funct_index=get(hhget_field_1.ACTION,'Value'); 2364 funct=funct_list{funct_index}; 2365 Field{2}=funct(hget_field_1); %read the names of the variables to plot in the get_field GUI 2366 else 2367 [Field{2},VelType_out_1]=read_civxdata(filename_1,InputField_1,VelType_1); 2368 CivStage_1=Field{2}.CivStage; 2369 end 2370 if ~isequal(FileType,'netcdf') 2371 VelType_out=VelType_out_1; 2372 end 2373 end 2374 end 2375 2376 %store the second field for possible latter use 2377 if numel(Field)==2 2378 UvData.Field_1=Field{2}; 2243 ParamIn.FieldName=FieldName_1; 2244 ParamIn.VelType=VelType_1; 2245 ParamIn.GUIName='get_field_1'; 2246 [Field{2},ParamOut_1,errormsg] = read_field(Name,FileType_1,ParamIn); 2247 UvData.Field_1=Field{2}; %store the second field for possible use at next RUN 2248 end 2249 end 2250 end 2251 2252 %% update uvmat interface 2253 if isfield(ParamOut,'Npx') 2254 set(handles.npx,'String',num2str(ParamOut.Npx));% display image size on the interface 2255 set(handles.npy,'String',num2str(ParamOut.Npy)); 2256 elseif isfield(ParamOut_1,'Npx') 2257 set(handles.npx,'String',num2str(ParamOut_1.Npx));% display image size on the interface 2258 set(handles.npy,'String',num2str(ParamOut_1.Npy)); 2379 2259 end 2380 2260 2381 2261 %% update the display buttons for the first velocity type (first menuline) 2382 2262 veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2]; 2383 if ~isequal(FileType,'netcdf') 2384 reset_vel_type(veltype_handles) 2385 elseif isempty(VelType) && ~isequal(FieldName,'get_field...') 2386 set_veltype_display(veltype_handles,CivStage)%update the display of available velocity types for the first field 2387 if isempty(VelType_out) 2263 if ~isequal(FileType,'netcdf')|| isequal(FieldName,'get_field...') 2264 % reset_vel_type(veltype_handles) 2265 set(veltype_handles,'Visible','off') 2266 else% if isempty(ParamOut.VelType) && ~isequal(FieldName,'get_field...') 2267 set_veltype_display(veltype_handles,ParamOut.CivStage)%update the display of available velocity types for the first field 2268 if isempty(ParamOut.VelType) 2388 2269 reset_vel_type(veltype_handles) 2389 2270 else 2390 handle1=eval(['handles.' VelType_out]);2271 handle1=eval(['handles.' ParamOut.VelType]); 2391 2272 reset_vel_type(veltype_handles,handle1) 2392 2273 end 2393 2274 end 2275 field_index=strcmp(ParamOut.FieldName,ParamOut.FieldList); 2276 set(handles.Fields,'String',ParamOut.FieldList); %update the field menu 2277 set(handles.Fields,'Value',find(field_index,1)) 2394 2278 2395 2279 %% update the display buttons for the second velocity type (second menuline) 2396 veltype_handles_1=[handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1]; 2397 if ~isequal(FileType_1,'netcdf') 2398 reset_vel_type(veltype_handles_1) 2399 elseif isempty(VelType_1) && ~isequal(FieldName_1,'get_field...') 2400 set_veltype_display(veltype_handles_1,CivStage_1)%update the display of available velocity types for the first field 2401 if isempty(VelType_out_1) 2402 reset_vel_type(veltype_handles_1) 2403 else 2404 handle1=eval(['handles.' VelType_out_1 '_1']); 2405 reset_vel_type(veltype_handles_1,handle1) 2406 end 2280 if ~isempty(filename_1) 2281 veltype_handles_1=[handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1]; 2282 if ~isequal(FileType_1,'netcdf')|| isequal(FieldName_1,'get_field...') 2283 set(veltype_handles_1,'Visible','off') 2284 %reset_vel_type(veltype_handles_1) 2285 else %if isempty(VelType_1) && ~isequal(FieldName_1,'get_field...') 2286 set_veltype_display(veltype_handles_1,ParamOut_1.CivStage)%update the display of available velocity types for the first field 2287 if isempty(ParamOut_1.VelType) 2288 reset_vel_type(veltype_handles_1) 2289 else 2290 handle1=eval(['handles.' ParamOut_1.VelType '_1']); 2291 reset_vel_type(veltype_handles_1,handle1) 2292 end 2293 end 2294 field_index=strcmp(ParamOut_1.FieldName,ParamOut_1.FieldList); 2295 set(handles.Fields_1,'String',ParamOut_1.FieldList); %update the field menu 2296 set(handles.Fields_1,'Value',find(field_index,1)) 2407 2297 end 2408 2298 … … 2432 2322 end 2433 2323 2434 %multislice case 2435 % if ~isempty(filename) &&(~isfield(UvData,'NbDim') || isequal(UvData.NbDim,2))&&...%2D case 2436 % isfield(UvData,'XmlData') && isfield(UvData.XmlData,'GeometryCalib')&& isfield(UvData.XmlData.GeometryCalib,'SliceCoord') 2437 % siz=size(UvData.XmlData.GeometryCalib.SliceCoord); 2438 % end 2439 2440 %store the current open names, fields and vel types in uvmat interface 2441 UvData.filename=filename; 2324 %% store the current open names, fields and vel types in uvmat interface 2442 2325 UvData.filename_1=filename_1; 2443 UvData.VelType=VelType; 2444 UvData.VelType_1=VelType_1; 2445 UvData.FieldName=FieldName; 2446 UvData.FieldName_1=FieldName_1; 2447 if ~isempty(scal_color) 2448 UvData.CName=scal_color; 2449 end 2450 2451 %% coordinate transform or user fct 2326 UvData.VelType_1=[];%default 2327 UvData.FieldName_1=[]; 2328 if isfield(ParamOut_1,VelType) 2329 UvData.VelType_1=ParamOut_1.VelType; 2330 end 2331 if isfield(ParamOut_1,FieldName) 2332 UvData.FieldName_1=ParamOut_1.FieldName; 2333 end 2334 2335 %% apply coordinate transform or other user fct 2452 2336 XmlData=[];%default 2453 2337 if isfield(UvData,'XmlData')%use geometry calib recorded from the ImaDoc xml file as first priority … … 2480 2364 2481 2365 %% calculate scalar 2482 if isequal(FileType,'netcdf') && ~isequal( FieldName,'get_field...')%2483 Field{1}=calc_field( InputField,Field{1});2484 end 2485 if length(Field)==2 && ~test_keepdata_1 && isequal(FileType_1,'netcdf') && ~isequal( FieldName_1,'get_field...')2486 Field{2}=calc_field( InputField_1,Field{2});2366 if isequal(FileType,'netcdf') && ~isequal(ParamOut.CivStage,0)%&&~isempty(FieldName)% 2367 Field{1}=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],Field{1}); 2368 end 2369 if length(Field)==2 && ~test_keepdata_1 && isequal(FileType_1,'netcdf') && ~isequal(ParamOut_1.FieldName,'get_field...')%&&~isempty(FieldName_1) 2370 Field{2}=calc_field([{ParamOut_1.FieldName} {ParamOut_1.ColorVar}],Field{2}); 2487 2371 end 2488 2372 … … 2494 2378 end 2495 2379 2496 %% test 3D , default projection menuplane and typical mesh (needed to menuopen set_object)2380 %% get bounds and mesh (needed for mouse action and to open set_object) 2497 2381 test_x=0; 2498 2382 test_z=0;% test for unstructured z coordinate 2499 2383 [UvData.Field,errormsg]=check_field_structure(UvData.Field); 2500 2384 if ~isempty(errormsg) 2501 errormsg=['error in uvmat/r un0_Callback/check_field_structure: ' errormsg];2385 errormsg=['error in uvmat/refresh_field/check_field_structure: ' errormsg]; 2502 2386 return 2503 2387 end 2504 [CellVarIndex,NbDim,VarType]=find_field_indices(UvData.Field); 2388 [CellVarIndex,NbDim,VarType,errormsg]=find_field_indices(UvData.Field); 2389 if ~isempty(errormsg) 2390 errormsg=['error in uvmat/refresh_field/find_field_indices: ' errormsg]; 2391 return 2392 end 2505 2393 [NbDim,imax]=max(NbDim); 2506 2394 if ~isempty(VarType{imax}.coord_x) && ~isempty(VarType{imax}.coord_y) %unstructured coordinates … … 2558 2446 UvData.Field.YMin=YMin; 2559 2447 2560 %% create a default projection menuplane2561 UvData.Object{1}.Style='plane';%main plotting plane2562 UvData.Object{1}.ProjMode='projection';%main plotting plane2563 UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat2564 2565 2448 2566 2449 %% 3D case (menuvolume) 2567 2450 if NbDim==3% && UvData.NewSeries 2568 2451 test_set_object=1; 2569 hset_object=findobj(allchild(0),'tag','set_object'); 2452 hset_object=findobj(allchild(0),'tag','set_object');% look for the set_object GUI 2570 2453 ZBounds(1)=UvData.Field.ZMin; %minimum for the Z slider 2571 2454 ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider 2572 if ~isempty(hset_object) 2573 hhset_object=guidata(hset_object);2574 ZBounds_old(1)=get(hhset_object.z_slider,'Min');2575 ZBounds_old(2)=get(hhset_object.z_slider,'Max');2576 if isequal(ZBounds_old,ZBounds)2577 test_set_object=0; 2578 else2579 delete( test_set_object);2580 end2581 end 2582 if test_set_object% reinitiate set_object2583 delete_object(1); 2455 if ~isempty(hset_object) %if set_object is detected 2456 % hhset_object=guidata(hset_object); 2457 % % ZBounds_old(1)=get(hhset_object.z_slider,'Min'); 2458 % % ZBounds_old(2)=get(hhset_object.z_slider,'Max'); 2459 % % if isequal(ZBounds_old,ZBounds) 2460 % test_set_object=0;% do not refresh the GUI set_object 2461 % else 2462 delete(hset_object);% delete the GUI set_object if it does not fit 2463 % end 2464 end 2465 if test_set_object% reinitiate the GUI set_object 2466 delete_object(1);% delete the current projection object in the list UvData.Object, delete its graphic representations and update the list displayed in handles.list_object_1 and 2 2584 2467 UvData.Object{1}.Style='plane';%main plotting plane 2585 2468 UvData.Object{1}.ProjMode='projection';%main plotting plane … … 2597 2480 set_object(UvData.Object{1},PlotHandles,ZBounds); 2598 2481 set(handles.list_object_1,'Value',1); 2482 set(handles.list_object_1,'String',{'1-PLANE'}); 2483 set(handles.edit_object,'Value',1)% put the plane in edit mode to enable the z cursor 2484 edit_object_Callback([],[], handles) 2599 2485 end 2600 2486 %multilevel case (single menuplane in a 3D space) … … 2615 2501 UvData.Object{1}.ZObject=UvData.ZIndex; 2616 2502 end 2503 else 2504 % create a default projection menuplane 2505 UvData.Object{1}.Style='plane';%main plotting plane 2506 UvData.Object{1}.ProjMode='projection';%main plotting plane 2507 UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat 2508 set(handles.list_object_1,'Value',1); 2509 set(handles.list_object_1,'String',{'1-PLANE'}); 2617 2510 end 2618 2511 if ~isfield(UvData.Object{1},'plotaxes') 2619 UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis 2620 set(handles.list_object_1,'Value',1); 2621 set(handles.list_object_1,'String',{'1-PLANE'}); 2512 UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis 2622 2513 end 2623 2514 … … 2640 2531 PlotParam{1}=read_plot_param(handles);%read plotting parameters on the uvmat interfac 2641 2532 keeplim(1)=get(handles.FixedLimits,'Value');% test for fixed graph limits 2642 PosColorbar{1}=UvData. PosColorbar;%prescribe the colorbar position on the uvmat interface2533 PosColorbar{1}=UvData.OpenParam.PosColorbar;%prescribe the colorbar position on the uvmat interface 2643 2534 2644 2535 % second projection object (view_field display) … … 2729 2620 hget_field=findobj(allchild(0),'name','get_field'); 2730 2621 if isempty(hget_field) 2731 get_field([],ObjectData)% the projected field cannot be automatically plotted: use get_field to specify the variablesdelete(hget_field) 2732 else 2733 errormsg='The field defined by get_field cannot be plotted'; 2734 return 2622 get_field(filename)% the projected field cannot be automatically plotted: use get_field to specify the variablesdelete(hget_field) 2735 2623 end 2624 errormsg='The field defined by get_field cannot be plotted'; 2625 return 2736 2626 end 2737 2627 end … … 2853 2743 set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) ' m' UvData.TimeUnit] ) 2854 2744 end 2855 end2856 2857 %% update the input file name in the get_field GUI2858 if isequal(FieldName,'get_field...')2859 set(hhget_field.inputfile,'String',filename)2860 Tabchar={''};%default2861 Tabcell=[];2862 if isfield(Field{1},'ListGlobalAttribute')&& ~isempty(Field{1}.ListGlobalAttribute)2863 for iline=1:length(Field{1}.ListGlobalAttribute)2864 Tabcell{iline,1}=Field{1}.ListGlobalAttribute{iline};2865 if isfield(Field{1}, Field{1}.ListGlobalAttribute{iline})2866 eval(['val=Field{1}.' Field{1}.ListGlobalAttribute{iline} ';'])2867 if ischar(val);2868 Tabcell{iline,2}=val;2869 else2870 Tabcell{iline,2}=num2str(val);2871 end2872 end2873 end2874 if ~isempty(Tabcell)2875 Tabchar=cell2tab(Tabcell,'=');2876 Tabchar=[{''};Tabchar];2877 end2878 end2879 set(hhget_field.attributes,'String',Tabchar);%update list of global attributes in get_field2880 end2881 if isequal(FieldName_1,'get_field...')2882 set(hhget_field_1.inputfile,'String',filename_1)2883 Tabchar={''};%default2884 Tabcell=[];2885 if isfield(Field{2},'ListGlobalAttribute')&& ~isempty(Field{2}.ListGlobalAttribute)2886 for iline=1:length(Field{2}.ListGlobalAttribute)2887 Tabcell{iline,1}=Field{2}.ListGlobalAttribute{iline};2888 if isfield(Field{2}, Field{2}.ListGlobalAttribute{iline})2889 eval(['val=Field{2}.' Field{2}.ListGlobalAttribute{iline} ';'])2890 if ischar(val);2891 Tabcell{iline,2}=val;2892 else2893 Tabcell{iline,2}=num2str(val);2894 end2895 end2896 end2897 if ~isempty(Tabcell)2898 Tabchar=cell2tab(Tabcell,'=');2899 Tabchar=[{''};Tabchar];2900 end2901 end2902 set(hhget_field_1.attributes,'String',Tabchar);%update list of global attributes in get_field2903 2745 end 2904 2746 … … 3713 3555 [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface with action on haxes, 3714 3556 % associate the set_object interface handle to the plotting axes 3715 if isfield(UvData ,'SetObjectOrigin')3557 if isfield(UvData.OpenParam,'SetObjectOrigin') 3716 3558 pos_uvmat=get(huvmat,'Position'); 3717 pos_set_object(1:2)=UvData. SetObjectOrigin + pos_uvmat(1:2);3718 pos_set_object(3:4)=UvData. SetObjectSize .* pos_uvmat(3:4);3559 pos_set_object(1:2)=UvData.OpenParam.SetObjectOrigin + pos_uvmat(1:2); 3560 pos_set_object(3:4)=UvData.OpenParam.SetObjectSize .* pos_uvmat(3:4); 3719 3561 set(hset_object,'Position',pos_set_object) 3720 3562 end … … 4365 4207 UvData.MouseAction='none'; 4366 4208 set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7]) 4209 hset_object=findobj(allchild(0),'tag','set_object');% look for the set_object GUI 4210 if ~isempty(hset_object) 4211 delete(hset_object)% delete the current GUI set_object 4212 end 4367 4213 end 4368 4214 set(handles.uvmat,'UserData',UvData); … … 4410 4256 function update_object(handles,IndexObj,option,ObjectName) 4411 4257 %------------------------------------------------------------------------ 4412 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 4258 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 4413 4259 if numel(UvData.Object)<IndexObj; 4414 4260 return … … 4420 4266 end 4421 4267 ZBounds=0; % default 4422 if isfield(UvData,'ZMin') && isfield(UvData,'ZMax')4423 ZBounds(1)=UvData.ZMin; %minimum for the Z slider4424 ZBounds(2)=UvData.ZMax;%maximum for the Z slider4425 4268 if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax') 4269 ZBounds(1)=UvData.Field.ZMin; %minimum for the Z slider 4270 ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider 4271 end 4426 4272 hset_object=findobj(allchild(0),'tag','set_object'); 4427 4273 if ~isempty(hset_object) 4428 4274 delete(hset_object)% delete existing version of set_object 4275 end 4276 edit_test=get(handles.edit_object,'Value'); 4277 if edit_test 4278 ObjectData.enable_plot=1; 4279 else 4280 if isfield(ObjectData,'enable_plot') 4281 ObjectData=rmfield(ObjectData,'enable_plot'); 4282 end 4429 4283 end 4430 4284 hset_object=set_object(ObjectData,[],ZBounds);% call the set_object interface, … … 4434 4288 if option==1%length(UvData.Object)>= IndexObj && isfield(UvData.Object{IndexObj},'plotaxes')&& ishandle(UvData.Object{IndexObj}.plotaxes) 4435 4289 PlotHandles=handles; 4436 % UvData.Object{IndexObj}.plotaxes=handles.axes3;4437 4290 else 4438 4291 hview_field=findobj(allchild(0),'tag','view_field'); … … 4441 4294 end 4442 4295 PlotHandles=guidata(hview_field); 4443 % hview_field=view_field(ProjData);4444 % hhviewfield=guidata(hviewfield);4445 % UvData.Object{IndexObj}.plotaxes=hhviewfield.axes3;4446 4296 end 4447 4297 if ~isempty(ProjData) 4448 plot_field(ProjData,PlotHandles.axes3,PlotHandles);4298 plot_field(ProjData,PlotHandles.axes3,PlotHandles); 4449 4299 end 4450 4300 set(handles.uvmat,'UserData',UvData) … … 4457 4307 end 4458 4308 elseif isequal(get(hother(iobj),'Type'),'image') 4459 4460 4461 4309 Acolor=get(hother(iobj),'CData'); 4310 Acolor(:,:,1)=zeros(size(Acolor,1),size(Acolor,2)); 4311 set(hother(iobj),'CData',Acolor); 4462 4312 else 4463 4313 set(hother(iobj),'Color','b') 4464 4314 end 4465 4315 set(hother(iobj),'Selected','off') … … 4467 4317 hother=findobj('Tag','DeformPoint'); 4468 4318 set(hother,'Color','b'); 4469 set(hother,'Selected','off') 4319 set(hother,'Selected','off') 4470 4320 if isfield(ObjectData,'DisplayHandle_uvmat') 4471 % for iview=1:length(ObjectData.HandlesDisplay) 4472 if ishandle(ObjectData.DisplayHandle_uvmat) 4473 uistack(ObjectData.DisplayHandle_uvmat,'top') 4474 linetype=get(ObjectData.DisplayHandle_uvmat,'Type'); 4475 if isequal(linetype,'line') 4476 set(ObjectData.DisplayHandle_uvmat,'Color','m'); %set the selected object to magenta color 4477 elseif isequal(linetype,'rectangle') 4478 set(ObjectData.DisplayHandle_uvmat,'EdgeColor','m'); %set the selected object to magenta color 4479 elseif isequal(linetype,'patch') 4480 set(ObjectData.DisplayHandle_uvmat,'FaceColor','m'); %set the selected object to magenta color 4481 end 4482 SubObjectData=get(ObjectData.DisplayHandle_uvmat,'UserData'); 4483 if isfield(SubObjectData,'SubObject') & ishandle(SubObjectData.SubObject) 4484 uistack(SubObjectData.SubObject,'top') 4485 for iobj=1:length(SubObjectData.SubObject) 4486 hsub=SubObjectData.SubObject(iobj); 4487 if isequal(get(hsub,'Type'),'rectangle') 4488 set(hsub,'EdgeColor','m'); %set the selected object to magenta color 4489 elseif isequal(get(hsub,'Type'),'image') 4490 Acolor=get(hsub,'CData'); 4491 Acolor(:,:,1)=Acolor(:,:,3); 4492 set(hsub,'CData',Acolor); 4493 else 4494 set(hsub,'Color','m') 4495 end 4321 if ishandle(ObjectData.DisplayHandle_uvmat) 4322 uistack(ObjectData.DisplayHandle_uvmat,'top') 4323 linetype=get(ObjectData.DisplayHandle_uvmat,'Type'); 4324 if isequal(linetype,'line') 4325 set(ObjectData.DisplayHandle_uvmat,'Color','m'); %set the selected object to magenta color 4326 elseif isequal(linetype,'rectangle') 4327 set(ObjectData.DisplayHandle_uvmat,'EdgeColor','m'); %set the selected object to magenta color 4328 elseif isequal(linetype,'patch') 4329 set(ObjectData.DisplayHandle_uvmat,'FaceColor','m'); %set the selected object to magenta color 4330 end 4331 SubObjectData=get(ObjectData.DisplayHandle_uvmat,'UserData'); 4332 if isfield(SubObjectData,'SubObject') & ishandle(SubObjectData.SubObject) 4333 uistack(SubObjectData.SubObject,'top') 4334 for iobj=1:length(SubObjectData.SubObject) 4335 hsub=SubObjectData.SubObject(iobj); 4336 if isequal(get(hsub,'Type'),'rectangle') 4337 set(hsub,'EdgeColor','m'); %set the selected object to magenta color 4338 elseif isequal(get(hsub,'Type'),'image') 4339 Acolor=get(hsub,'CData'); 4340 Acolor(:,:,1)=Acolor(:,:,3); 4341 set(hsub,'CData',Acolor); 4342 else 4343 set(hsub,'Color','m') 4496 4344 end 4497 4345 end 4498 if isfield(SubObjectData,'DeformPoint') & ishandle(SubObjectData.DeformPoint) 4499 set(SubObjectData.DeformPoint,'Color','m') 4500 end 4501 end 4502 % end 4346 end 4347 if isfield(SubObjectData,'DeformPoint') & ishandle(SubObjectData.DeformPoint) 4348 set(SubObjectData.DeformPoint,'Color','m') 4349 end 4350 end 4351 % end 4503 4352 end 4504 4353 pause(0.1) … … 4545 4394 end 4546 4395 4547 4396 %------------------------------------------------------------------------ 4548 4397 % -------------------------------------------------------------------- 4549 4398 function MenuExportMovie_Callback(hObject, eventdata, handles) … … 4631 4480 msgbox_uvmat('CONFIRMATION',{['movie ' aviname ' created '];['with ' num2str(imax) ' frames']}) 4632 4481 4633 4634 % ------------------------------------------------------------------ 4482 %------------------------------------------------------------------------ 4635 4483 function MenuCalib_Callback(hObject, eventdata, handles) 4484 %------------------------------------------------------------------------ 4636 4485 4637 4486 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface … … 4651 4500 [FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles); 4652 4501 set(handles.view_xml,'Backgroundcolor',[1 1 0])%indicate the reading of the current xml file by geometry_calib 4653 if isfield(UvData ,'CalOrigin')4502 if isfield(UvData.OpenParam,'CalOrigin') 4654 4503 pos_uvmat=get(handles.uvmat,'Position'); 4655 pos_cal(1)=pos_uvmat(1)+UvData. CalOrigin(1)*pos_uvmat(3);4656 pos_cal(2)=pos_uvmat(2)+UvData. CalOrigin(2)*pos_uvmat(4);4657 pos_cal(3:4)=UvData. CalSize .* pos_uvmat(3:4);4504 pos_cal(1)=pos_uvmat(1)+UvData.OpenParam.CalOrigin(1)*pos_uvmat(3); 4505 pos_cal(2)=pos_uvmat(2)+UvData.OpenParam.CalOrigin(2)*pos_uvmat(4); 4506 pos_cal(3:4)=UvData.OpenParam.CalSize .* pos_uvmat(3:4); 4658 4507 end 4659 4508 geometry_calib(FileName,pos_cal);% call the geometry_calib interface … … 4661 4510 set(handles.MenuCalib,'checked','on')% indicate that MenuCalib is activated, test used by mouse action 4662 4511 4663 4664 % ------------------------------------------------------------------ 4512 %------------------------------------------------------------------------ 4665 4513 function MenuMask_Callback(hObject, eventdata, handles) 4514 %------------------------------------------------------------------------ 4666 4515 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 4667 4516 ListObj=UvData.Object; … … 4766 4615 end 4767 4616 4768 %set(handles.uvmat,'UserData',UvData); 4769 4770 % ------------------------------------------------------------------ 4617 %------------------------------------------------------------------------ 4771 4618 %-- open the GUI set_grid.fig to create grid 4772 4619 function MenuGrid_Callback(hObject, eventdata, handles) 4620 %------------------------------------------------------------------------ 4773 4621 %UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 4774 4622 … … 4786 4634 %set(handles.uvmat,'UserData',UvData); 4787 4635 4788 %---------------------------------------------------------------- 4636 %------------------------------------------------------------------------ 4789 4637 % open the GUI 'series' 4790 %----------------------------------------------------------------4791 4638 function MenuSeries_Callback(hObject, eventdata, handles) 4792 %------------------------------------------------------------------- 4639 %------------------------------------------------------------------------ 4793 4640 series; %first display of the GUI to fill waiting time 4794 4641 [param.FileName]=read_file_boxes(handles); … … 4835 4682 series(param); %run the series interface 4836 4683 4837 % 4684 %------------------------------------------------------------------------ 4838 4685 % -- open the GUI civ.fig for civx (PIV) 4839 % ------------------------------------------------------------------4840 4686 function MenuPIV_Callback(hObject, eventdata, handles) 4687 %------------------------------------------------------------------------ 4841 4688 4842 4689 [FileName,RootPath,filebase,FileIndices,ext,SubDir]=read_file_boxes(handles); … … 4874 4721 param.ImaExt=ext; 4875 4722 civ(param);% interface de civ(not in the uvmat file) 4876 4877 % 4723 4724 %------------------------------------------------------------------------ 4878 4725 function MenuTools_Callback(hObject, eventdata, handles) 4879 4880 % ------------------------------------------------------------------ 4726 %------------------------------------------------------------------------ 4727 4728 %------------------------------------------------------------------------ 4881 4729 function MenuEditObject_Callback(hObject, eventdata, handles) 4730 %------------------------------------------------------------------------ 4882 4731 set(handles.edit_object,'Value',1) 4883 4732 edit_Callback(hObject, eventdata, handles) 4884 4733 4885 %------------------------------------------------------------------------ --4734 %------------------------------------------------------------------------ 4886 4735 function enable_transform(handles,state) 4736 %------------------------------------------------------------------------ 4887 4737 set(handles.transform_fct,'Visible',state) 4888 4738 set(handles.TRANSFORM_txt,'Visible',state) … … 4897 4747 function MenuEditVectors_Callback(hObject, eventdata, handles) 4898 4748 %------------------------------------------------------------------------ 4899 % set(handles.MenuEditVectors,'checked','on')4900 4749 set(handles.edit_vect,'Visible','on') 4901 4750 set(handles.edit_vect,'Value',1) 4902 4751 edit_vect_Callback(hObject, eventdata, handles) 4903 4752 4904 % -------------------------------------------------------------------- 4753 % ----------------------------------------------------------------------- 4905 4754 function Menupoints_Callback(hObject, eventdata, handles) 4755 %------------------------------------------------------------------------ 4906 4756 data.Style='points'; 4907 4757 data.ProjMode='projection';%default 4908 4758 create_object(data,handles) 4909 4759 4910 % -------------------------------------------------------------------- 4760 % ----------------------------------------------------------------------- 4911 4761 function Menuline_Callback(hObject, eventdata, handles) 4912 % set(handles.create,'Visible','on') 4913 % set(handles.create,'Value',1) 4914 % LINE_Callback(hObject,eventdata,handles) 4762 %------------------------------------------------------------------------ 4915 4763 data.Style='line'; 4916 4764 data.ProjMode='projection';%default … … 4954 4802 create_object(data,handles) 4955 4803 4956 % 4804 %------------------------------------------------------------------------ 4957 4805 function Menuplane_Callback(hObject, eventdata, handles) 4806 %------------------------------------------------------------------------ 4958 4807 data.Style='plane'; 4959 4808 data.ProjMode='projection';%default … … 4961 4810 create_object(data,handles) 4962 4811 4963 % 4812 %------------------------------------------------------------------------ 4964 4813 function Menuvolume_Callback(hObject, eventdata, handles) 4814 %------------------------------------------------------------------------ 4965 4815 data.Style='volume'; 4966 4816 data.ProjMode='interp';%default … … 5109 4959 end 5110 4960 5111 4961 %------------------------------------------------------------------------ 5112 4962 % --- Executes on button press in delete_object. 5113 4963 function delete_object_Callback(hObject, eventdata, handles) 4964 %------------------------------------------------------------------------ 5114 4965 IndexObj=get(handles.list_object_2,'Value'); 5115 5116 5117 4966 if IndexObj>1 4967 delete_object(IndexObj) 4968 end 5118 4969 5119 4970 -
trunk/src/view_field.m
r158 r180 74 74 hhuvmat=guidata(huvmat); 75 75 set(hhuvmat.list_object_2,'Visible','on') 76 set(hhuvmat.view_field_title,'Visible','on') 76 77 % handles_mouse.create=hhuvmat.create; 77 78 handles_mouse.edit=hhuvmat.edit_object;
Note: See TracChangeset
for help on using the changeset viewer.