- Timestamp:
- May 15, 2011, 11:17:08 PM (14 years ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/check_functions.m
r204 r252 34 34 'civ_3D';... function associated with the interface 'civ_3D.fig' for PIV in volume (in progress) 35 35 'civ_3D.fig';... 36 'civ_uvmat';...% civ programs, Matlab version (called by civ.m, option Civuvmat) 36 37 'close_fig';...% function activated when a figure is closed 37 38 'copyfields';...% copy fields between two matlab structures … … 39 40 'create_grid.fig';...% GUI corresponding to create_grid.m 40 41 'dataview';...% function for scanning directories in a campaign 42 'dataview.fig';...% GUI corresponding to dataview 41 43 'delete_object';...%delete a projection object, defined by its index in the Uvmat list or by its graphic handle 42 44 'editxml';...%display and edit xml files using a xls schema … … 61 63 'nc2struct';...% transform a netcdf file in a corresponding matlab structure 62 64 'peaklock';...% 65 'phys_XYZ';...% transform coordiantes from pixels to phys 66 'pivlab';...% PIV program (Civ1), called by civ_uvmat 67 'px_XYZ';...% transform coordiantes from phys to pixels 63 68 'plot_field';...%displays a vector field and/or scalar or images 64 69 'plot_object';...%draws a projection object (points, line, plane...) … … 70 75 'read_xls';...%read excel files containing the list of the experiments 71 76 'reinit';...% suppress the personal parameter file 'uvmat_perso.mat' 72 'RUN_FIX';...% fix velocity fields73 77 'RUN_STLIN';...% combine 2 displacement fields for stereo PIV 74 78 'series';...% master function for analysis field series, with interface 'series.fig' -
trunk/src/civ.m
r251 r252 62 62 % Update handles structure 63 63 guidata(hObject, handles); 64 set(hObject,'WindowButton UpFcn',{'mouse_up_GUI',handles}) %set mouse action (zoom on uicontrols)64 set(hObject,'WindowButtonDownFcn',{'mouse_alt_gui',handles}) % allows mouse action with right button (zoom for uicontrol display) 65 65 %default initial parameters 66 66 filebase=''; % root file name ('filebase'.civ) 67 67 ext=[]; 68 68 set(handles.CivAll,'String',{'CivX';'CivAll';'CivUvmat'}) 69 set(handles.subdomain_patch1,'String','1500')% default values 70 set(handles.subdomain_patch2,'String','1500') 71 delete(handles.grid_patch1) 72 delete(handles.get_gridpatch1) 73 delete(handles.grid_patch2) 74 delete(handles.get_gridpatch2) 75 69 76 %default input parameters: 70 77 num_i1=1; % set of field i numbers … … 447 454 %------------------------------------------------------------------------ 448 455 set(handles.compare,'Visible','on') 449 %ext_ima=get(handles.ImaExt,'String');450 456 ext_ima='';%default 451 457 nom_type_ima=[];%default … … 472 478 field_count=browse.num_i1;% get an image index type already determined by an input file 473 479 end 480 set(handles.civ,'UserData',[]); %refresh list of previous civ files (for STATUS) 474 481 475 482 %default first_i and j and increments … … 1161 1168 mode='displacement'; 1162 1169 else 1163 mode_list=get(handles.mode,'String') ;1164 mode_value=get(handles.mode,'Value') ;1170 mode_list=get(handles.mode,'String') 1171 mode_value=get(handles.mode,'Value') 1165 1172 mode=mode_list{mode_value}; 1166 1173 end … … 2158 2165 Param.Civ2=par_civ2; 2159 2166 end 2167 if box_test(5)==1 2168 fix2.WarnFlags=[]; 2169 if get(handles.vec_Fmin2_2,'Value') 2170 fix2.WarnFlags=[fix2.WarnFlags -2]; 2171 end 2172 if get(handles.vec_F4,'Value') 2173 fix2.WarnFlags=[fix2.WarnFlags 4]; 2174 end 2175 if get(handles.vec_F3_2,'Value') 2176 fix2.WarnFlags=[fix2.WarnFlags 3]; 2177 end 2178 fix2.LowerBoundCorr=thresh_vec2C; 2179 if get(handles.inf_sup2,'Value') 2180 fix2.UppperBoundVel=thresh_vel2; 2181 else 2182 fix2.LowerBoundVel=thresh_vel2; 2183 end 2184 if get(handles.get_mask_fix2,'Value') 2185 fix2.MaskName=maskname; 2186 end 2187 Param.Fix2=fix2; 2188 end 2160 2189 [Data,erromsg]=civ_uvmat(Param,filecell.nc.civ1{ifile,j}); 2161 2190 if isempty(errormsg) … … 2509 2538 [xx,msg1]=mkdir(subdir_civ1_new); 2510 2539 cd(currentdir); 2511 if ~strcmp l(msg1,'')2540 if ~strcmp(msg1,'') 2512 2541 msgbox_uvmat('ERROR',['cannot create ' subdir_civ1_new ': ' msg1]) 2513 2542 cd(currentdir) … … 3250 3279 function get_mask_civ1_Callback(hObject, eventdata, handles) 3251 3280 %------------------------------------------------------------------------ 3252 maskval=get(handles.get_mask_civ1,'Value') ;3281 maskval=get(handles.get_mask_civ1,'Value') 3253 3282 if isequal(maskval,0) 3254 3283 set(handles.mask_civ1,'String','') … … 3507 3536 str=num2str(num); 3508 3537 end 3509 3510 % %------------------------------------------------------------------------3511 % function mask_civ1_Callback(hObject, eventdata, handles)3512 % %------------------------------------------------------------------------3513 % set(handles.mask_civ1,'UserData',[])3514 % set(handles.mask_civ1,'String','')3515 %3516 % %------------------------------------------------------------------------3517 % function mask_civ2_Callback(hObject, eventdata, handles)3518 % %------------------------------------------------------------------------3519 % set(handles.mask_civ2,'UserData',[])3520 % set(handles.mask_civ2,'String','')3521 %3522 % %------------------------------------------------------------------------3523 % function mask_fix1_Callback(hObject, eventdata, handles)3524 % %------------------------------------------------------------------------3525 % set(handles.mask_fix1,'UserData',[])3526 % set(handles.mask_fix1,'String','')3527 %3528 % %------------------------------------------------------------------------3529 % function mask_fix2_Callback(hObject, eventdata, handles)3530 % %------------------------------------------------------------------------3531 % set(handles.mask_fix2,'UserData',[])3532 % set(handles.mask_fix2,'String','')3533 3538 3534 3539 %------------------------------------------------------------------------ … … 3784 3789 % if ~isempty(patch_newBin) 3785 3790 set(handles.test_interp,'Visible','off'); 3791 stereo_test=get(handles.compare,'Value'); 3792 if stereo_test==3 3793 set(handles.test_stereo1,'Visible','on') 3794 end 3786 3795 % end 3787 set(handles.get_gridpatch1,'Visible','on')3788 set(handles.grid_patch1,'string','none');3789 set(handles.grid_patch1,'Visible','on')3796 %set(handles.get_gridpatch1,'Visible','on') 3797 %set(handles.grid_patch1,'string','none'); 3798 %set(handles.grid_patch1,'Visible','on') 3790 3799 3791 3800 %------------------------------------------------------------------------ … … 3803 3812 set(handles.nx_patch1_title,'Visible','off') 3804 3813 set(handles.ny_patch1_title,'Visible','off') 3814 set(handles.test_stereo1,'Visible','off') 3805 3815 %set(handles.test_interp,'Visible','off') 3806 set(handles.get_gridpatch1,'Visible','off')3807 set(handles.grid_patch1,'Visible','off')3816 %set(handles.get_gridpatch1,'Visible','off') 3817 %set(handles.grid_patch1,'Visible','off') 3808 3818 3809 3819 %------------------------------------------------------------------------ … … 3934 3944 set(handles.nx_patch2_title,'Visible','on') 3935 3945 set(handles.ny_patch2_title,'Visible','on') 3936 set(handles.get_gridpatch2,'Visible','on')3937 set(handles.grid_patch2,'Visible','on')3946 % set(handles.get_gridpatch2,'Visible','on') 3947 % set(handles.grid_patch2,'Visible','on') 3938 3948 set(handles.list_pair_civ2,'Visible','on') 3939 3949 set(handles.subdir_civ2,'Visible','on') 3940 3950 set(handles.subdir_civ2_text,'Visible','on') 3951 stereo_test=get(handles.compare,'Value'); 3952 if stereo_test==3 3953 set(handles.test_stereo2,'Visible','on') 3954 end 3941 3955 3942 3956 %------------------------------------------------------------------------ … … 3954 3968 set(handles.nx_patch2_title,'Visible','off') 3955 3969 set(handles.ny_patch2_title,'Visible','off') 3956 set(handles.get_gridpatch2,'Visible','off')3957 set(handles.grid_patch2,'Visible','off')3970 % set(handles.get_gridpatch2,'Visible','off') 3971 % set(handles.grid_patch2,'Visible','off') 3958 3972 if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.FIX2,'Value'),0) 3959 3973 set(handles.list_pair_civ2,'Visible','off') … … 3961 3975 set(handles.subdir_civ2_text,'Visible','off') 3962 3976 end 3963 3977 set(handles.test_stereo2,'Visible','off') 3964 3978 %------------------------------------------------------------------------ 3965 3979 function enable_pair1(handles,state) … … 4518 4532 set(handles.test_stereo2,'Value',0) 4519 4533 end 4534 if test==3 && get(handles.PATCH1,'Value') 4535 set(handles.stereo1,'Visible','on') 4536 else 4537 set(handles.stereo1,'Visible','off') 4538 end 4539 if test==3 && get(handles.PATCH2,'Value') 4540 set(handles.stereo2,'Visible','on') 4541 else 4542 set(handles.stereo2,'Visible','off') 4543 end 4520 4544 mode_Callback(hObject, eventdata, handles) 4521 4545 … … 4710 4734 Param.Civ1=par_civ1; 4711 4735 Data=civ_uvmat(Param); 4712 % stepx=str2num(par_civ1.dx);4713 % stepy=str2num(par_civ1.dy);4714 % ibx2=ceil(str2num(par_civ1.ibx)/2);4715 % iby2=ceil(str2num(par_civ1.iby)/2);4716 % isx2=ceil(str2num(par_civ1.isx)/2);4717 % isy2=ceil(str2num(par_civ1.isy)/2);4718 % shiftx=str2num(par_civ1.shiftx);4719 % shifty=str2num(par_civ1.shifty);4720 % % ibx=2*ibx2-1;%ibx and iby odd, reduced by 1 if even4721 % % iby=2*iby2-1;4722 % miniy=max(1+isy2-shifty,1+iby2)4723 % minix=max(1+isx2-shiftx,1+ibx2)4724 % maxiy=min(size(Data.A,1)-isy2-shifty,size(Data.A,1)-iby2)4725 % maxix=min(size(Data.A,2)-isx2-shiftx,size(Data.A,2)-ibx2)4726 % % maxix=stepx*(floor(size(image1_roi,2)/stepx))-(2*ibx2-2)+ibx2;4727 % [GridX,GridY]=meshgrid(minix:stepx:maxix,miniy:stepy:maxiy);4728 % PointCoord(:,1)=reshape(GridX,[],1);4729 % PointCoord(:,2)=reshape(GridY,[],1);4730 4736 Data.ListVarName=[Data.ListVarName {'ny','nx','A'}]; 4731 4737 Data.VarDimName=[Data.VarDimName {'ny','nx',{'ny','nx'}}]; … … 4737 4743 hhview_field=guihandles(hview_field); 4738 4744 set(hview_field,'CurrentAxes',hhview_field.axes3) 4739 %hpoints=line(PointCoord(:,1),PointCoord(:,2),'Color','y','LineStyle','.','Marker','*','LineWidth',4,'Tag','grid_points');4740 4745 ViewData=get(hview_field,'UserData'); 4741 4746 ViewData.CivHandle=handles.civ;% indicate the handle of the civ GUI in view_field … … 4774 4779 val=get(handles.status,'Value'); 4775 4780 if val==0 4781 set(handles.status,'BackgroundColor',[0 1 0]) 4776 4782 hfig=findobj(allchild(0),'name','civ_status'); 4777 4783 if ~isempty(hfig) … … 4780 4786 return 4781 4787 end 4788 set(handles.status,'BackgroundColor',[1 1 0]) 4789 drawnow 4782 4790 listtype={'civ1','fix1','patch1','civ2','fix2','patch2'}; 4783 4791 box_test(1)=get(handles.CIV1,'Value'); … … 4788 4796 box_test(6)=get(handles.PATCH2,'Value'); 4789 4797 option_civ=find(box_test,1,'last');%last selected option (non-zero index of box_test) 4790 filecell=get(handles.civ,'UserData'); 4798 filecell=get(handles.civ,'UserData');%retrieve the list of output files expected for PIV 4799 test_new=0; 4791 4800 if ~isfield(filecell,'nc') 4801 test_new=1; 4792 4802 [ref_i,ref_j,errormsg]=find_ref_indices(handles); 4793 4803 if ~isempty(errormsg) … … 4795 4805 return 4796 4806 end 4797 filecell=set_civ_filenames(handles,ref_i,ref_j,box_test);%determine the list of output files expected from the GUI status 4798 end 4799 4807 filecell=set_civ_filenames(handles,ref_i,ref_j,box_test);%determine the output file expected from the GUI status 4808 end 4800 4809 if ~isequal(box_test(4:6),[0 0 0]) 4801 civ_files=filecell.nc.civ2; 4810 civ_files=filecell.nc.civ2;%case of civ2 operations 4802 4811 else 4803 4812 civ_files=filecell.nc.civ1; … … 4807 4816 hfig=findobj(allchild(0),'name','civ_status'); 4808 4817 if isempty(hfig) 4809 hfig=figure ;4818 hfig=figure('DeleteFcn',@stop_status); 4810 4819 set(hfig,'name','civ_status') 4811 4820 hlist=uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', @open_view_field,'tag','list'); 4812 uicontrol('Style',' listbox','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','msgbox');4821 uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','msgbox','Max',2,'String','checking files...'); 4813 4822 uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]); 4814 4823 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','OK','FontWeight','bold','FontUnits','normalized','FontSize',0.9,'Callback',@close_GUI); 4815 4824 BarPosition=[0.05 0.81 0.01 0.05]; 4816 4825 hwaitbar=uicontrol('Style','frame','Units','normalized', 'Position',BarPosition ,'BackgroundColor',[1 0 0],'tag','waitbar'); 4826 drawnow 4817 4827 end 4818 4828 % datnum=[]; … … 4876 4886 [first,ind]=min(datnum); 4877 4887 [last,indlast]=max(datnum); 4888 if test_new 4889 message='existing file status, no processing launched yet'; 4890 else 4878 4891 message={[num2str(count) ' file(s) done over ' num2str(nbfiles)] ;['oldest modification: ' cell2mat(filefound(ind)) ' : ' datestr(first)];... 4879 4892 ['latest modification: ' cell2mat(filefound(indlast)) ' : ' datestr(last)]}; 4893 end 4880 4894 end 4881 4895 hfig=findobj(allchild(0),'name','civ_status'); 4882 if isempty(hfig) 4883 set(handles.status,'Value',0)%stop program if the figure has been suppressed 4896 if isempty(hfig)% the status list has been deleted 4884 4897 return 4885 4898 else … … 4889 4902 set(hlist,'String',Tabchar) 4890 4903 set(hmsgbox,'String', message) 4891 if count>0 4904 if count>0 && ~test_new 4892 4905 BarPosition(3)=0.9*count/nbfiles; 4893 4906 set(hwaitbar,'Position',BarPosition) … … 4895 4908 end 4896 4909 set(hlist,'UserData',rootroot) 4897 pause( 5)% wait 5seconds for next check4910 pause(10)% wait 10 seconds for next check 4898 4911 end 4899 4912 4900 4913 4901 %------------------------------------------------------------------- 4902 % call 'view_field.fig' to display the selected field4914 %------------------------------------------------------------------------ 4915 % call 'view_field.fig' to display the field selected in the list of 'status' 4903 4916 function open_view_field(hObject, eventdata) 4904 %------------------------------------------------------------------- 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 %------------------------------------------------------------------- 4919 % call 'view_field.fig' to display the selected field4917 %------------------------------------------------------------------------ 4918 list=get(hObject,'String'); 4919 index=get(hObject,'Value'); 4920 rootroot=get(hObject,'UserData'); 4921 filename=list{index}; 4922 ind_dot=findstr(filename,'...'); 4923 filename=filename(1:ind_dot-1); 4924 filename=fullfile(rootroot,filename); 4925 delete(get(hObject,'parent'))%delete the display figure to stop the check process 4926 if exist(filename,'file')%visualise the vel field if it exists 4927 uvmat(filename) 4928 set(gcbo,'Value',1) 4929 end 4930 4931 %------------------------------------------------------------------------ 4932 % launched by pressing OK on the status figure 4920 4933 function close_GUI(hObject, eventdata) 4921 %------------------------------------------------------------------- 4922 delete(gcbf) 4923 4924 4934 %------------------------------------------------------------------------ 4935 delete(gcbf) 4936 4937 %------------------------------------------------------------------------ 4938 % launched by deleting the status figure 4939 function stop_status(hObject, eventdata) 4940 %------------------------------------------------------------------------ 4941 hciv=findobj(allchild(0),'tag','civ'); 4942 hhciv=guidata(hciv); 4943 set(hhciv.status,'value',0) %reset the status uicontrol in the GUI civ 4944 set(hhciv.status,'BackgroundColor',[0 1 0]) 4945 4946 %------------------------------------------------------------------------ 4925 4947 % --- Executes on button press in CivAll. 4926 4948 function CivAll_Callback(hObject, eventdata, handles) 4949 %------------------------------------------------------------------------ 4927 4950 Listprog=get(handles.CivAll,'String'); 4928 4951 index=get(handles.CivAll,'Value'); … … 4932 4955 set(handles.thresh_patch1,'Visible','off') 4933 4956 set(handles.thresh_text1,'Visible','off') 4957 set(handles.thresh_patch2,'Visible','off') 4958 set(handles.thresh_text2,'Visible','off') 4934 4959 set(handles.rho,'Style','edit') 4935 4960 set(handles.rho,'String','1') 4961 set(handles.BATCH,'Enable','on') 4936 4962 case 'CivAll' 4937 4963 if get(handles.PATCH1,'Value') … … 4941 4967 set(handles.rho,'Style','edit') 4942 4968 set(handles.rho,'String','1') 4969 set(handles.BATCH,'Enable','on') 4943 4970 case 'CivUvmat' 4944 4971 if get(handles.PATCH1,'Value') … … 4946 4973 set(handles.thresh_text1,'Visible','on') 4947 4974 end 4975 if get(handles.PATCH2,'Value') 4976 set(handles.thresh_patch2,'Visible','on') 4977 set(handles.thresh_text2,'Visible','on') 4978 end 4948 4979 set(handles.rho,'Style','popupmenu') 4949 4980 set(handles.rho,'Value',1) 4950 4981 set(handles.rho,'String',{'1';'2'}) 4951 end 4952 4982 set(handles.BATCH,'Enable','off') 4983 end 4984 -
trunk/src/civ_uvmat.m
r251 r252 32 32 PointCoord(:,1)=reshape(GridX,[],1); 33 33 PointCoord(:,2)=reshape(GridY,[],1); 34 if ~isempty(par_civ1.maskname)34 if isfield(par_civ1,'maskname') && ~isempty(par_civ1.maskname) 35 35 maskname=par_civ1.maskname; 36 36 mask=imread(maskname); … … 133 133 Data.fix=1; 134 134 Data.ListVarName=[Data.ListVarName {'vec_FixFlag'}]; 135 Data.VarDimName=[Data.Var dimName {'nb_vectors'}];135 Data.VarDimName=[Data.VarDimName {'nb_vectors'}]; 136 136 end 137 137 Data.vec_FixFlag=fix_uvmat(Param.Fix1,Data.vec_F,Data.vec_C,Data.vec_U,Data.vec_V,Data.vec_X,Data.vec_Y); … … 174 174 %% Civ2 175 175 if isfield (Param,'Civ2') 176 par_civ2=Param.Civ2 176 par_civ2=Param.Civ2; 177 177 image1=imread(par_civ2.filename_ima_a); 178 178 image2=imread(par_civ2.filename_ima_b); … … 235 235 Data.CivStage=Data.CivStage+1; 236 236 end 237 238 %% Fix2 239 if isfield (Param,'Fix2') 240 ListFixParam=fieldnames(Param.Fix2); 241 for ilist=1:length(ListFixParam) 242 ParamName=ListFixParam{ilist}; 243 ListName=['Fix1_' ParamName]; 244 eval(['Data.ListGlobalAttribute=[Data.ListGlobalAttribute ''' ParamName '''];']) 245 eval(['Data.' ListName '=Param.Fix2.' ParamName ';']) 246 end 247 if test_civx 248 if ~isfield(Data,'fix2') 249 Data.ListGlobalAttribute=[Data.ListGlobalAttribute 'fix2']; 250 Data.fix2=1; 251 Data.ListVarName=[Data.ListVarName {'vec2_FixFlag'}]; 252 Data.VarDimName=[Data.VarDimName {'nb_vectors2'}]; 253 end 254 Data.vec_FixFlag=fix_uvmat(Param.Fix2,Data.vec2_F,Data.vec2_C,Data.vec2_U,Data.vec2_V,Data.vec2_X,Data.vec2_Y); 255 else 256 Data.ListVarName=[Data.ListVarName {'Civ2_FF'}]; 257 Data.VarDimName=[Data.VarDimName {'nbvec2'}]; 258 nbvar=length(Data.ListVarName); 259 Data.VarAttribute{nbvar}.Role='errorflag'; 260 Data.Civ2_FF=fix_uvmat(Param.Fix2,Data.Civ2_F,Data.Civ2_C,Data.Civ2_U,Data.Civ2_V); 261 Data.CivStage=5; 262 end 263 end 264 265 %% Patch2 266 if isfield (Param,'Patch2') 267 Data.ListGlobalAttribute=[Data.ListGlobalAttribute {'Patch2_Rho','Patch2_Threshold','Patch2_SubDomain'}]; 268 Data.Patch2_Rho=str2double(Param.Patch2.Rho); 269 Data.Patch2_Threshold=str2double(Param.Patch2.Threshold); 270 Data.Patch2_SubDomain=str2double(Param.Patch2.SubDomain); 271 Data.ListVarName=[Data.ListVarName {'Civ2_U_Diff','Civ2_V_Diff','Civ2_X_SubRange','Civ2_Y_SubRange','Civ2_NbSites','Civ2_X_tps','Civ2_Y_tps','Civ2_U_tps','Civ2_V_tps'}]; 272 Data.VarDimName=[Data.VarDimName {'NbVec2','NbVec2',{'NbSubDomain2','Two'},{'NbSubDomain2','Two'},'NbSubDomain2',... 273 {'NbVec2Sub','NbSubDomain2'},{'NbVec2Sub','NbSubDomain2'},{'Nbtps2','NbSubDomain2'},{'Nbtps2','NbSubDomain2'}}]; 274 nbvar=length(Data.ListVarName); 275 Data.VarAttribute{nbvar-1}.Role='vector_x'; 276 Data.VarAttribute{nbvar}.Role='vector_y'; 277 Data.Civ2_U_Diff=zeros(size(Data.Civ2_X)); 278 Data.Civ2_V_Diff=zeros(size(Data.Civ2_X)); 279 if isfield(Data,'Civ2_FF') 280 ind_good=find(Data.Civ2_FF==0); 281 else 282 ind_good=1:numel(Data.Civ2_X); 283 end 284 [Data.Civ2_X_SubRange,Data.Civ2_Y_SubRange,Data.Civ2_NbSites,FFres,Ures, Vres,Data.Civ2_X_tps,Data.Civ2_Y_tps,Data.Civ2_U_tps,Data.Civ2_V_tps]=... 285 patch_uvmat(Data.Civ2_X(ind_good)',Data.Civ2_Y(ind_good)',Data.Civ2_U(ind_good)',Data.Civ2_V(ind_good)',Data.Patch2_Rho,Data.Patch2_Threshold,Data.Patch2_SubDomain); 286 Data.Civ2_U_Diff(ind_good)=Data.Civ2_U(ind_good)-Ures; 287 Data.Civ2_V_Diff(ind_good)=Data.Civ2_V(ind_good)-Vres; 288 Data.Civ2_FF(ind_good)=FFres; 289 Data.CivStage=3; 290 end 291 237 292 %% write result 238 293 % 'TESTcalc' … … 266 321 267 322 function FF=fix_uvmat(Param,F,C,U,V,X,Y) 268 %error=[]; %default269 Param270 323 FF=zeros(size(F));%default 271 324 -
trunk/src/geometry_calib.m
r242 r252 87 87 guidata(hObject, handles); 88 88 set(hObject,'DeleteFcn',{@closefcn})% 89 set(hObject,'WindowButtonDownFcn',{'mouse_alt_gui',handles}) % allows mouse action with right button (zoom for uicontrol display) 89 90 90 91 %set the position of the interface -
trunk/src/mouse_down.m
r244 r252 113 113 end 114 114 break 115 elseif isequal(htype,'uicontrol') && isequal(get(hchild(ichild),'Visible'),'on') 115 elseif isequal(get(hObject,'SelectionType'),'alt') && isequal(htype,'uicontrol') && isequal(get(hchild(ichild),'Visible'),'on') && ~isequal(get(hchild(ichild),'tag'),'frame_object')&&... 116 ~isequal(get(hchild(ichild),'tag'),'list_object_2') && ~isequal(get(hchild(ichild),'tag'),'list_object_1') 116 117 msg_pos(1:2)=currentfig_pos(1:2)+obj_pos(1:2).*currentfig_pos(3:4); 117 118 msgbox_uvmat(['uicontrol: ' get(hchild(ichild),'Tag')],'',get(hchild(ichild),'String'),msg_pos) 118 %msgbox(get(hchild(ichild),'String'),get(hchild(ichild),'Tag'))119 119 break 120 120 end -
trunk/src/mouse_up.m
r221 r252 250 250 if isequal(get(currentfig,'SelectionType'),'normal');%if left button has been pressed, zoom in by a factor of 2 251 251 xlim(1)=0.5*xy(1,1)+0.5*xlim(1); 252 xlim(2)=0.5*xy(1,1)+0.5*xlim(2); 252 xlim(2)=0.5*xy(1,1)+0.5*xlim(2);%double the field whith the middle at the selected points 253 253 set(currentaxes,'XLim',xlim) 254 254 ylim(2)=0.5*xy(1,2)+0.5*ylim(2); … … 257 257 % if right mouse button has been pressed, zoom out by a factor of 2 258 258 else 259 xlim(1)=2*xlim(1)-xy(1,1); 259 xlim(1)=2*xlim(1)-xy(1,1);% reverse of the zoom on action 260 260 xlim(2)=2*xlim(2)-xy(1,1); 261 261 ylim(1)=2*ylim(1)-xy(1,2); 262 262 ylim(2)=2*ylim(2)-xy(1,2); 263 263 if isfield(AxeData,'RangeX')&& isfield(AxeData,'RangeY') 264 'TESTup'265 AxeData266 264 xlim(1)=max(AxeData.RangeX(1),xlim(1)); 267 265 xlim(2)=min(AxeData.RangeX(2),xlim(2)); 268 266 ylim(1)=max(AxeData.RangeY(1),ylim(1)); 269 267 ylim(2)=min(AxeData.RangeY(2),ylim(2)); 268 if ylim(1)>=ylim(2)|| xlim(1)>=xlim(2) 269 xlim=AxeData.RangeX; 270 ylim=AxeData.RangeY; 271 end 270 272 % desactivate the zoom if the full field is visible within the axes 271 273 if isequal(xlim,AxeData.RangeX) && isequal(ylim,AxeData.RangeY) … … 276 278 end 277 279 end 278 xlim279 ylim280 280 set(currentaxes,'XLim',xlim) 281 281 set(currentaxes,'YLim',ylim) -
trunk/src/name2display.m
r138 r252 182 182 subdir=[subdir extdir]; 183 183 end 184 185 %resolve ambigous nomenclature types when the number of 0 is unknown (type %0...): 186 ind_zero=findstr('0',nom_type); 187 nb_zero=numel(ind_zero); 188 if ~isempty(ind_zero) 189 for itest=0:nb_zero-1 190 filename=name_generator(fullfile(RootPath,RootFile),1,1,ext,nom_type,1,1,1,subdir); 191 if exist(filename,'file') 192 break 193 else 194 nom_type(ind_zero(1))=[] % remove a zero in nom_type 195 end 196 end 197 end -
trunk/src/plot_field.m
r247 r252 241 241 msgbox_uvmat('ERROR', errormsg) 242 242 end 243 if isfield(PlotParamOut,' RangeX')&& isfield(PlotParamOut,'RangeY')243 if isfield(PlotParamOut,'MinX') 244 244 % 'TESTplot' 245 245 % haxes … … 248 248 % set(haxes,'XLim',[PlotParamOut.MinX PlotParamOut.MaxX]) 249 249 % set(haxes,'YLim',[PlotParamOut.MinY PlotParamOut.MaxY]) 250 AxeData.RangeX= PlotParamOut.RangeX;%'[PlotParamOut.MinX PlotParamOut.MaxX];251 AxeData.RangeY= PlotParamOut.RangeY;%[PlotParamOut.MinY PlotParamOut.MaxY]250 AxeData.RangeX=[PlotParamOut.MinX PlotParamOut.MaxX];%'[PlotParamOut.MinX PlotParamOut.MaxX]; 251 AxeData.RangeY=[PlotParamOut.MinY PlotParamOut.MaxY];%[PlotParamOut.MinY PlotParamOut.MaxY] 252 252 end 253 253 … … 1071 1071 %store the coordinate extrema occupied by the field 1072 1072 if ~isempty(Data) 1073 XMin=[]; 1074 XMax=[]; 1075 YMin=[]; 1076 YMax=[]; 1073 1077 fix_lim=isfield(PlotParam,'FixLimits') && PlotParam.FixLimits; 1074 1078 if fix_lim 1075 1079 if ~isfield(PlotParam,'MinX')||~isfield(PlotParam,'MaxX')||~isfield(PlotParam,'MinY')||~isfield(PlotParam,'MaxY') 1076 fix_lim=0; %free limits if lits are not set, 1080 fix_lim=0; %free limits if limits are not set, 1081 else 1082 XMin=PlotParam.MinX 1083 XMax=PlotParam.MaxX; 1084 YMin=PlotParam.MinY; 1085 YMax=PlotParam.MaxY; 1077 1086 end %else PlotParamOut.XMin =PlotParam.XMin... 1078 end 1079 % if ~fix_lim 1080 XMin=[]; 1081 XMax=[]; 1082 YMin=[]; 1083 YMax=[]; 1084 if test_ima%both background image and vectors coexist, take the wider bound 1087 else 1088 if test_ima %both background image and vectors coexist, take the wider bound 1085 1089 XMin=min(AX); 1086 1090 XMax=max(AX); 1087 1091 YMin=min(AY); 1088 1092 YMax=max(AY); 1089 end 1090 if test_vec 1091 XMin=min(XMin,min(vec_X)); 1092 XMax=max(XMax,max(vec_X)); 1093 YMin=min(YMin,min(vec_Y)); 1094 YMax=max(YMax,max(vec_Y)); 1095 end 1096 PlotParamOut.RangeX=[XMin XMax]; %range of x, to be stored in the user data of the plot axes 1097 PlotParamOut.RangeY=[YMin YMax]; %range of x, to be stored in the user data of the plot axes 1098 if ~fix_lim 1093 if test_vec 1094 XMin=min(XMin,min(vec_X)); 1095 XMax=max(XMax,max(vec_X)); 1096 YMin=min(YMin,min(vec_Y)); 1097 YMax=max(YMax,max(vec_Y)); 1098 end 1099 elseif test_vec 1100 XMin=min(vec_X); 1101 XMax=max(vec_X); 1102 YMin=min(vec_Y); 1103 YMax=max(vec_Y); 1104 end 1105 end 1106 % PlotParamOut.RangeX=[XMin XMax]; %range of x, to be stored in the user data of the plot axes 1107 % PlotParamOut.RangeY=[YMin YMax]; %range of x, to be stored in the user data of the plot axes 1108 % if ~fix_lim 1099 1109 PlotParamOut.MinX=XMin; 1100 1110 PlotParamOut.MaxX=XMax; … … 1107 1117 set(haxes,'YLim',[YMin YMax]);% set x limits of frame in axes coordinates 1108 1118 end 1109 end1119 % end 1110 1120 set(haxes,'YDir','normal') 1111 1121 set(get(haxes,'XLabel'),'String',[XName ' (' x_units ')']); -
trunk/src/series.m
r248 r252 125 125 FieldCell{1}=param.list_fields{param.index_fields}; 126 126 end 127 % if isfield(param,'velTypeMenu')&&isfield(param,'velTypeIndex') 128 % set(handles.VelTypeMenu,'Value',param.VelTypeIndex) 129 % set(handles.VelTypeMenu,'String',param.VelTypeMenu) 130 % end 131 set(hObject,'WindowButtonUpFcn',{'mouse_up_gui',handles}) 127 set(hObject,'WindowButtonDownFcn',{'mouse_alt_gui',handles}) % allows mouse action with right button (zoom for uicontrol display) 132 128 NomType_Callback(hObject, eventdata, handles) 133 129 -
trunk/src/set_object.m
r233 r252 84 84 end 85 85 set(hObject,'KeyPressFcn',{'keyboard_callback',handles})%set keyboard action function (allow action on uvmat when set_object is in front) 86 set(hObject,'WindowButtonDownFcn',{'mouse_alt_gui',handles}) % allows mouse action with right button (zoom for uicontrol display) 86 87 enable_plot=0;%default: does not allow plot of object and projection 87 88 -
trunk/src/uvmat.m
r251 r252 230 230 set(hObject,'WindowButtonUpFcn',{'mouse_up',handles}) 231 231 set(hObject,'DeleteFcn',{@closefcn})% 232 set(handles.list_object_1,'ButtonDownFcn',{@list_object_1_Callback,handles})% allows activation of lis_object_1_callback with right mouse click 233 set(handles.list_object_2,'ButtonDownFcn',{@list_object_2_Callback,handles}) 232 234 233 235 %% refresh projection plane … … 1676 1678 function runplus_Callback(hObject, eventdata, handles) 1677 1679 %------------------------------------------------------------------- 1680 eventdata 1678 1681 set(handles.runplus,'BackgroundColor',[1 1 0])%paint the command button in yellow 1679 1682 drawnow … … 2570 2573 else 2571 2574 % create a default projection 2572 % UvData.Object{1}.ProjMode='projection';%main plotting plane 2573 % UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat 2574 % set(handles.list_object_1,'Value',1); 2575 % set(handles.list_object_1,'String',{''}); 2575 UvData.Object{1}.ProjMode='projection';%main plotting plane 2576 UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat 2577 set(handles.list_object_1,'Value',1); 2578 list_object=get(handles.list_object_1,'String') 2579 if isempty(list_object) 2580 list_object={''}; 2581 elseif ~isempty(list_object{1}) 2582 list_object=[{''};list_object]; 2583 end 2584 set(handles.list_object_1,'String',list_object); 2585 set(handles.list_object_2,'String',list_object); 2576 2586 end 2577 2587 % if ~isfield(UvData.Object{1},'plotaxes') … … 4295 4305 list_str=get(handles.list_object_1,'String'); 4296 4306 IndexObj=get(handles.list_object_1,'Value'); 4297 str_1=list_str{IndexObj}; 4298 % val_2=get(handles.list_object_2,'Value'); 4299 % str_2=get(handles.list_object_2,'String'); 4300 % if isequal(val_2,IndexObj)% if the first selection is equal to the second, it will suppress the second 4301 % set(handles.list_object_2,'Value',numel(str_2))%select the end of the list ('...') 4302 % list_object_2_Callback(hObject, eventdata, handles) 4303 % end 4304 update_object(handles,IndexObj,1,str_1) 4307 %IndexObj(2)=get(handles.list_object_2,'Value'); 4308 update_object(handles,IndexObj,1,list_str{IndexObj}) 4305 4309 4306 4310 %------------------------------------------------------------------------ … … 4310 4314 list_str=get(handles.list_object_2,'String'); 4311 4315 IndexObj=get(handles.list_object_2,'Value'); 4312 if ischar(list_str) || isempty(list_str{IndexObj})% || strcmp(list_str{IndexObj},'...') 4316 %IndexObj(2)=get(handles.list_object_2,'Value')-1; 4317 % if no projection object is selected, close view_field 4318 if ischar(list_str) || isempty(list_str{IndexObj}) 4313 4319 hview_field=findobj(allchild(0),'Tag','view_field'); 4314 4320 if ~isempty(hview_field) … … 4320 4326 end 4321 4327 else 4322 update_object(handles,IndexObj,2,list_str{IndexObj}) 4328 if isequal(get(handles.uvmat,'SelectionType'),'alt') 4329 option=4;%will show object properties on the GUI set_object 4330 else 4331 option=2; % just update the projection 4332 end 4333 update_object(handles,IndexObj,option,list_str{IndexObj}) 4323 4334 end 4324 4335 … … 4327 4338 %------------------------------------------------------------------------ 4328 4339 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 4329 if numel(UvData.Object)< IndexObj;4340 if numel(UvData.Object)<max(IndexObj); 4330 4341 return 4331 4342 end 4343 % if option==1 ||option==3 4332 4344 ObjectData=UvData.Object{IndexObj}; 4345 % else 4346 % ObjectData=UvData.Object{IndexObj}; 4347 % end 4333 4348 ObjectData.Name=ObjectName; 4334 4349 if isequal(get(handles.edit_object,'Value'),1) … … 4352 4367 end 4353 4368 end 4354 hset_object=set_object(ObjectData,[],ZBounds);% call the set_object interface, 4355 4356 % %project the current field on the object and plot it 4357 ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData 4358 if option==1%length(UvData.Object)>= IndexObj && isfield(UvData.Object{IndexObj},'plotaxes')&& ishandle(UvData.Object{IndexObj}.plotaxes) 4369 4370 if option==3 ||option==4% right mouse selection, show the GUI set_object: 4371 hset_object=set_object(ObjectData,[],ZBounds); 4372 end 4373 4374 %project on the selected object and update the corresponding plot 4375 hview_field=findobj(allchild(0),'tag','view_field'); 4376 % PlotHandles=guidata(hview_field); 4377 if option==1 || option==3%length(UvData.Object)>= IndexObj && isfield(UvData.Object{IndexObj},'plotaxes')&& ishandle(UvData.Object{IndexObj}.plotaxes) 4359 4378 PlotHandles=handles; 4360 4379 else 4361 hview_field=findobj(allchild(0),'tag','view_field');4362 4380 if isempty(hview_field) 4363 4381 hview_field=view_field; … … 4365 4383 PlotHandles=guidata(hview_field); 4366 4384 end 4367 %plot_field(ProjData,PlotHandles.axes3,PlotHandles); 4368 set(handles.uvmat,'UserData',UvData) 4369 hother=findobj('Tag','proj_object');%find all the proj objects 4385 if option==1 ||option==2% lefet mouse selection, peroject the field: 4386 ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData 4387 plot_field(ProjData,PlotHandles.axes3,read_plot_param(PlotHandles));%read plotting parameters on the uvmat interfacPlotHandles); 4388 UvData.Object=update_obj(UvData,IndexObj,[]); 4389 set(handles.uvmat,'UserData',UvData) 4390 end 4391 4392 4393 % set(handles.uvmat,'UserData',UvData) 4394 hother=[findobj(handles.axes3,'Tag','proj_object') ;findobj(PlotHandles.axes3,'Tag','proj_object')] ;%find all the proj objects 4395 hother=[hother ;findobj(handles.axes3,'Tag','DeformPoint'); findobj(PlotHandles.axes3,'Tag','DeformPoint')]; 4370 4396 for iobj=1:length(hother) 4371 4397 if isequal(get(hother(iobj),'Type'),'rectangle')||isequal(get(hother(iobj),'Type'),'patch') … … 4383 4409 set(hother(iobj),'Selected','off') 4384 4410 end 4385 hother=findobj('Tag','DeformPoint');4386 set(hother,'Color','b');4387 set(hother,'Selected','off')4388 4411 if isfield(ObjectData,'DisplayHandle_uvmat') 4389 4412 if ishandle(ObjectData.DisplayHandle_uvmat) … … 4417 4440 end 4418 4441 end 4419 % end 4420 end 4421 % pause(0.1) 4422 figure(hset_object)%put set_object in front 4442 end 4423 4443 4424 4444 %------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.