Changeset 285
- Timestamp:
- Nov 18, 2011, 8:11:05 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r284 r285 1653 1653 display('files OK, processing...') 1654 1654 1655 %% get checkciv1 parameters1656 if Param.CheckCiv11657 % Param.Civ1=read_param_civ1(handles,filecell);1658 end1659 1660 %% get checkfix1 parameters1661 if Param.CheckFix11662 param.fix1=read_param_fix1(handles,filecell);1663 end1664 1655 1665 1656 %% get checkpatch1 parameters … … 1733 1724 OutputFile=regexprep(OutputFile,'.nc',''); 1734 1725 1735 1736 %CheckCiv11737 1726 if Param.CheckCiv1 1738 1727 % read image-dependent parameters … … 1743 1732 Param.Civ1.term_a=num2stra(num_a_civ1(j),nom_type_nc);%UTILITE? 1744 1733 Param.Civ1.term_b=num2stra(num_b_civ1(j),nom_type_nc);% 1745 Param.Civ1.pxcmx=1; %velocities are expressed in pixel dispalcement 1746 Param.Civ1.pxcmy=1; 1747 % if exist('file_ima','var') 1748 A=imread(filecell.ima1.civ1{1,1});%read the first image to get the size 1749 sizim=size(A); 1750 Param.Civ1.npx=(sizim(2)); 1751 Param.Civ1.npy=(sizim(1)); 1752 %TODO : civ should not need npx and npy 1753 1754 1755 1734 Param.Civ1.pxcmx=1; %velocities are expressed in pixel dispalcement 1735 Param.Civ1.pxcmy=1; 1736 1737 A=imread(filecell.ima1.civ1{1,1});%read the first image to get the size 1738 sizim=size(A); 1739 Param.Civ1.npx=(sizim(2)); 1740 Param.Civ1.npy=(sizim(1)); 1741 %TODO : civ should not need npx and npy 1742 1756 1743 % read mask parameters 1757 % dummy=get(handles.CheckMask,'Value');1758 1744 if Param.Civ1.CheckMask % the lines below should be changed with the new gui 1759 1745 %matbe they when check_mask the Maskname is read 1760 maskdispl=get(handles.txt_MaskName,'String'); 1761 if exist(maskdispl,'file') 1762 Param.Civ1.maskname=maskdispl; 1763 Param.Civ1.maskflag='y'; 1746 if exist(Param.Civ1.MaskName,'file') 1747 Param.Civ1.MaskFlag='y'; 1764 1748 else 1765 maskbase=[filecell.filebase '_' maskdispl]; %1749 maskbase=[filecell.filebase '_' Param.Civ1.MaskName]; % 1766 1750 nbslice_mask=str2double(maskdispl(1:end-4)); % 1767 1751 num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1; 1768 Param.Civ1. maskname=name_generator(maskbase,num1_mask,1,'.png','_i');1769 if exist(Param.Civ1. maskname,'file')1752 Param.Civ1.MaskName=name_generator(maskbase,num1_mask,1,'.png','_i'); 1753 if exist(Param.Civ1.MaskName,'file') 1770 1754 Param.Civ1.maskflag='y'; 1771 1755 else 1772 Param.Civ1. maskname='noFile use default';1773 Param.Civ1. maskflag='n';1756 Param.Civ1.MaskName='noFile use default'; 1757 Param.Civ1.MaskFlag='n'; 1774 1758 end 1775 1759 end 1776 1760 else 1777 Param.Civ1. maskname='noFile use default';1778 Param.Civ1. maskflag='n';1761 Param.Civ1.MaskName='noFile use default'; 1762 Param.Civ1.MaskFlag='n'; 1779 1763 end 1780 1764 1781 1765 % read grid parameters= 1782 1783 1766 if Param.Civ1.CheckGrid 1784 Caram.Civ1.gridflag='y'; 1785 gridname=get(handles.txt_GridName,'String'); 1786 if isequal(gridname(end-3:end),'grid') 1787 nbslice_grid=str2double(gridname(1:end-4)); % 1767 Param.Civ1.GridFlag='y'; 1768 if isequal(Param.Civ1.GridName(end-3:end),'grid') 1769 nbslice_grid=str2double(Param.Civ1.GridName(1:end-4)); % 1788 1770 if ~isnan(nbslice_grid) 1789 1771 num1_grid=mod(num1_civ1(ifile)-1,nbslice_grid)+1; 1790 Param.Civ1. gridname=[filecell.filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')];1791 if ~exist(Param.Civ1. gridname,'file')1772 Param.Civ1.GridName=[filecell.filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; 1773 if ~exist(Param.Civ1.GridName,'file') 1792 1774 msgbox_uvmat('ERROR','grid file absent for civ1') 1793 1775 end 1794 elseif exist(gridname,'file') 1795 Param.Civ1.gridname=gridname; 1796 else 1776 elseif ~exist(Param.Civ1.GridName,'file') 1797 1777 msgbox_uvmat('ERROR','grid file absent for civ1') 1798 1778 end 1799 1779 end 1800 1780 else 1801 Param.Civ1. gridname='noFile use default';1802 Param.Civ1. gridflag='n';1781 Param.Civ1.GridName='noFile use default'; 1782 Param.Civ1.GridFlag='n'; 1803 1783 end 1804 1784 1785 % send command 1805 1786 switch CivMode 1806 1787 case 'CivX' … … 1822 1803 end 1823 1804 1824 % CheckFix11825 1805 if Param.CheckFix1 1826 1806 switch CivMode 1827 1807 case 'CivX' 1828 if isunix %unix system 1829 cmd_FIX=[Param.xml.FixBin ' -f ' filecell.nc.civ1{ifile,j} ' -fi1 ' num2str(param.fix1.flagindex1(1)) ... 1830 ' -fi2 ' num2str(param.fix1.flagindex1(2)) ' -fi3 ' num2str(param.fix1.flagindex1(3)) ... 1831 ' -threshC ' num2str(param.fix1.thresh_vecC1) ' -threshV ' num2str(param.fix1.thresh_vel1) ' -maskName ' param.fix1.maskname]; 1832 else %windows system 1833 cmd_FIX=['"' Param.xml.FixBin '" -f "' filecell.nc.civ1{ifile,j} '" -fi1 ' num2str(param.fix1.flagindex1(1)) ... 1834 ' -fi2 ' num2str(param.fix1.flagindex1(2)) ' -fi3 ' num2str(param.fix1.flagindex1(3)) ... 1835 ' -threshC ' num2str(param.fix1.thresh_vecC1) ' -threshV ' num2str(param.fix1.thresh_vel1) ' -maskName "' param.fix1.maskname '"']; 1836 cmd_FIX=regexprep(cmd_FIX,'\\','\\\\'); 1837 end 1838 cmd=[cmd cmd_FIX '\n']; 1808 cmd=[cmd... 1809 cmd_fix(filecell.nc.civ1{ifile,j},Param,'Fix1') '\n']; 1839 1810 case 'CivAll' 1840 1811 fix1.inputFileName=filecell.nc.civ1{ifile,j} ; … … 4294 4265 %------------------------------------------------------------------------ 4295 4266 % --- Read the parameters for checkciv1 on the interface 4296 function par=read_param_civ1(handles,filecell) 4297 %------------------------------------------------------------------------ 4298 ibx_val=str2double(get(handles.num_Bx,'String')); 4299 par.ibx=num2str(ibx_val); 4300 iby_val=str2double(get(handles.num_By,'String')); 4301 par.iby=num2str(iby_val); 4302 isx=get(handles.num_Sx,'String'); 4303 if isnan(str2double(isx)), isx='41'; set(handles.num_Sx,'String','41'), end; %default 4304 if str2double(isx)<ibx_val+8,isx=num2str(ibx_val+8); set(handles.num_Sx,'String',num2str(ibx_val+8)); end 4305 isy=get(handles.num_Sy,'String'); 4306 if isnan(str2double(isy)), isy='41'; set(handles.num_Sy,'String','41'), end;%default 4307 if str2double(isy)<iby_val+8,isy=num2str(iby_val+8); set(handles.num_Sy,'String',num2str(iby_val+8)); end 4308 par.isx=get(handles.num_Sx,'String'); 4309 par.isy=get(handles.num_Sy,'String'); 4310 par.shiftx=get(handles.num_Shiftx,'String'); 4311 par.shifty=get(handles.num_Shifty,'String'); 4312 if isnan(str2double(par.isx)) 4313 par.isx='41';%default 4314 set(handles.num_Sx,'String','41'); 4315 end 4316 if isnan(str2double(par.isy)) 4317 par.isy='41'; %default 4318 set(handles.num_Sy,'String','41'); 4319 end 4320 if isnan(str2double(par.shiftx)) 4321 par.shiftx='0';%default 4322 set(handles.num_Shiftx,'String','0'); 4323 end 4324 if isnan(str2double(par.shifty)) 4325 par.shifty='0'; %default 4326 set(handles.num_Shifty,'String','0'); 4327 end 4328 par.rho=get(handles.num_Rho,'String'); 4329 if isequal(get(handles.num_Rho,'Style'),'popupmenu') 4330 index=get(handles.num_Rho,'Value'); 4331 par.rho=par.rho{index}; 4332 end 4333 dummy=get(handles.num_Dx,'String'); 4334 par.dx=dummy{1}; 4335 dummy=get(handles.num_Dy,'String'); 4336 par.dy=dummy{1}; 4337 if isnan(str2double(par.dx)) 4338 if isempty(get(handles.txt_GridName,'String')); 4339 par.dx='0'; %just read by civ program, not used 4340 else 4341 par.dx='20';%default 4342 set(handles.num_Dx,'String','20'); 4343 end 4344 end 4345 if isnan(str2double(par.dy)) 4346 if isempty(get(handles.txt_GridName,'String')); 4347 par.dy='0';%just read by civ program, not used 4348 else 4349 par.dy='20';%default 4350 set(handles.dy_civ1_title,'String','20'); 4351 end 4352 end 4353 par.pxcmx='1'; %velocities are expressed in pixel dispalcement 4354 par.pxcmy='1'; 4355 % if exist('file_ima','var') 4356 A=imread(filecell.ima1.civ1{1,1});%read the first image to get the size 4357 sizim=size(A); 4358 par.npx=num2str(sizim(2)); 4359 par.npy=num2str(sizim(1)); 4360 %TODO : civ should not need npx and npy 4361 4362 4267 % function par=read_param_civ1(handles,filecell) 4268 % % not deeden anymore 4269 % %------------------------------------------------------------------------ 4270 % ibx_val=str2double(get(handles.num_Bx,'String')); 4271 % par.ibx=num2str(ibx_val); 4272 % iby_val=str2double(get(handles.num_By,'String')); 4273 % par.iby=num2str(iby_val); 4274 % isx=get(handles.num_Sx,'String'); 4275 % if isnan(str2double(isx)), isx='41'; set(handles.num_Sx,'String','41'), end; %default 4276 % if str2double(isx)<ibx_val+8,isx=num2str(ibx_val+8); set(handles.num_Sx,'String',num2str(ibx_val+8)); end 4277 % isy=get(handles.num_Sy,'String'); 4278 % if isnan(str2double(isy)), isy='41'; set(handles.num_Sy,'String','41'), end;%default 4279 % if str2double(isy)<iby_val+8,isy=num2str(iby_val+8); set(handles.num_Sy,'String',num2str(iby_val+8)); end 4280 % par.isx=get(handles.num_Sx,'String'); 4281 % par.isy=get(handles.num_Sy,'String'); 4282 % par.shiftx=get(handles.num_Shiftx,'String'); 4283 % par.shifty=get(handles.num_Shifty,'String'); 4284 % if isnan(str2double(par.isx)) 4285 % par.isx='41';%default 4286 % set(handles.num_Sx,'String','41'); 4363 4287 % end 4364 %time=get(handles.RootName,'UserData'); %get the set of times 4365 dummy=get(handles.txt_GridName,'String'); 4366 par.gridname=dummy{1}; 4367 par.gridflag='y'; 4368 if strcmp(par.gridname,'')|| isempty(par.gridname) 4369 par.gridname='nogrid'; 4370 par.gridflag='n'; 4371 end 4372 4288 % if isnan(str2double(par.isy)) 4289 % par.isy='41'; %default 4290 % set(handles.num_Sy,'String','41'); 4291 % end 4292 % if isnan(str2double(par.shiftx)) 4293 % par.shiftx='0';%default 4294 % set(handles.num_Shiftx,'String','0'); 4295 % end 4296 % if isnan(str2double(par.shifty)) 4297 % par.shifty='0'; %default 4298 % set(handles.num_Shifty,'String','0'); 4299 % end 4300 % par.rho=get(handles.num_Rho,'String'); 4301 % if isequal(get(handles.num_Rho,'Style'),'popupmenu') 4302 % index=get(handles.num_Rho,'Value'); 4303 % par.rho=par.rho{index}; 4304 % end 4305 % dummy=get(handles.num_Dx,'String'); 4306 % par.dx=dummy{1}; 4307 % dummy=get(handles.num_Dy,'String'); 4308 % par.dy=dummy{1}; 4309 % if isnan(str2double(par.dx)) 4310 % if isempty(get(handles.txt_GridName,'String')); 4311 % par.dx='0'; %just read by civ program, not used 4312 % else 4313 % par.dx='20';%default 4314 % set(handles.num_Dx,'String','20'); 4315 % end 4316 % end 4317 % if isnan(str2double(par.dy)) 4318 % if isempty(get(handles.txt_GridName,'String')); 4319 % par.dy='0';%just read by civ program, not used 4320 % else 4321 % par.dy='20';%default 4322 % set(handles.dy_civ1_title,'String','20'); 4323 % end 4324 % end 4325 % par.pxcmx='1'; %velocities are expressed in pixel dispalcement 4326 % par.pxcmy='1'; 4327 % % if exist('file_ima','var') 4328 % A=imread(filecell.ima1.civ1{1,1});%read the first image to get the size 4329 % sizim=size(A); 4330 % par.npx=num2str(sizim(2)); 4331 % par.npy=num2str(sizim(1)); 4332 % %TODO : civ should not need npx and npy 4333 % 4334 % 4335 % % end 4336 % %time=get(handles.RootName,'UserData'); %get the set of times 4337 % dummy=get(handles.txt_GridName,'String'); 4338 % par.gridname=dummy{1}; 4339 % par.gridflag='y'; 4340 % if strcmp(par.gridname,'')|| isempty(par.gridname) 4341 % par.gridname='nogrid'; 4342 % par.gridflag='n'; 4343 % end 4344 % 4373 4345 %------------------------------------------------------------------------ 4374 4346 function par=read_param_fix1(handles,filecell) … … 5430 5402 %changes : filename_cmx -> filename ( no extension ) 5431 5403 5432 filename=regexprep(filename,'.nc','') 5404 filename=regexprep(filename,'.nc',''); 5433 5405 5434 5406 if isequal(Param.Civ1.Dt,'0') … … 5442 5414 fprintf(fid, ['LastImage ' regexprep(Param.Civ1.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility 5443 5415 fprintf(fid, ['XX' '\n' ]); 5444 fprintf(fid, ['Mask ' Param.Civ1. maskflag '\n' ]);5445 fprintf(fid, ['MaskName ' regexprep(Param.Civ1. maskname,'\\','\\\\') '\n' ]);5416 fprintf(fid, ['Mask ' Param.Civ1.MaskFlag '\n' ]); 5417 fprintf(fid, ['MaskName ' regexprep(Param.Civ1.MaskName,'\\','\\\\') '\n' ]); 5446 5418 fprintf(fid, ['ImageSize ' num2str(Param.Civ1.npx) ' ' num2str(Param.Civ1.npy) '\n' ]); %VERIFIER CAS GENERAL ? 5447 5419 fprintf(fid, ['CorrelationBoxesSize ' num2str(Param.Civ1.Bx) ' ' num2str(Param.Civ1.By) '\n' ]); … … 5454 5426 fprintf(fid, ['XX 1' '\n' ]); 5455 5427 fprintf(fid, ['ShiftXY ' num2str(Param.Civ1.Shiftx) ' ' num2str(Param.Civ1.Shifty) '\n' ]); 5456 fprintf(fid, ['Grid ' Param.Civ1. gridflag '\n' ]);5457 fprintf(fid, ['GridName ' regexprep(Param.Civ1. gridname,'\\','\\\\') '\n' ]);5428 fprintf(fid, ['Grid ' Param.Civ1.GridFlag '\n' ]); 5429 fprintf(fid, ['GridName ' regexprep(Param.Civ1.GridName,'\\','\\\\') '\n' ]); 5458 5430 fprintf(fid, ['XX 85' '\n' ]); 5459 5431 fprintf(fid, ['XX 1.0' '\n' ]); … … 5488 5460 cmd=[cmd 'del "' filename '.cmx']; 5489 5461 end 5462 5463 5464 function cmd=cmd_fix(filename,Param,fixname) 5465 %% 5466 filename=regexprep(filename,'.nc',''); 5467 if isunix 5468 cmd=[Param.xml.FixBin ' -f ' filename '.nc -fi1 ' num2str(Param.(fixname).flagindex(1)) ... 5469 ' -fi2 ' num2str(Param.(fixname).flagindex(2)) ' -fi3 ' num2str(Param.(fixname).flagindex(3)) ... 5470 ' -threshC ' num2str(Param.(fixname).thresh_vecC) ' -threshV ' num2str(Param.(fixname).thresh_vel)... 5471 ' -maskName ' Param.(fixname).MaskName '" > ' filename '.fix1.log']; 5472 else 5473 cmd=['"' Param.xml.FixBin '" -f "' filename '.nc" -fi1 ' num2str(Param.(fixname).CheckFmin2)... 5474 ' -fi2 ' num2str(Param.(fixname).CheckF2) ' -fi3 ' num2str(Param.(fixname).CheckF3) ... 5475 ' -threshC ' num2str(Param.(fixname).MinCorr)... 5476 ' -maskName "' Param.(fixname).MaskName '" > "' filename '.fix1.log"']; 5477 % ' -threshV ' num2str(Param.(fixname).thresh_vel)... 5478 cmd=regexprep(cmd,'\\','\\\\'); 5479 end
Note: See TracChangeset
for help on using the changeset viewer.