Changeset 319
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r317 r319 196 196 browse=[];%initialisation 197 197 else 198 browse=get(handles RootName,'UserData');198 browse=get(handles.RootName,'UserData'); 199 199 end 200 200 browse.num_i1=num_i1; … … 289 289 set(handles.num_Rho,'Value',1) 290 290 set(handles.num_Rho,'String',{'1';'2'}) 291 set(handles.BATCH,'Enable','off')291 % set(handles.BATCH,'Enable','off') 292 292 293 293 % ----------------------------------------------------------------------- … … 345 345 num_ref_i=i1;%efaulmt ref index 346 346 num_ref_j=j1; 347 browse=get(handles.RootName,'UserData'); 347 348 browse.incr_pair=[0 0];%default 348 349 … … 1180 1181 cmd=[cmd... 1181 1182 cmd_civ1(filecell.nc.civ1{ifile,j},Param) '\n']; 1183 if ~isempty(errormsg) 1184 msgbox_uvmat('ERROR',errormsg) 1185 return 1186 end 1182 1187 case 'CivAll' 1183 1188 CivAllCmd=[CivAllCmd ' civ1 ']; … … 1428 1433 drawnow 1429 1434 if ~strcmp(compare,'stereo PIV') 1430 [Data,erromsg]=civ_matlab(Param,filecell.nc.civ1{ifile,j}); 1431 if isempty(errormsg) 1432 display([filecell.nc.civ1{ifile,j} ' written']) 1435 filename_xml=[OutputFile '.civ.xml']; 1436 t=struct2xml(Param); 1437 save(t,filename_xml) 1438 if batch 1439 batch_file_list{length(batch_file_list)+1}=filename_xml; 1433 1440 else 1434 msgbox_uvmat('ERROR',errormsg) 1435 end 1441 [Data,erromsg]=civ_matlab(Param,filecell.nc.civ1{ifile,j}); 1442 if isempty(errormsg) 1443 display([filecell.nc.civ1{ifile,j} ' written']) 1444 else 1445 msgbox_uvmat('ERROR',errormsg) 1446 end 1447 end 1436 1448 end 1437 1449 end … … 2471 2483 %------------------------------------------------------------------------ 2472 2484 test=get(handles.ListCompareMode,'Value'); 2473 if test==2 || test==3 % case 'disp alcemen' or 'stereo PIV'2485 if test==2 || test==3 % case 'displacement' or 'stereo PIV' 2474 2486 filebase=get(handles.RootName,'String'); 2475 browse=get(handles RootName,'Userdata');2487 browse=get(handles.RootName,'Userdata'); 2476 2488 browse.nom_type_ima1=browse.nom_type_ima; 2477 set(handles RootName,'UserData',browse);2489 set(handles.RootName,'UserData',browse); 2478 2490 set(handles.sub_txt,'Visible','on') 2479 2491 set(handles.RootName_1,'Visible','On');%mkes the second file input window visible … … 2519 2531 [RootPath,RootFile,field_count,str2,str_a,str_b,xx,nom_type,subdir]=name2display(name); 2520 2532 set(handles.RootName_1,'String',RootFile); 2521 browse=get(handles RootName,'UserData');2533 browse=get(handles.RootName,'UserData'); 2522 2534 browse.nom_type_ima_1=nom_type; 2523 set(handles RootName,'UserData',browse)2535 set(handles.RootName,'UserData',browse) 2524 2536 2525 2537 %check image extension … … 2549 2561 set(handles.ListPairMode,'Value',1) 2550 2562 set(handles.ListPairMode,'String',mode_store) 2551 set(handles.test_stereo1,'Value',0)2563 % set(handles.test_stereo1,'Value',0) 2552 2564 set(handles.CheckStereo,'Value',0) 2553 2565 set(handles.ListPairMode,'Value',1) % mode 'civX' selected by default 2554 2566 end 2555 2567 if test==3 && get(handles.CheckPatch1,'Value') 2556 set(handles. test_stereo1,'Visible','on')2557 else 2558 set(handles. test_stereo1,'Visible','off')2568 set(handles.CheckStereo,'Visible','on') 2569 else 2570 set(handles.CheckStereo,'Visible','off') 2559 2571 end 2560 2572 if test==3 && get(handles.CheckPatch2,'Value') … … 2563 2575 set(handles.CheckStereo,'Visible','off') 2564 2576 end 2565 mode_Callback(hObject, eventdata, handles)2577 ListPairMode_Callback(hObject, eventdata, handles) 2566 2578 2567 2579 … … 2701 2713 displ_num(3,1)=0; 2702 2714 displ_num(4,1)=0; 2703 if nbfield > 1 2715 if nbfield > 1 || nbfield==0 2704 2716 set(handles.itext,'Visible','On') 2705 2717 set(handles.first_i,'Visible','On') … … 3656 3668 3657 3669 %% if hObject is on the checkciv1 frame, duplicate action for checkciv2 frame 3658 PanelName=get(hparent,'tag') 3670 PanelName=get(hparent,'tag'); 3659 3671 if strcmp(PanelName,'Civ1') 3660 3672 hchildren=get(handles.Civ2,'children'); … … 4038 4050 %pixels per cm and matrix of the image times, read from the .civ file by uvmat 4039 4051 %changes : filename_cmx -> filename ( no extension ) 4052 cmd=''; 4053 errormsg=''; %default 4040 4054 filename=regexprep(filename,'.nc',''); %file name for the result 4041 4055 if isequal(Param.Civ1.Dt,'0') … … 4045 4059 Param.Civ1.ImageB=regexprep(Param.Civ1.ImageB,'.png',''); 4046 4060 fid=fopen([filename '.civ1.cmx'],'w'); 4061 if isequal(fid,-1) 4062 display(['cmd file ' filename ' cannot be created']) 4063 return 4064 end 4047 4065 fprintf(fid,['############## CMX file' '\n' ]); 4048 4066 fprintf(fid, ['FirstImage ' regexprep(Param.Civ1.ImageA,'\\','\\\\') '\n' ]);% for windows compatibility … … 4358 4376 Data.ListVarName={'ny','nx','A'}; 4359 4377 Data.VarDimName= {'ny','nx',{'ny','nx'}}; 4360 4361 Param=read_GUI(handles.civ) 4362 Param.CheckOutputFile=0; 4363 [Data,errormsg]=civ_matlab(Param,filecell.nc.civ1{1})% get the grid of x, y positions set for PIV 4364 if ~isempty(errormsg) 4365 msgbox_uvmat('ERROR',Data.Txt) 4366 return 4367 end 4368 set(handles.TestCiv1,'BackgroundColor',[1 0 0]) 4378 4379 param_patch1=read_GUI(handles.Patch1); 4380 param_patch1.CivFile=filecell.nc.civ1{1}; 4381 Param.Patch1=param_patch1; 4382 for irho=1:7 4383 [Data,errormsg]=civ_matlab(Param);% get the grid of x, y positions set for PIV 4384 if ~isempty(errormsg) 4385 msgbox_uvmat('ERROR',Data.Txt) 4386 return 4387 end 4388 SmoothingParam(irho)=Param.Patch1.SmoothingParam; 4389 Data.Civ1_U_Diff=Data.Civ1_U_Diff(Data.Civ1_FF==0); 4390 Data.Civ1_V_Diff=Data.Civ1_V_Diff(Data.Civ1_FF==0); 4391 DiffVel(irho)=sqrt(mean(Data.Civ1_U_Diff.*Data.Civ1_U_Diff+Data.Civ1_V_Diff.*Data.Civ1_V_Diff)) 4392 Param.Patch1.SmoothingParam=2*Param.Patch1.SmoothingParam; 4393 end 4394 figure 4395 plot(SmoothingParam,DiffVel) 4396 set(handles.TestPatch1,'BackgroundColor',[1 0 0]) 4369 4397 else 4370 4398 corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display … … 4372 4400 delete(corrfig) 4373 4401 end 4374 hview_field=findobj(allchild(0),'tag','view_field');% look for view_field 4402 hview_field=findobj(allchild(0),'tag','view_field');% look for view_field 4375 4403 if ~isempty(hview_field) 4376 4404 delete(hview_field) -
trunk/src/civ_matlab.m
r317 r319 46 46 check_patch1=0;%default 47 47 48 if ischar(Param) 49 t=xmltree(Param); 50 Param=convert(t); 51 end 52 48 53 %% Civ1 49 54 if isfield (Param,'Civ1') … … 62 67 end 63 68 Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ1_param];% {'Civ1_Time','Civ1_Dt'}]; 64 % if exist('ncfile','var')% TEST for use interactively with mouse_motion (no file created)65 66 67 68 69 70 71 69 % if exist('ncfile','var')% TEST for use interactively with mouse_motion (no file created) 70 Data.ListVarName={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_C','Civ1_F'};% cell array containing the names of the fields to record 71 Data.VarDimName={'nbvec1','nbvec1','nbvec1','nbvec1','nbvec1','nbvec1'}; 72 Data.VarAttribute{1}.Role='coord_x'; 73 Data.VarAttribute{2}.Role='coord_y'; 74 Data.VarAttribute{3}.Role='vector_x'; 75 Data.VarAttribute{4}.Role='vector_y'; 76 Data.VarAttribute{5}.Role='warnflag'; 72 77 Data.Civ1_X=reshape(xtable,[],1); 73 78 Data.Civ1_Y=reshape(Param.Civ1.ImageHeight-ytable+1,[],1); … … 77 82 Data.Civ1_F=reshape(F,[],1); 78 83 Data.CivStage=1; 79 84 80 85 else 81 Data=nc2struct(ncfile,'ListGlobalAttribute','absolut_time_T0') %look for the constant 'absolut_time_T0' to detect old civx data format 86 if exist('ncfile','var') 87 CivFile=ncfile; 88 elseif isfield(Param.Patch1,'CivFile') 89 CivFile=Param.Patch1.CivFile; 90 end 91 Data=nc2struct(CivFile,'ListGlobalAttribute','absolut_time_T0') %look for the constant 'absolut_time_T0' to detect old civx data format 82 92 if isfield(Data,'Txt') 83 93 errormsg=Data.Txt; 84 94 return 85 95 end 86 96 if ~isempty(Data.absolut_time_T0')%read civx file 87 97 check_civx=1;% test for old civx data format 88 [Data,vardetect,ichoice]=nc2struct( ncfile);%read the variables in the netcdf file98 [Data,vardetect,ichoice]=nc2struct(CivFile);%read the variables in the netcdf file 89 99 else 90 100 if isfield(Param,'Fix1') 91 Data=nc2struct( ncfile,ListVarCiv1);%read civ1 data in the existing netcdf file101 Data=nc2struct(CivFile,ListVarCiv1);%read civ1 data in the existing netcdf file 92 102 else 93 Data=nc2struct( ncfile,ListVarFix1);%read civ1 and fix1 data in the existing netcdf file103 Data=nc2struct(CivFile,ListVarFix1);%read civ1 and fix1 data in the existing netcdf file 94 104 end 95 105 end 96 97 106 end 98 107 … … 296 305 297 306 %% write result in a netcdf file if requested 298 if exist('ncfile','var') && ~(isfield(Param,'CheckOuputFile')&&Param.CheckOuputFile)307 if exist('ncfile','var') 299 308 errormsg=struct2nc(ncfile,Data); 300 309 end … … 420 429 iref=par_civ.Grid(ivec,1);% xindex on the image A for the middle of the correlation box 421 430 jref=par_civ.Grid(ivec,2);% yindex on the image B for the middle of the correlation box 422 % xtable(ivec)=iref;423 % ytable(ivec)=jref;%default431 % xtable(ivec)=iref; 432 % ytable(ivec)=jref;%default 424 433 if ~(checkmask && par_civ.Mask(jref,iref)<=20) %velocity not set to zero by the black mask 425 if jref-iby2<1 || jref+iby2>par_civ.ImageHeight|| iref-ibx2<1 || iref+ibx2>par_civ.ImageWidth 434 if jref-iby2<1 || jref+iby2>par_civ.ImageHeight|| iref-ibx2<1 || iref+ibx2>par_civ.ImageWidth% we are outside the image 426 435 F(ivec)=3; 427 436 else … … 434 443 F(ivec)=3; 435 444 end 445 %threshold on image maximum 446 if check_MaxIma && (image1_mean > par_civ.MaxIma || image2_mean > par_civ.MaxIma) 447 F(ivec)=3; 448 end 436 449 end 437 %threshold on image maximum 438 if check_MaxIma && (image1_mean > par_civ.MaxIma || image2_mean > par_civ.MaxIma) 439 F(ivec)=3; 440 end 450 441 451 if F(ivec)~=3 442 452 image1_crop=image1_crop-image1_mean;%substract the mean -
trunk/src/uvmat.m
r316 r319 1769 1769 NomType=get(handles.FileIndex,'UserData'); 1770 1770 1771 num1=stra2num(get(handles.i1,'String'));1772 num2=stra2num(get(handles.i2,'String'));1773 num_a=stra2num(get(handles.j1,'String'));1774 num_b=stra2num(get(handles.j2,'String'));1771 i1=stra2num(get(handles.i1,'String')); 1772 i2=stra2num(get(handles.i2,'String')); 1773 j1=stra2num(get(handles.j1,'String')); 1774 j2=stra2num(get(handles.j2,'String')); 1775 1775 1776 1776 sub_value= get(handles.SubField,'Value'); 1777 1777 if sub_value % a second input file has been entered 1778 1778 [FileName_1,RootPath_1,filebase_1,FileIndices_1,FileExt_1,SubDir_1]=read_file_boxes_1(handles); 1779 [pp,ff, str1,str2,str_a,str_b]=name2display(FileIndices_1);1780 num1_1=stra2num(str1);%current set of indices for the second field (may be set different than the main indices)1781 num2_1=stra2num(str2);1782 num_a_1=stra2num(str_a);1783 num_b_1=stra2num(str_b);1779 [pp,ff,i1_1_str,i2_1_str,j1_1_str,j2_1_str]=name2display(FileIndices_1); 1780 i1_1=stra2num(i1_1_str);%current set of indices for the second field (may be set different than the main indices) 1781 i2_1=stra2num(i2_1_str); 1782 j1_1=stra2num(j1_1_str); 1783 j2_1=stra2num(j2_1_str); 1784 1784 NomType_1=get(handles.FileIndex_1,'UserData'); 1785 1785 else … … 1790 1790 %case of scanning along the first direction (rootfile numbers) 1791 1791 if get(handles.scan_i,'Value')==1% case of scanning along index i 1792 num1=num1+increment;1793 num2=num2+increment;1794 [filename, num1,num_a,num2,num_b]=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir);1792 i1=i1+increment; 1793 i2=i2+increment; 1794 [filename,i1,j1,i2,j2]=name_generator(filebase,i1,j1,FileExt,NomType,comp_input,i2,j2,subdir); 1795 1795 if sub_value% set the second field name and indices 1796 num1_1=num1_1+increment;1797 num2_1=num2_1+increment;1798 filename_1=name_generator(filebase_1, num1_1,num_a_1,FileExt_1,NomType_1,1,num2_1,num_b_1,SubDir_1);1796 i1_1=i1_1+increment; 1797 i2_1=i2_1+increment; 1798 filename_1=name_generator(filebase_1,i1_1,j1_1,FileExt_1,NomType_1,1,i2_1,j2_1,SubDir_1); 1799 1799 end 1800 1800 else % case of scanning along index j (burst numbers) 1801 num_a=num_a+increment;1802 num_b=num_b+increment;1803 [filename, num1,num_a,num2,num_b]=name_generator(filebase,num1,num_a,FileExt,NomType,comp_input,num2,num_b,subdir);1801 j1=j1+increment; 1802 j2=j2+increment; 1803 [filename,i1,j1,i2,j2]=name_generator(filebase,i1,j1,FileExt,NomType,comp_input,i2,j2,subdir); 1804 1804 if sub_value 1805 num_a_1=num_a_1+increment;1806 num_b_1=num_b_1+increment;1807 filename_1=name_generator(filebase_1, num1_1,num_a_1,FileExt_1,NomType_1,1,num2_1,num_b_1,SubDir_1);1805 j1_1=j1_1+increment; 1806 j2_1=j2_1+increment; 1807 filename_1=name_generator(filebase_1,i1_1,j1_1,FileExt_1,NomType_1,1,i2_1,j2_1,SubDir_1); 1808 1808 end 1809 1809 end 1810 1810 1811 1811 % refresh plots 1812 errormsg=refresh_field(handles,filename,filename_1, num1,num2,num_a,num_b);1812 errormsg=refresh_field(handles,filename,filename_1,i1,i2,j1,j2); 1813 1813 if isempty(errormsg) %update the index counters 1814 set(handles.i1,'String',num2stra(num1,NomType,1)); 1815 if isequal(num2,num1) 1816 set(handles.i2,'String',''); 1814 if strcmp(NomType,'*')%case of movies 1815 set(handles.i1,'String',num2str(i1))%update the index display 1817 1816 else 1818 set(handles.i2,'String',num2stra(num2,NomType,1)); 1819 end 1820 set(handles.j1,'String',num2stra(num_a,NomType,2)); 1821 if isequal(num_b,num_a) 1822 set(handles.j2,'String',''); 1823 else 1824 set(handles.j2,'String',num2stra(num_b,NomType,2)); 1825 end 1826 [indices]=name_generator('',num1,num_a,'',NomType,1,num2,num_b,''); 1827 set(handles.FileIndex,'String',indices); 1828 if ~isempty(filename_1) 1829 indices_1=name_generator('',num1_1,num_a_1,'',NomType_1,1,num2_1,num_b_1,''); 1830 set(handles.FileIndex_1,'String',indices_1); 1831 end 1817 [~,~,i1_str,i2_str,j1_str,j2_str]=name2display(filename); 1818 set(handles.i1,'String',i1_str) 1819 set(handles.j1,'String',j1_str) 1820 if ~isequal(movie_status,1) 1821 set(handles.i2,'String',i2_str) 1822 set(handles.j2,'String',j2_str) 1823 end 1824 [indices]=name_generator('',i1,j1,'',NomType,1,i2,j2,''); 1825 set(handles.FileIndex,'String',indices); 1826 if ~isempty(filename_1) 1827 indices_1=name_generator('',i1_1,j1_1,'',NomType_1,1,i2_1,j2_1,''); 1828 set(handles.FileIndex_1,'String',indices_1); 1829 end 1830 end 1831 % set(handles.i1,'String',num2stra(i1,NomType,1)); 1832 % if isequal(i2,i1) 1833 % set(handles.i2,'String',''); 1834 % else 1835 % set(handles.i2,'String',num2stra(num2,NomType,1)); 1836 % end 1837 % set(handles.j1,'String',num2stra(j1,NomType,2)); 1838 % if isequal(j2,j1) 1839 % set(handles.j2,'String',''); 1840 % else 1841 % set(handles.j2,'String',num2stra(j2,NomType,2)); 1842 % end 1843 1832 1844 if isequal(movie_status,1) 1833 1845 set(handles.movie_pair,'Value',1)
Note: See TracChangeset
for help on using the changeset viewer.