Changeset 284
- Timestamp:
- Nov 18, 2011, 5:25:34 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r282 r284 1491 1491 %%read the civ GUI 1492 1492 Param=read_GUI(handles.civ) 1493 Param.Civ11494 Param.Fix11495 Param.Patch11496 1493 %% check the selected list of operations: 1497 1494 operations={'CIV1','FIX1','PATCH1','CIV2','FIX2','PATCH2'}; 1498 1495 box_test=[Param.CheckCiv1 Param.CheckFix1 Param.CheckPatch1 Param.CheckCiv2 Param.CheckFix2 Param.CheckPatch2]; 1499 % box_test(2)=get(handles.CheckFix1,'Value'); 1500 % box_test(3)=get(handles.CheckPatch1,'Value'); 1501 % box_test(4)=get(handles.CheckCiv2,'Value'); 1502 % box_test(5)=get(handles.CheckFix2,'Value'); 1503 % box_test(6)=get(handles.CheckPatch2,'Value'); 1496 1504 1497 index_first=find(box_test==1,1); 1505 1498 if isempty(index_first) … … 1581 1574 if batch 1582 1575 if isfield(s,'BatchParam') 1583 param.global=s.BatchParam;1584 if isfield( param.global,'BatchMode')1585 batch_mode= param.global.BatchMode;1576 Param.xml=s.BatchParam; 1577 if isfield(Param.xml,'BatchMode') 1578 batch_mode=Param.xml.BatchMode; 1586 1579 if ~ismember(batch_mode,{'sge','oar'}) 1587 1580 errormsg=['batch mode ' batch_mode ' not supported by UVMAT']; … … 1595 1588 else % run 1596 1589 if isfield(s,'RunParam') 1597 param.global=s.RunParam;1590 Param.xml=s.RunParam; 1598 1591 else 1599 1592 msgbox_uvmat('ERROR','no run civ binaries defined in PARAM.xml') … … 1636 1629 end 1637 1630 for bin_name=binary_list 1638 if isfield( param.global,bin_name{1})1639 if ~exist( param.global.(bin_name{1}),'file')%look for the full path if the file name has been defined with a relative path in PARAM.xml1640 fullname=fullfile(path_civ, param.global.(bin_name{1}));1631 if isfield(Param.xml,bin_name{1}) 1632 if ~exist(Param.xml.(bin_name{1}),'file')%look for the full path if the file name has been defined with a relative path in PARAM.xml 1633 fullname=fullfile(path_civ,Param.xml.(bin_name{1})) 1641 1634 if exist(fullname,'file') 1642 param.global.(bin_name{1})=fullname;1635 Param.xml.(bin_name{1})=fullname; 1643 1636 else 1644 msgbox_uvmat('ERROR',['Binary ' param.global.(bin_name{1}) ' defined in PARAM.xml does not exist'])1637 msgbox_uvmat('ERROR',['Binary ' Param.xml.(bin_name{1}) ' defined in PARAM.xml does not exist']) 1645 1638 return 1646 1639 end 1647 1640 else 1648 [path,name,ext]=fileparts( param.global.(bin_name{1}));1641 [path,name,ext]=fileparts(Param.xml.(bin_name{1})); 1649 1642 currentdir=pwd; 1650 1643 cd(path); 1651 1644 binpath=pwd;%path of the binary 1652 param.global.(bin_name{1})=fullfile(binpath,[name ext]);1653 % display( param.global.(bin_name{1}));1645 Param.xml.(bin_name{1})=fullfile(binpath,[name ext]); 1646 % display(Param.xml.(bin_name{1})); 1654 1647 cd(currentdir); 1655 1648 end … … 1662 1655 %% get checkciv1 parameters 1663 1656 if Param.CheckCiv1 1664 param.civ1=read_param_civ1(handles,filecell);1657 % Param.Civ1=read_param_civ1(handles,filecell); 1665 1658 end 1666 1659 … … 1744 1737 if Param.CheckCiv1 1745 1738 % read image-dependent parameters 1746 param.civ1.filename_ima_a=filecell.ima1.civ1{ifile,j}; 1747 param.civ1.filename_ima_b=filecell.ima2.civ1{ifile,j}; 1748 param.civ1.Dt=num2str(time(num2_civ1(ifile),num_b_civ1(j))-time(num1_civ1(ifile),num_a_civ1(j))); 1749 param.civ1.T0=num2str((time(num2_civ1(ifile),num_b_civ1(j))+time(num1_civ1(ifile),num_a_civ1(j)))/2); 1750 param.civ1.term_a=num2stra(num_a_civ1(j),nom_type_nc);%UTILITE? 1751 param.civ1.term_b=num2stra(num_b_civ1(j),nom_type_nc);% 1739 Param.Civ1.filename_ima_a=filecell.ima1.civ1{ifile,j}; 1740 Param.Civ1.filename_ima_b=filecell.ima2.civ1{ifile,j}; 1741 Param.Civ1.Dt=(time(num2_civ1(ifile),num_b_civ1(j))-time(num1_civ1(ifile),num_a_civ1(j))); 1742 Param.Civ1.T0=((time(num2_civ1(ifile),num_b_civ1(j))+time(num1_civ1(ifile),num_a_civ1(j)))/2); 1743 Param.Civ1.term_a=num2stra(num_a_civ1(j),nom_type_nc);%UTILITE? 1744 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 1752 1755 1753 1756 % read mask parameters 1754 dummy=get(handles.CheckMask,'Value'); 1755 if dummy{1} 1757 % dummy=get(handles.CheckMask,'Value'); 1758 if Param.Civ1.CheckMask % the lines below should be changed with the new gui 1759 %matbe they when check_mask the Maskname is read 1756 1760 maskdispl=get(handles.txt_MaskName,'String'); 1757 1761 if exist(maskdispl,'file') 1758 param.civ1.maskname=maskdispl;1759 param.civ1.maskflag='y';1762 Param.Civ1.maskname=maskdispl; 1763 Param.Civ1.maskflag='y'; 1760 1764 else 1761 1765 maskbase=[filecell.filebase '_' maskdispl]; % 1762 1766 nbslice_mask=str2double(maskdispl(1:end-4)); % 1763 1767 num1_mask=mod(num1_civ1(ifile)-1,nbslice_mask)+1; 1764 param.civ1.maskname=name_generator(maskbase,num1_mask,1,'.png','_i');1765 if exist( param.civ1.maskname,'file')1766 param.civ1.maskflag='y';1768 Param.Civ1.maskname=name_generator(maskbase,num1_mask,1,'.png','_i'); 1769 if exist(Param.Civ1.maskname,'file') 1770 Param.Civ1.maskflag='y'; 1767 1771 else 1768 param.civ1.maskname='noFile use default';1769 param.civ1.maskflag='n';1772 Param.Civ1.maskname='noFile use default'; 1773 Param.Civ1.maskflag='n'; 1770 1774 end 1771 1775 end 1772 1776 else 1773 param.civ1.maskname='noFile use default';1774 param.civ1.maskflag='n';1777 Param.Civ1.maskname='noFile use default'; 1778 Param.Civ1.maskflag='n'; 1775 1779 end 1776 1780 1777 1781 % read grid parameters= 1778 dummy=get(handles.CheckGrid,'Value');1779 if dummy{1}1780 param.civ1.gridflag='y';1782 1783 if Param.Civ1.CheckGrid 1784 Caram.Civ1.gridflag='y'; 1781 1785 gridname=get(handles.txt_GridName,'String'); 1782 1786 if isequal(gridname(end-3:end),'grid') … … 1784 1788 if ~isnan(nbslice_grid) 1785 1789 num1_grid=mod(num1_civ1(ifile)-1,nbslice_grid)+1; 1786 param.civ1.gridname=[filecell.filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')];1787 if ~exist( param.civ1.gridname,'file')1790 Param.Civ1.gridname=[filecell.filebase '_' name_generator(gridname,num1_grid,1,'.grid','_i')]; 1791 if ~exist(Param.Civ1.gridname,'file') 1788 1792 msgbox_uvmat('ERROR','grid file absent for civ1') 1789 1793 end 1790 1794 elseif exist(gridname,'file') 1791 param.civ1.gridname=gridname;1795 Param.Civ1.gridname=gridname; 1792 1796 else 1793 1797 msgbox_uvmat('ERROR','grid file absent for civ1') … … 1795 1799 end 1796 1800 else 1797 param.civ1.gridname='noFile use default';1798 param.civ1.gridflag='n';1801 Param.Civ1.gridname='noFile use default'; 1802 Param.Civ1.gridflag='n'; 1799 1803 end 1800 1804 1801 1805 switch CivMode 1802 1806 case 'CivX' 1803 c iv1_exe=CIV1_CMD(filecell.nc.civ1{ifile,j},param);%create the parameter file .civ1.cmx and set the execution string civ1_exe1804 cmd=[cmd civ1_exe'\n'];1807 cmd=[cmd... 1808 cmd_civ1(filecell.nc.civ1{ifile,j},Param) '\n']; 1805 1809 case 'CivAll' 1806 1810 CivAllCmd=[CivAllCmd ' civ1 ']; 1807 str=CIV1_CMD_Unified(filecell.nc.civ1{ifile,j},'', param.civ1);1811 str=CIV1_CMD_Unified(filecell.nc.civ1{ifile,j},'',Param.Civ1); 1808 1812 fieldnames=fields(str); 1809 1813 [CivAllxml,uid_civ1]=add(CivAllxml,1,'element','civ1'); … … 1823 1827 case 'CivX' 1824 1828 if isunix %unix system 1825 cmd_FIX=[ param.global.FixBin ' -f ' filecell.nc.civ1{ifile,j} ' -fi1 ' num2str(param.fix1.flagindex1(1)) ...1829 cmd_FIX=[Param.xml.FixBin ' -f ' filecell.nc.civ1{ifile,j} ' -fi1 ' num2str(param.fix1.flagindex1(1)) ... 1826 1830 ' -fi2 ' num2str(param.fix1.flagindex1(2)) ' -fi3 ' num2str(param.fix1.flagindex1(3)) ... 1827 1831 ' -threshC ' num2str(param.fix1.thresh_vecC1) ' -threshV ' num2str(param.fix1.thresh_vel1) ' -maskName ' param.fix1.maskname]; 1828 1832 else %windows system 1829 cmd_FIX=['"' param.global.FixBin '" -f "' filecell.nc.civ1{ifile,j} '" -fi1 ' num2str(param.fix1.flagindex1(1)) ...1833 cmd_FIX=['"' Param.xml.FixBin '" -f "' filecell.nc.civ1{ifile,j} '" -fi1 ' num2str(param.fix1.flagindex1(1)) ... 1830 1834 ' -fi2 ' num2str(param.fix1.flagindex1(2)) ' -fi3 ' num2str(param.fix1.flagindex1(3)) ... 1831 1835 ' -threshC ' num2str(param.fix1.thresh_vecC1) ' -threshV ' num2str(param.fix1.thresh_vel1) ' -maskName "' param.fix1.maskname '"']; … … 1857 1861 switch CivMode 1858 1862 case 'CivX' 1859 cmd_PATCH=cmd_patch(filecell.nc.civ1{ifile,j},param.Patch1, param.global.PatchBin);1863 cmd_PATCH=cmd_patch(filecell.nc.civ1{ifile,j},param.Patch1,Param.xml.PatchBin); 1860 1864 cmd=[cmd cmd_PATCH '\n']; 1861 1865 case 'CivAll' … … 1986 1990 case 'CivX' 1987 1991 if isunix 1988 cmd_FIX=[ param.global.FixBin ' -f ' filecell.nc.civ2{ifile,j} ' -fi1 ' num2str(flagindex2(1)) ...1992 cmd_FIX=[Param.xml.FixBin ' -f ' filecell.nc.civ2{ifile,j} ' -fi1 ' num2str(flagindex2(1)) ... 1989 1993 ' -fi2 ' num2str(flagindex2(2)) ' -fi3 ' num2str(flagindex2(3)) ... 1990 1994 ' -threshC ' num2str(thresh_vec2C) ' -threshV ' num2str(thresh_vel2) ' -maskName ' maskname]; 1991 1995 else 1992 cmd_FIX=['"' param.global.FixBin '" -f "' filecell.nc.civ2{ifile,j} '" -fi1 ' num2str(flagindex2(1)) ...1996 cmd_FIX=['"' Param.xml.FixBin '" -f "' filecell.nc.civ2{ifile,j} '" -fi1 ' num2str(flagindex2(1)) ... 1993 1997 ' -fi2 ' num2str(flagindex2(2)) ' -fi3 ' num2str(flagindex2(3)) ... 1994 1998 ' -threshC ' num2str(thresh_vec2C) ' -threshV ' num2str(thresh_vel2) ' -maskName "' maskname '"']; … … 2020 2024 switch CivMode 2021 2025 case 'CivX' 2022 cmd_PATCH=cmd_patch(filecell.nc.civ2{ifile,j},param.Patch2, param.global.PatchBin);2026 cmd_PATCH=cmd_patch(filecell.nc.civ2{ifile,j},param.Patch2,Param.xml.PatchBin); 2023 2027 cmd=[cmd cmd_PATCH '\n']; 2024 2028 case 'CivAll' … … 2115 2119 drawnow 2116 2120 if Param.CheckCiv1==1 2117 Param.Civ1= param.civ1;2121 Param.Civ1=Param.Civ1; 2118 2122 end 2119 2123 if Param.CheckFix1==1 … … 3227 3231 ' > ' namelog ' 2>&1']; % redirect standard output to the log file 3228 3232 else 3229 cmd=['"' param.global.PatchBin...3233 cmd=['"' Param.xml.PatchBin... 3230 3234 '" -f "' filename_nc '" -m ' param.Patch1.Nx... 3231 3235 ' -n ' param.Patch1.Ny ' -ro ' param.Patch1.SmoothParam... … … 4474 4478 filename=regexprep(filename,'.nc',''); 4475 4479 4476 if isequal( param.civ1.Dt,'0')4477 param.civ1.Dt='1' ;%case of 'displacement' mode4478 end 4479 param.civ1.filename_ima_a=regexprep(param.civ1.filename_ima_a,'.png','');4480 param.civ1.filename_ima_b=regexprep(param.civ1.filename_ima_b,'.png','');4480 if isequal(Param.Civ1.Dt,'0') 4481 Param.Civ1.Dt='1' ;%case of 'displacement' mode 4482 end 4483 Param.Civ1.filename_ima_a=regexprep(Param.Civ1.filename_ima_a,'.png',''); 4484 Param.Civ1.filename_ima_b=regexprep(Param.Civ1.filename_ima_b,'.png',''); 4481 4485 fid=fopen([filename '.civ1.cmx'],'w'); 4482 4486 fprintf(fid,['############## CMX file' '\n' ]); 4483 fprintf(fid, ['FirstImage ' regexprep( param.civ1.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility4484 fprintf(fid, ['LastImage ' regexprep( param.civ1.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility4487 fprintf(fid, ['FirstImage ' regexprep(Param.Civ1.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility 4488 fprintf(fid, ['LastImage ' regexprep(Param.Civ1.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility 4485 4489 fprintf(fid, ['XX' '\n' ]); 4486 fprintf(fid, ['Mask ' param.civ1.maskflag '\n' ]);4487 fprintf(fid, ['MaskName ' regexprep( param.civ1.maskname,'\\','\\\\') '\n' ]);4488 fprintf(fid, ['ImageSize ' param.civ1.npx ' ' param.civ1.npy '\n' ]); %VERIFIER CAS GENERAL ?4489 fprintf(fid, ['CorrelationBoxesSize ' param.civ1.ibx ' ' param.civ1.iby '\n' ]);4490 fprintf(fid, ['SearchBoxeSize ' param.civ1.isx ' ' param.civ1.isy '\n' ]);4491 fprintf(fid, ['RO ' param.civ1.rho '\n' ]);4492 fprintf(fid, ['GridSpacing ' param.civ1.dx ' ' param.civ1.dy '\n' ]);4490 fprintf(fid, ['Mask ' Param.Civ1.maskflag '\n' ]); 4491 fprintf(fid, ['MaskName ' regexprep(Param.Civ1.maskname,'\\','\\\\') '\n' ]); 4492 fprintf(fid, ['ImageSize ' Param.Civ1.npx ' ' Param.Civ1.npy '\n' ]); %VERIFIER CAS GENERAL ? 4493 fprintf(fid, ['CorrelationBoxesSize ' Param.Civ1.ibx ' ' Param.Civ1.iby '\n' ]); 4494 fprintf(fid, ['SearchBoxeSize ' Param.Civ1.isx ' ' Param.Civ1.isy '\n' ]); 4495 fprintf(fid, ['RO ' Param.Civ1.rho '\n' ]); 4496 fprintf(fid, ['GridSpacing ' Param.Civ1.dx ' ' Param.Civ1.dy '\n' ]); 4493 4497 fprintf(fid, ['XX 1.0' '\n' ]); 4494 fprintf(fid, ['Dt_TO ' param.civ1.Dt ' ' param.civ1.T0 '\n' ]);4495 fprintf(fid, ['PixCmXY ' param.civ1.pxcmx ' ' param.civ1.pxcmy '\n' ]);4498 fprintf(fid, ['Dt_TO ' Param.Civ1.Dt ' ' Param.Civ1.T0 '\n' ]); 4499 fprintf(fid, ['PixCmXY ' Param.Civ1.pxcmx ' ' Param.Civ1.pxcmy '\n' ]); 4496 4500 fprintf(fid, ['XX 1' '\n' ]); 4497 fprintf(fid, ['ShiftXY ' param.civ1.shiftx ' ' param.civ1.shifty '\n' ]);4498 fprintf(fid, ['Grid ' param.civ1.gridflag '\n' ]);4499 fprintf(fid, ['GridName ' regexprep( param.civ1.gridname,'\\','\\\\') '\n' ]);4501 fprintf(fid, ['ShiftXY ' Param.Civ1.shiftx ' ' Param.Civ1.shifty '\n' ]); 4502 fprintf(fid, ['Grid ' Param.Civ1.gridflag '\n' ]); 4503 fprintf(fid, ['GridName ' regexprep(Param.Civ1.gridname,'\\','\\\\') '\n' ]); 4500 4504 fprintf(fid, ['XX 85' '\n' ]); 4501 4505 fprintf(fid, ['XX 1.0' '\n' ]); … … 4508 4512 fprintf(fid, ['SeuilImage n' '\n' ]); 4509 4513 fprintf(fid, ['SeuilImageValues 0 4096' '\n' ]); 4510 fprintf(fid, ['ImageToUse ' param.civ1.term_a ' ' param.civ1.term_b '\n' ]); % VERIFIER ?4514 fprintf(fid, ['ImageToUse ' Param.Civ1.term_a ' ' Param.Civ1.term_b '\n' ]); % VERIFIER ? 4511 4515 fprintf(fid, ['ImageUsedBefore null null' '\n' ]); 4512 4516 fclose(fid); … … 4518 4522 cmd_CIV1=['cp -f ' filename '.civ1.cmx ' filename '.cmx']; 4519 4523 cmd_CIV1=[cmd_CIV1 '\n'... 4520 param.global.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx4524 Param.xml.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx 4521 4525 cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.log' ' ' filename '.civ1.log' '\n' 'chmod g+w ' filename '.civ1.log' '\n' 'chmod g+w ' filename '.nc'];%rename .log as .civ1.log and set the netcdf result file for group user writting 4522 4526 % cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.cmx' ' ' filename '.checkciv1.cmx' '\n'];%rename .cmx as .checkciv1.cmx … … 4526 4530 % filename=regexprep(filename,'\\','\\\\'); 4527 4531 cmd_CIV1=['copy /Y "' filename '.civ1.cmx" "' filename '.cmx"'];% copy the .civ1.cmx parameter file to .cmx 4528 cmd_CIV1=[cmd_CIV1 '\n "' regexprep( param.global.Civ1Bin,'\\','\\\\') '" -f "' filename '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file4532 cmd_CIV1=[cmd_CIV1 '\n "' regexprep(Param.xml.Civ1Bin,'\\','\\\\') '" -f "' filename '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file 4529 4533 % namelog=regexprep(namelog,'\\','\\\\'); 4530 4534 cmd_CIV1=[cmd_CIV1 '\n ' 'copy /Y "' filename '.log' '" "' filename '.civ1.log"']; %preserve the log file as .civ1.log … … 4678 4682 if(isunix) 4679 4683 cmd_CIV2=['cp -f ' filename '.civ2.cmx ' filename '.cmx\n']; 4680 cmd_CIV2=[cmd_CIV2 param.global.Civ2Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx4684 cmd_CIV2=[cmd_CIV2 Param.xml.Civ2Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx 4681 4685 cmd_CIV2=[cmd_CIV2 '\n' 'mv ' filename '.log' ' ' filename '.civ2.log' '\n' 'chmod g+w ' filename '.nc'];%preserve the log file as .civ2.log 4682 4686 % cmd_CIV2=[cmd_CIV2 '\n' 'mv ' filename '.cmx' ' ' filename '.checkciv2.cmx' '\n'];%rename .cmx as .checkciv2.cmx, the result file is named [filename '.nc'] by CIVx … … 4685 4689 filename=regexprep(filename,'\\','\\\\'); 4686 4690 cmd_CIV2=['copy /Y "' filename '.civ2.cmx" "' filename '.cmx"']; 4687 cmd_CIV2=[cmd_CIV2 '\n "' regexprep( param.global.Civ2Bin,'\\','\\\\') '" -f "' filename '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file4691 cmd_CIV2=[cmd_CIV2 '\n "' regexprep(Param.xml.Civ2Bin,'\\','\\\\') '" -f "' filename '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file 4688 4692 cmd_CIV2=[cmd_CIV2 '\n ' 'copy /Y "' filename '.log' '" "' filename '.civ2.log"']; 4689 4693 % cmd_CIV2=[cmd_CIV2 '\n' 'copy /Y "' filename '.cmx' '" "' filename '.checkciv2.cmx"']; … … 5107 5111 Param.CheckFix2=get(handles.CheckFix2,'Value'); 5108 5112 Param.CheckPatch2=get(handles.CheckPatch2,'Value'); 5113 box_test=[Param.CheckCiv1 Param.CheckFix1 Param.CheckPatch1 Param.CheckCiv2 Param.CheckFix2 Param.CheckPatch2]; 5114 5109 5115 option_civ=find(box_test,1,'last');%last selected option (non-zero index of box_test) 5110 5116 filecell=get(handles.civ,'UserData');%retrieve the list of output files expected for PIV … … 5414 5420 end 5415 5421 end 5422 5423 5424 5425 function cmd=cmd_civ1(filename,Param) 5426 %TODO : include filename in par_civ1 5427 %------------------------------------------------------------------------ 5428 %pixels per cm and matrix of the image times, read from the .civ file by uvmat 5429 5430 %changes : filename_cmx -> filename ( no extension ) 5431 5432 filename=regexprep(filename,'.nc','') 5433 5434 if isequal(Param.Civ1.Dt,'0') 5435 Param.Civ1.Dt='1' ;%case of 'displacement' mode 5436 end 5437 Param.Civ1.filename_ima_a=regexprep(Param.Civ1.filename_ima_a,'.png',''); 5438 Param.Civ1.filename_ima_b=regexprep(Param.Civ1.filename_ima_b,'.png',''); 5439 fid=fopen([filename '.civ1.cmx'],'w'); 5440 fprintf(fid,['############## CMX file' '\n' ]); 5441 fprintf(fid, ['FirstImage ' regexprep(Param.Civ1.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility 5442 fprintf(fid, ['LastImage ' regexprep(Param.Civ1.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility 5443 fprintf(fid, ['XX' '\n' ]); 5444 fprintf(fid, ['Mask ' Param.Civ1.maskflag '\n' ]); 5445 fprintf(fid, ['MaskName ' regexprep(Param.Civ1.maskname,'\\','\\\\') '\n' ]); 5446 fprintf(fid, ['ImageSize ' num2str(Param.Civ1.npx) ' ' num2str(Param.Civ1.npy) '\n' ]); %VERIFIER CAS GENERAL ? 5447 fprintf(fid, ['CorrelationBoxesSize ' num2str(Param.Civ1.Bx) ' ' num2str(Param.Civ1.By) '\n' ]); 5448 fprintf(fid, ['SearchBoxeSize ' num2str(Param.Civ1.Sx) ' ' num2str(Param.Civ1.Sy) '\n' ]); 5449 fprintf(fid, ['RO ' num2str(Param.Civ1.Rho) '\n' ]); 5450 fprintf(fid, ['GridSpacing ' num2str(Param.Civ1.Dx) ' ' num2str(Param.Civ1.Dy) '\n' ]); 5451 fprintf(fid, ['XX 1.0' '\n' ]); 5452 fprintf(fid, ['Dt_TO ' num2str(Param.Civ1.Dt) ' ' num2str(Param.Civ1.T0) '\n' ]); 5453 fprintf(fid, ['PixCmXY ' num2str(Param.Civ1.pxcmx) ' ' num2str(Param.Civ1.pxcmy) '\n' ]); 5454 fprintf(fid, ['XX 1' '\n' ]); 5455 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' ]); 5458 fprintf(fid, ['XX 85' '\n' ]); 5459 fprintf(fid, ['XX 1.0' '\n' ]); 5460 fprintf(fid, ['XX 1.0' '\n' ]); 5461 fprintf(fid, ['Hart 1' '\n' ]); 5462 fprintf(fid, [ 'DecimalShift 0' '\n' ]); 5463 fprintf(fid, ['Deformation 0' '\n' ]); 5464 fprintf(fid, ['CorrelationMin 0' '\n' ]); 5465 fprintf(fid, ['IntensityMin 0' '\n' ]); 5466 fprintf(fid, ['SeuilImage n' '\n' ]); 5467 fprintf(fid, ['SeuilImageValues 0 4096' '\n' ]); 5468 fprintf(fid, ['ImageToUse ' Param.Civ1.term_a ' ' Param.Civ1.term_b '\n' ]); % VERIFIER ? 5469 fprintf(fid, ['ImageUsedBefore null null' '\n' ]); 5470 fclose(fid); 5471 5472 % cmd_CIV1=[sparam.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file 5473 % cmd_CIV1=regexprep(cmd_CIV1,'\\','\\\\'); 5474 % namelog=regexprep(namelog,'\\','\\\\'); 5475 if(isunix) 5476 cmd=['cp -f ' filename '.civ1.cmx ' filename '.cmx \n '];% the cmx file gives the name to the nc file 5477 cmd=[cmd Param.xml.Civ1Bin ' -f ' filename '.cmx >' filename '.civ1.log \n ' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx 5478 % cmd=[cmd '\n' 'mv ' filename '.log' ' ' filename '.civ1.log' '\n' 'chmod g+w ' filename '.civ1.log' '\n' 'chmod g+w ' filename '.nc'];%rename .log as .civ1.log and set the netcdf result file for group user writting 5479 % cmd=[cmd '\n' 'mv ' filename '.cmx' ' ' filename '.civ1.cmx' '\n'];%rename .cmx as .civ1.cmx 5480 cmd=[cmd 'rm ' filename '.cmx']; 5481 else %Windows system 5482 filename=regexprep(filename,'\\','\\\\'); 5483 cmd=['copy /Y "' filename '.civ1.cmx" "' filename '.cmx" \n ']; 5484 cmd=[cmd '"' regexprep(Param.xml.Civ1Bin,'\\','\\\\')... 5485 '" -f "' filename '.cmx" >"' filename '.civ1.log" \n ' ]; % redirect standard output to the log file 5486 % namelog=regexprep(namelog,'\\','\\\\'); 5487 % cmd=[cmd '\n ' 'copy /Y "' filename '.log' '" "' filename '.civ1.log"']; %preserve the log file as .civ1.log 5488 cmd=[cmd 'del "' filename '.cmx']; 5489 end
Note: See TracChangeset
for help on using the changeset viewer.