- Timestamp:
- May 28, 2010, 10:06:47 AM (15 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r91 r94 113 113 sparam=convert(t); 114 114 catch 115 errormsg={ [' Unable to read the file PARAM.xml defining the civx binaries:']; lasterr};115 errormsg={' Unable to read the file PARAM.xml defining the civx binaries:'; lasterr}; 116 116 end 117 117 else … … 131 131 set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784])% put the BATCH button in grey (unactivated) 132 132 end 133 if isfield(sparam.RunParam,'CivBin') 134 if ~exist(sparam.RunParam.CivBin,'file') 135 sparam.RunParam.CivBin=fullfile(path_UVMAT,sparam.RunParam.CivBin); 136 end 137 end 138 patch_newBin=exist(sparam.RunParam.CivBin,'file'); 133 139 set(handles.subdir_civ1,'String',subdir)%default subdir on which uvmat was working 134 140 set(handles.subdir_civ2,'String',subdir)%default subdir on which uvmat was working … … 304 310 browse=get(handles.browse_root,'UserData'); 305 311 end 306 if length(ext)>1 && (~isempty(imformats(ext( [2:end])))||...312 if length(ext)>1 && (~isempty(imformats(ext(2:end)))||... 307 313 isequal(ext,'.avi')||isequal(ext,'.AVI'));%if an image file has been opened by uvmat 308 314 set(handles.ImaExt,'String',ext) … … 551 557 if isfield(XmlData,'GeometryCalib') 552 558 tsai=XmlData.GeometryCalib; 553 if isfield(tsai,'f') & isfield(tsai,'Tz') & isfield(tsai,'dpx') & isfield(tsai,'dpy')& isfield(tsai,'R')554 rot2D=tsai.R( [1:2],[1,2]);559 if isfield(tsai,'f') && isfield(tsai,'Tz') && isfield(tsai,'dpx') && isfield(tsai,'dpy')&& isfield(tsai,'R') 560 rot2D=tsai.R(1:2,[1,2]); 555 561 pxcmx_search=tsai.f * sqrt(det(rot2D))/(tsai.Tz*tsai.dpx); 556 562 pxcmy_search=tsai.f * sqrt(det(rot2D))/(tsai.Tz*tsai.dpy); … … 587 593 nbfield=info.NumFrames;%number of frames 588 594 end 589 time=(dt* [0:nbfield-1])';%list of image times595 time=(dt*(0:nbfield-1))';%list of image times 590 596 %set(handles.dt,'String',num2str(dt*1000));%store the time interval between successive images 591 597 end … … 665 671 %determine the set of times and possible intervals for CIV 666 672 % dt=(1/1000)*str2num(get(handles.dt,'String')); 667 time= [0:nb_field-1]';% time=file index -1 by default673 time=(0:nb_field-1)';% time=file index -1 by default 668 674 if strcmp(nom_type_ima,'_i_j') 669 675 % time=[0:nb_field-1]'*ones(1,nb_field_j);% time=file index -1 by default … … 1157 1163 nom_type_nc=browse.nom_type_nc; 1158 1164 end 1159 if isequal(nom_type_ima,'png_old') | isequal(nom_type_ima,'netc_old')| isequal(nom_type_ima,'raw_SMD')| isequal(nom_type_nc,'netc_old')1165 if isequal(nom_type_ima,'png_old') || isequal(nom_type_ima,'netc_old')|| isequal(nom_type_ima,'raw_SMD')|| isequal(nom_type_nc,'netc_old') 1160 1166 nom_type_nc='netc_old';%nom_type for the netcdf files 1161 elseif isequal(nom_type_ima,'none')| isequal(nom_type_nc,'none')1167 elseif isequal(nom_type_ima,'none')||isequal(nom_type_nc,'none') 1162 1168 nom_type_nc='none'; 1163 elseif isequal(nom_type_ima,'avi')| isequal(nom_type_ima,'_i')|isequal(nom_type_ima,'ima_num')|isequal(nom_type_nc,'_i1-i2')1169 elseif isequal(nom_type_ima,'avi')||isequal(nom_type_ima,'_i')||isequal(nom_type_ima,'ima_num')||isequal(nom_type_nc,'_i1-i2') 1164 1170 nom_type_nc='_i1-i2'; 1165 1171 else … … 2030 2036 function launch_jobs(hObject, eventdata, handles, batch) 2031 2037 %----------------------------------------------------------------------- 2032 % global civ2Bin patchBin patch_newBin fixBin CivBin % probabely to remove2033 2034 2038 compare=get(handles.compare,'Value');%test for usual PIV (compare=1) or displacement (=2) or stereo PIV (=3) 2035 2039 … … 2117 2121 end 2118 2122 if isfield(sparam,'CivBin') 2119 CivBin=sparam.CivBin; 2123 if ~exist(sparam.CivBin,'file') 2124 sparam.CivBin=fullfile(path_UVMAT,sparam.CivBin); 2125 end 2120 2126 end 2121 2127 if isfield(sparam,'Civ1Bin') 2122 civ1Bin=sparam.Civ1Bin; 2128 if ~exist(sparam.Civ1Bin,'file') 2129 sparam.Civ1Bin=fullfile(path_UVMAT,sparam.Civ1Bin); 2130 end 2123 2131 end 2124 2132 if isfield(sparam,'Civ2Bin') 2125 civ2Bin=sparam.Civ2Bin; 2133 if ~exist(sparam.Civ2Bin,'file') 2134 sparam.Civ2Bin=fullfile(path_UVMAT,sparam.Civ2Bin); 2135 end 2126 2136 end 2127 2137 test_interp=get(handles.test_interp,'Value'); 2128 2138 if ~test_interp && isfield(sparam,'PatchBin') 2129 PatchBin=sparam.PatchBin; 2139 if ~exist(sparam.PatchBin,'file') 2140 sparam.PatchBin=fullfile(path_UVMAT,sparam.PatchBin); 2141 end 2130 2142 end 2131 2143 if test_interp && isfield(sparam,'PatchNewBin') 2132 PatchBin=sparam.PatchNewBin; 2144 if ~exist(sparam.PatchNewBin,'file') 2145 sparam.PatchNewBin=fullfile(path_UVMAT,sparam.PatchNewBin); 2146 end 2133 2147 end 2134 2148 if isfield(sparam,'FixBin') 2135 fixBin=sparam.FixBin; 2149 % fixBin=sparam.FixBin; 2150 if ~exist(sparam.FixBin,'file') 2151 sparam.FixBin=fullfile(path_UVMAT,sparam.FixBin); 2152 end 2136 2153 end 2137 2154 if batch … … 2399 2416 i_cmd=i_cmd+1; 2400 2417 if isequal(civAll,0) 2401 cmd=[cmd BATCH_CIV1(filename_cmx(1:end-4),namelog,par_civ1,handles,sparam) '\n'];2418 cmd=[cmd CIV1_CMD(filename_cmx(1:end-4),namelog,par_civ1,handles,sparam) '\n']; 2402 2419 else 2403 2420 civAllCmd=[civAllCmd ' civ1 ']; 2404 str= BATCH_CIV1_Unified(filename_cmx([1:end-4]),namelog,par_civ1);2421 str=CIV1_CMD_Unified(filename_cmx([1:end-4]),namelog,par_civ1); 2405 2422 fieldnames=fields(str); 2406 2423 [civAllxml,uid_civ1]=add(civAllxml,1,'element','civ1'); … … 2428 2445 end 2429 2446 if isequal(civAll,0) 2430 cmd_FIX=[fixBin ' -f ' filecell.nc.civ1{ifile,j} ' -fi1 ' num2str(flagindex1(1)) ...2447 cmd_FIX=[sparam.FixBin ' -f ' filecell.nc.civ1{ifile,j} ' -fi1 ' num2str(flagindex1(1)) ... 2431 2448 ' -fi2 ' num2str(flagindex1(2)) ' -fi3 ' num2str(flagindex1(3)) ... 2432 2449 ' -threshC ' num2str(thresh_vecC1) ' -threshV ' num2str(thresh_vel1) ' -maskName ' maskname]; 2433 cmd=[cmd cmd_FIX '\n']; 2450 cmd_FIX=regexprep(cmd_FIX,'\\','\\\\'); 2451 cmd=[cmd cmd_FIX '\n']; 2434 2452 else 2435 2453 fix1.inputFileName=filecell.nc.civ1{ifile,j} ; … … 2455 2473 if box_test(3)==1 2456 2474 if isequal(civAll,0) 2457 cmd_PATCH=RUN_PATCH(filecell.nc.civ1{ifile,j},nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,test_interp,PatchBin); 2475 cmd_PATCH=PATCH_CMD(filecell.nc.civ1{ifile,j},nx_patch1,ny_patch1,rho_patch1,subdomain_patch1,thresh_patch1,test_interp,sparam.PatchBin); 2476 cmd_PATCH=regexprep(cmd_PATCH,'\\','\\\\'); 2458 2477 cmd=[cmd cmd_PATCH '\n']; 2459 2478 else … … 2565 2584 %endTESTgrid 2566 2585 i_cmd=i_cmd+1; 2567 cmd_CIV2= BATCH_CIV2(filename_cmx,namelog,par_civ2,sparam);2586 cmd_CIV2=CIV2_CMD(filename_cmx,namelog,par_civ2,sparam); 2568 2587 if isequal(civAll,0) 2569 2588 if(isunix) 2570 2589 cmd=[cmd 'cp -f ' filename_cmx '2 ' filename_cmx '\n' cmd_CIV2 '\n']; 2571 2590 else 2591 filename_cmx=regexprep(filename_cmx,'\\','\\\\'); 2572 2592 cmd=[cmd 'copy /Y ' filename_cmx '2 ' filename_cmx '\n' cmd_CIV2 '\n']; 2573 2593 end 2574 2594 else 2575 2595 civAllCmd=[civAllCmd ' civ2 ']; 2576 str= BATCH_CIV2_Unified(filename_cmx([1:end-4]),namelog,par_civ2);2596 str=CIV2_CMD_Unified(filename_cmx([1:end-4]),namelog,par_civ2); 2577 2597 fieldnames=fields(str); 2578 2598 [civAllxml,uid_civ2]=add(civAllxml,1,'element','civ2'); … … 2600 2620 end 2601 2621 if isequal(civAll,0) 2602 cmd_FIX=[ fixBin ' -f ' filecell.nc.civ2{ifile,j} ' -fi1 ' num2str(flagindex2(1)) ...2622 cmd_FIX=[sparam.FixBin ' -f ' filecell.nc.civ2{ifile,j} ' -fi1 ' num2str(flagindex2(1)) ... 2603 2623 ' -fi2 ' num2str(flagindex2(2)) ' -fi3 ' num2str(flagindex2(3)) ... 2604 2624 ' -threshC ' num2str(thresh_vec2C) ' -threshV ' num2str(thresh_vel2) ' -maskName ' maskname]; 2605 cmd=[cmd cmd_FIX '\n']; 2625 cmd_FIX=regexprep(cmd_FIX,'\\','\\\\'); 2626 cmd=[cmd cmd_FIX '\n']; 2606 2627 else 2607 2628 fix2.inputFileName=filecell.nc.civ2{ifile,j} ; … … 2627 2648 if box_test(6)==1 2628 2649 if isequal(civAll,0) 2629 cmd_PATCH=RUN_PATCH(filecell.nc.civ2{ifile,j},nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,thresh_patch2,test_interp,PatchBin); 2650 cmd_PATCH=PATCH_CMD(filecell.nc.civ2{ifile,j},nx_patch2,ny_patch2,rho_patch2,subdomain_patch2,thresh_patch2,test_interp,sparam.PatchBin); 2651 cmd_PATCH=regexprep(cmd_PATCH,'\\','\\\\'); 2630 2652 cmd=[cmd cmd_PATCH '\n']; 2631 2653 else … … 3769 3791 %------------------------------------------------------------------------ 3770 3792 % --- PATCH 3771 function cmd_PATCH=RUN_PATCH(filename_nc,nx_patch,ny_patch,rho_patch,subdomain_patch,thresh_value,test_interp,PatchBin) 3772 %------------------------------------------------------------------------ 3773 %global patchBin patch_newBin 3774 3775 3793 function cmd_PATCH=PATCH_CMD(filename_nc,nx_patch,ny_patch,rho_patch,subdomain_patch,thresh_value,test_interp,PatchBin) 3794 %------------------------------------------------------------------------ 3776 3795 namelog=[filename_nc([1:end-3]) '_patch.log']; 3777 3796 if test_interp==0 … … 4482 4501 set(handles.nx_patch1_title,'Visible','on') 4483 4502 set(handles.ny_patch1_title,'Visible','on') 4484 if (~isequal(patch_newBin,[]) & ~isequal(patch_newBin,[]))4503 if ~isempty(patch_newBin) 4485 4504 set(handles.test_interp,'Visible','on'); 4486 4505 end … … 4784 4803 %------------------------------------------------------------------------ 4785 4804 % --- CIV1 CIV1 CIV1 CIV1 4786 function cmd_CIV1= BATCH_CIV1(filename,namelog,par,handles,sparam)4805 function cmd_CIV1=CIV1_CMD(filename,namelog,par,handles,sparam) 4787 4806 %------------------------------------------------------------------------ 4788 4807 %pixels per cm and matrix of the image times, read from the .civ file by uvmat … … 4827 4846 % textout=char(textcmx); 4828 4847 par.filename_ima_a=regexprep(par.filename_ima_a,'.png',''); 4829 par.filename_ima_b=regexprep(par.filename_ima_b,'.png',''); % bug : .png appears two times ?4830 4848 par.filename_ima_b=regexprep(par.filename_ima_b,'.png',''); 4849 fid=fopen([filename '.cmx'],'w'); 4831 4850 fprintf(fid,['############## CMX file' '\n' ]); 4832 4851 fprintf(fid, ['FirstImage ' regexprep(par.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility … … 4834 4853 fprintf(fid, ['XX' '\n' ]); 4835 4854 fprintf(fid, ['Mask ' par.maskflag '\n' ]); 4836 fprintf(fid, ['MaskName ' par.maskname'\n' ]);4855 fprintf(fid, ['MaskName ' regexprep(par.maskname,'\\','\\\\') '\n' ]); 4837 4856 fprintf(fid, ['ImageSize ' par.npx ' ' par.npy '\n' ]); %VERIFIER CAS GENERAL ? 4838 4857 fprintf(fid, ['CorrelationBoxesSize ' par.ibx ' ' par.iby '\n' ]); … … 4846 4865 fprintf(fid, ['ShiftXY ' par.shiftx ' ' par.shifty '\n' ]); 4847 4866 fprintf(fid, ['Grid ' par.gridflag '\n' ]); 4848 fprintf(fid, ['GridName ' par.gridname'\n' ]);4867 fprintf(fid, ['GridName ' regexprep(par.gridname,'\\','\\\\') '\n' ]); 4849 4868 fprintf(fid, ['XX 85' '\n' ]); 4850 4869 fprintf(fid, ['XX 1.0' '\n' ]); … … 4875 4894 %------------------------------------------------------------------------ 4876 4895 % --- CIV1 Unified 4877 function xml_civ1_parameters= BATCH_CIV1_Unified(filename,namelog,par)4896 function xml_civ1_parameters=CIV1_CMD_Unified(filename,namelog,par) 4878 4897 %------------------------------------------------------------------------ 4879 4898 %pixels per cm and matrix of the image times, read from the .civ file by uvmat … … 4914 4933 %------------------------------------------------------------------------ 4915 4934 % --- CIV2 Unified 4916 function civ2= BATCH_CIV2_Unified(filename,namelog,par)4935 function civ2=CIV2_CMD_Unified(filename,namelog,par) 4917 4936 %------------------------------------------------------------------------ 4918 4937 %pixels per cm and matrix of the image times, read from the .civ file by uvmat … … 4966 4985 %------------------------------------------------------------------------ 4967 4986 % --- CIV2 CIV2 CIV2 CIV2 4968 function cmd_CIV2= BATCH_CIV2(filename_cmx,namelog,par,sparam)4987 function cmd_CIV2=CIV2_CMD(filename_cmx,namelog,par,sparam) 4969 4988 %------------------------------------------------------------------------ 4970 4989 %pixels per cm and matrix of the image times, read from the .civ file by uvmat … … 4973 4992 par.Dt='1' ;%case of 'displacement' mode 4974 4993 end 4975 textcmx=['############## CMX file' '\n'... 4976 ['FirstImage ' par.filename_ima_a] '\n'... 4977 ['LastImage ' par.filename_ima_b] '\n'... 4978 'XX' '\n'... 4979 ['Mask ' par.maskflag] '\n'... 4980 ['MaskName ' par.maskname] '\n'... 4981 ['ImageSize ' par.npx ' ' par.npy] '\n'... 4982 ['CorrelationBoxesSize ' par.ibx ' ' par.iby] '\n'... 4983 ['SearchBoxeSize ' par.ibx ' ' par.iby] '\n'... 4984 ['RO ' par.rho] '\n'... 4985 ['GridSpacing ' par.dx ' ' par.dy] '\n'... 4986 'XX 1.0' '\n'... 4987 ['Dt_TO ' par.Dt ' ' par.T0] '\n'... 4988 ['PixCmXY ' par.pxcmx ' ' par.pxcmy] '\n'... 4989 'XX 1' '\n'... 4990 ['ShiftXY 0 0'] '\n'... 4991 ['Grid ' par.gridflag] '\n'... 4992 ['GridName ' par.gridname] '\n'... 4993 'XX 85' '\n'... 4994 'XX 1.0' '\n'... 4995 'XX 1.0' '\n'... 4996 'Hart 1' '\n'... 4997 ['DecimalShift ' par.decimal] '\n'... 4998 ['Deformation ' par.deformation] '\n'... 4999 'CorrelationMin 0' '\n'... 5000 'IntensityMin 0' '\n'... 5001 'SeuilImage n' '\n'... 5002 'SeuilImageValues 0 4096' '\n'... 5003 ['ImageToUse ' par.term_a ' ' par.term_b] '\n'... % VERIFIER ? 5004 ['ImageUsedBefore ' par.filename_nc1]]; 5005 textout=char(textcmx); 5006 fid=fopen([filename_cmx '2'],'w'); 5007 fprintf(fid,textout); 5008 fclose(fid) 5009 % if sge 5010 cmd_CIV2=[sparam.Civ2Bin ' -f ' filename_cmx ]; % redirect standard output to the log file 5011 % else 5012 % cmd_CIV2=[civ2Bin ' -f ' filename_cmx ' > ' namelog ' 2>&1']; % redirect standard output to the log file 5013 % end 4994 % textcmx=['############## CMX file' '\n'... 4995 % ['FirstImage ' par.filename_ima_a] '\n'... 4996 % ['LastImage ' par.filename_ima_b] '\n'... 4997 % 'XX' '\n'... 4998 % ['Mask ' par.maskflag] '\n'... 4999 % ['MaskName ' par.maskname] '\n'... 5000 % ['ImageSize ' par.npx ' ' par.npy] '\n'... 5001 % ['CorrelationBoxesSize ' par.ibx ' ' par.iby] '\n'... 5002 % ['SearchBoxeSize ' par.ibx ' ' par.iby] '\n'... 5003 % ['RO ' par.rho] '\n'... 5004 % ['GridSpacing ' par.dx ' ' par.dy] '\n'... 5005 % 'XX 1.0' '\n'... 5006 % ['Dt_TO ' par.Dt ' ' par.T0] '\n'... 5007 % ['PixCmXY ' par.pxcmx ' ' par.pxcmy] '\n'... 5008 % 'XX 1' '\n'... 5009 % ['ShiftXY 0 0'] '\n'... 5010 % ['Grid ' par.gridflag] '\n'... 5011 % ['GridName ' par.gridname] '\n'... 5012 % 'XX 85' '\n'... 5013 % 'XX 1.0' '\n'... 5014 % 'XX 1.0' '\n'... 5015 % 'Hart 1' '\n'... 5016 % ['DecimalShift ' par.decimal] '\n'... 5017 % ['Deformation ' par.deformation] '\n'... 5018 % 'CorrelationMin 0' '\n'... 5019 % 'IntensityMin 0' '\n'... 5020 % 'SeuilImage n' '\n'... 5021 % 'SeuilImageValues 0 4096' '\n'... 5022 % ['ImageToUse ' par.term_a ' ' par.term_b] '\n'... % VERIFIER ? 5023 % ['ImageUsedBefore ' par.filename_nc1]]; 5024 % textout=char(textcmx); 5025 % fid=fopen([filename_cmx '2'],'w'); 5026 % fprintf(fid,textout); 5027 % fclose(fid) 5028 5029 par.filename_ima_a=regexprep(par.filename_ima_a,'.png',''); 5030 par.filename_ima_b=regexprep(par.filename_ima_b,'.png','');% bug : .png appears two times ? 5031 fid=fopen([filename_cmx '2'],'w'); 5032 fprintf(fid,['############## CMX file' '\n' ]); 5033 fprintf(fid, ['FirstImage ' regexprep(par.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility 5034 fprintf(fid, ['LastImage ' regexprep(par.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility 5035 fprintf(fid, ['XX' '\n' ]); 5036 fprintf(fid, ['Mask ' par.maskflag '\n' ]); 5037 fprintf(fid, ['MaskName ' regexprep(par.maskname,'\\','\\\\') '\n' ]);% for windows compatibility 5038 fprintf(fid, ['ImageSize ' par.npx ' ' par.npy '\n' ]); %VERIFIER CAS GENERAL ? 5039 fprintf(fid, ['CorrelationBoxesSize ' par.ibx ' ' par.iby '\n' ]); 5040 fprintf(fid, ['SearchBoxeSize ' par.ibx ' ' par.iby '\n']); 5041 fprintf(fid, ['RO ' par.rho '\n']); 5042 fprintf(fid, ['GridSpacing ' par.dx ' ' par.dy '\n']); 5043 fprintf(fid, ['XX 1.0' '\n' ]); 5044 fprintf(fid, ['Dt_TO ' par.Dt ' ' par.T0 '\n' ]); 5045 fprintf(fid, ['PixCmXY ' par.pxcmx ' ' par.pxcmy '\n' ]); 5046 fprintf(fid, ['XX 1' '\n' ]); 5047 fprintf(fid, ['ShiftXY 0 0\n']); 5048 fprintf(fid, ['Grid ' par.gridflag '\n' ]); 5049 fprintf(fid, ['GridName ' regexprep(par.gridname,'\\','\\\\') '\n']); 5050 fprintf(fid, ['XX 85' '\n' ]); 5051 fprintf(fid, ['XX 1.0' '\n' ]); 5052 fprintf(fid, ['XX 1.0' '\n' ]); 5053 fprintf(fid, ['Hart 1' '\n' ]); 5054 fprintf(fid, ['DecimalShift ' par.decimal '\n']); 5055 fprintf(fid, ['Deformation ' par.deformation '\n']); 5056 fprintf(fid, ['CorrelationMin 0' '\n' ]); 5057 fprintf(fid, ['IntensityMin 0' '\n' ]); 5058 fprintf(fid, ['SeuilImage n' '\n' ]); 5059 fprintf(fid, ['SeuilImageValues 0 4096' '\n' ]); 5060 fprintf(fid, ['ImageToUse ' par.term_a ' ' par.term_b '\n' ]); % VERIFIER ? 5061 fprintf(fid, ['ImageUsedBefore ' regexprep(par.filename_nc1,'\\','\\\\') '\n']); 5062 fclose(fid); 5063 5064 cmd_CIV2=[sparam.Civ2Bin ' -f ' filename_cmx ]; % redirect standard output to the log file 5065 cmd_CIV2=regexprep(cmd_CIV2,'\\','\\\\'); 5014 5066 5015 5067 %------------------------------------------------------------------------ -
trunk/src/plot_field.m
r93 r94 172 172 % check the cells of fields : 173 173 % testnbdim=1; 174 [CellVarIndex,NbDim,VarType,errormsg]=find_field_indices(Data) 174 [CellVarIndex,NbDim,VarType,errormsg]=find_field_indices(Data); 175 175 176 176 if ~isempty(errormsg)
Note: See TracChangeset
for help on using the changeset viewer.