Changeset 252 for trunk/src/civ.m
- Timestamp:
- May 15, 2011, 11:17:08 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.