Changeset 284


Ignore:
Timestamp:
Nov 18, 2011, 5:25:34 PM (12 years ago)
Author:
gostiaux
Message:

CIV1 works again (windows)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r282 r284  
    14911491%%read the civ GUI
    14921492Param=read_GUI(handles.civ)
    1493 Param.Civ1
    1494 Param.Fix1
    1495 Param.Patch1
    14961493%% check the selected list of operations:
    14971494operations={'CIV1','FIX1','PATCH1','CIV2','FIX2','PATCH2'};
    14981495box_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
    15041497index_first=find(box_test==1,1);
    15051498if isempty(index_first)
     
    15811574if batch
    15821575    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;
    15861579            if ~ismember(batch_mode,{'sge','oar'})
    15871580                errormsg=['batch mode ' batch_mode ' not supported by UVMAT'];
     
    15951588else % run
    15961589    if isfield(s,'RunParam')
    1597         param.global=s.RunParam;
     1590        Param.xml=s.RunParam;
    15981591    else
    15991592        msgbox_uvmat('ERROR','no run civ binaries defined in PARAM.xml')
     
    16361629end
    16371630for 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.xml
    1640             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}))
    16411634            if exist(fullname,'file')
    1642                 param.global.(bin_name{1})=fullname;
     1635                Param.xml.(bin_name{1})=fullname;
    16431636            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'])
    16451638                return
    16461639            end
    16471640        else
    1648             [path,name,ext]=fileparts(param.global.(bin_name{1}));
     1641            [path,name,ext]=fileparts(Param.xml.(bin_name{1}));
    16491642            currentdir=pwd;
    16501643            cd(path);
    16511644            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}));
    16541647            cd(currentdir);
    16551648        end
     
    16621655%% get checkciv1 parameters
    16631656if Param.CheckCiv1
    1664     param.civ1=read_param_civ1(handles,filecell);
     1657%     Param.Civ1=read_param_civ1(handles,filecell);
    16651658end
    16661659
     
    17441737        if Param.CheckCiv1
    17451738            % 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);%
     1745Param.Civ1.pxcmx=1; %velocities are expressed in pixel dispalcement
     1746Param.Civ1.pxcmy=1;
     1747% if exist('file_ima','var')
     1748A=imread(filecell.ima1.civ1{1,1});%read the first image to get the size
     1749sizim=size(A);
     1750Param.Civ1.npx=(sizim(2));
     1751Param.Civ1.npy=(sizim(1));
     1752%TODO : civ should not need npx and npy
     1753
     1754
    17521755           
    17531756            % 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
    17561760                maskdispl=get(handles.txt_MaskName,'String');
    17571761                if exist(maskdispl,'file')
    1758                     param.civ1.maskname=maskdispl;
    1759                     param.civ1.maskflag='y';
     1762                    Param.Civ1.maskname=maskdispl;
     1763                    Param.Civ1.maskflag='y';
    17601764                else
    17611765                    maskbase=[filecell.filebase '_' maskdispl]; %
    17621766                    nbslice_mask=str2double(maskdispl(1:end-4)); %
    17631767                    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';
    17671771                    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';
    17701774                    end
    17711775                end
    17721776            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';
    17751779            end
    17761780           
    17771781            % 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';
    17811785                gridname=get(handles.txt_GridName,'String');
    17821786                if isequal(gridname(end-3:end),'grid')
     
    17841788                    if ~isnan(nbslice_grid)
    17851789                        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')
    17881792                            msgbox_uvmat('ERROR','grid file absent for civ1')
    17891793                        end
    17901794                    elseif exist(gridname,'file')
    1791                         param.civ1.gridname=gridname;
     1795                        Param.Civ1.gridname=gridname;
    17921796                    else
    17931797                        msgbox_uvmat('ERROR','grid file absent for civ1')
     
    17951799                end
    17961800            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';
    17991803            end
    18001804           
    18011805            switch CivMode
    18021806                case 'CivX'
    1803                     civ1_exe=CIV1_CMD(filecell.nc.civ1{ifile,j},param);%create the parameter file .civ1.cmx and set the execution string civ1_exe
    1804                     cmd=[cmd civ1_exe '\n'];
     1807                    cmd=[cmd...
     1808                        cmd_civ1(filecell.nc.civ1{ifile,j},Param) '\n'];
    18051809                case 'CivAll'
    18061810                    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);
    18081812                    fieldnames=fields(str);
    18091813                    [CivAllxml,uid_civ1]=add(CivAllxml,1,'element','civ1');
     
    18231827                case 'CivX'
    18241828                    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)) ...
    18261830                            ' -fi2 ' num2str(param.fix1.flagindex1(2)) ' -fi3 ' num2str(param.fix1.flagindex1(3)) ...
    18271831                            ' -threshC ' num2str(param.fix1.thresh_vecC1) ' -threshV ' num2str(param.fix1.thresh_vel1) ' -maskName ' param.fix1.maskname];
    18281832                    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)) ...
    18301834                            ' -fi2 ' num2str(param.fix1.flagindex1(2)) ' -fi3 ' num2str(param.fix1.flagindex1(3)) ...
    18311835                            ' -threshC ' num2str(param.fix1.thresh_vecC1) ' -threshV ' num2str(param.fix1.thresh_vel1) ' -maskName "' param.fix1.maskname '"'];
     
    18571861            switch CivMode
    18581862                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);
    18601864                    cmd=[cmd cmd_PATCH '\n'];
    18611865                case 'CivAll'
     
    19861990                case 'CivX'
    19871991                    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)) ...
    19891993                            ' -fi2 ' num2str(flagindex2(2)) ' -fi3 ' num2str(flagindex2(3)) ...
    19901994                            ' -threshC ' num2str(thresh_vec2C) ' -threshV ' num2str(thresh_vel2) ' -maskName ' maskname];
    19911995                    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)) ...
    19931997                            ' -fi2 ' num2str(flagindex2(2)) ' -fi3 ' num2str(flagindex2(3)) ...
    19941998                            ' -threshC ' num2str(thresh_vec2C) ' -threshV ' num2str(thresh_vel2) ' -maskName "' maskname '"'];
     
    20202024            switch CivMode
    20212025                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);
    20232027                    cmd=[cmd cmd_PATCH '\n'];
    20242028                case 'CivAll'
     
    21152119                drawnow
    21162120                if Param.CheckCiv1==1
    2117                     Param.Civ1=param.civ1;
     2121                    Param.Civ1=Param.Civ1;
    21182122                end
    21192123                if Param.CheckFix1==1
     
    32273231        '  > ' namelog ' 2>&1']; % redirect standard output to the log file
    32283232    else
    3229       cmd=['"' param.global.PatchBin...
     3233      cmd=['"' Param.xml.PatchBin...
    32303234          '" -f "' filename_nc '" -m ' param.Patch1.Nx...
    32313235          ' -n ' param.Patch1.Ny ' -ro ' param.Patch1.SmoothParam...
     
    44744478filename=regexprep(filename,'.nc','');
    44754479
    4476 if isequal(param.civ1.Dt,'0')
    4477     param.civ1.Dt='1' ;%case of 'displacement' mode
    4478 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','');
     4480if isequal(Param.Civ1.Dt,'0')
     4481    Param.Civ1.Dt='1' ;%case of 'displacement' mode
     4482end
     4483Param.Civ1.filename_ima_a=regexprep(Param.Civ1.filename_ima_a,'.png','');
     4484Param.Civ1.filename_ima_b=regexprep(Param.Civ1.filename_ima_b,'.png','');
    44814485fid=fopen([filename '.civ1.cmx'],'w');
    44824486fprintf(fid,['##############   CMX file' '\n' ]);
    4483 fprintf(fid,   ['FirstImage ' regexprep(param.civ1.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility
    4484 fprintf(fid,   ['LastImage  ' regexprep(param.civ1.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility
     4487fprintf(fid,   ['FirstImage ' regexprep(Param.Civ1.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility
     4488fprintf(fid,   ['LastImage  ' regexprep(Param.Civ1.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility
    44854489fprintf(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' ]);
     4490fprintf(fid,  ['Mask ' Param.Civ1.maskflag '\n' ]);
     4491fprintf(fid,  ['MaskName ' regexprep(Param.Civ1.maskname,'\\','\\\\') '\n' ]);
     4492fprintf(fid,   ['ImageSize ' Param.Civ1.npx ' ' Param.Civ1.npy '\n' ]);   %VERIFIER CAS GENERAL ?
     4493fprintf(fid,   ['CorrelationBoxesSize ' Param.Civ1.ibx ' ' Param.Civ1.iby '\n' ]);
     4494fprintf(fid,   ['SearchBoxeSize ' Param.Civ1.isx ' ' Param.Civ1.isy '\n' ]);
     4495fprintf(fid,   ['RO ' Param.Civ1.rho '\n' ]);
     4496fprintf(fid,   ['GridSpacing ' Param.Civ1.dx ' ' Param.Civ1.dy '\n' ]);
    44934497fprintf(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' ]);
     4498fprintf(fid,   ['Dt_TO ' Param.Civ1.Dt ' ' Param.Civ1.T0 '\n' ]);
     4499fprintf(fid,  ['PixCmXY ' Param.Civ1.pxcmx ' ' Param.Civ1.pxcmy '\n' ]);
    44964500fprintf(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' ]);
     4501fprintf(fid,   ['ShiftXY ' Param.Civ1.shiftx ' '  Param.Civ1.shifty '\n' ]);
     4502fprintf(fid,  ['Grid ' Param.Civ1.gridflag '\n' ]);
     4503fprintf(fid,   ['GridName ' regexprep(Param.Civ1.gridname,'\\','\\\\') '\n' ]);
    45004504fprintf(fid,   ['XX 85' '\n' ]);
    45014505fprintf(fid,   ['XX 1.0' '\n' ]);
     
    45084512fprintf(fid,  ['SeuilImage n' '\n' ]);
    45094513fprintf(fid,   ['SeuilImageValues 0 4096' '\n' ]);
    4510 fprintf(fid,   ['ImageToUse ' param.civ1.term_a ' ' param.civ1.term_b '\n' ]); % VERIFIER ?
     4514fprintf(fid,   ['ImageToUse ' Param.Civ1.term_a ' ' Param.Civ1.term_b '\n' ]); % VERIFIER ?
    45114515fprintf(fid,   ['ImageUsedBefore null null' '\n' ]);
    45124516fclose(fid);
     
    45184522    cmd_CIV1=['cp -f ' filename '.civ1.cmx ' filename '.cmx'];
    45194523    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 CIVx
     4524        Param.xml.Civ1Bin ' -f ' filename '.cmx >' filename '.log' ]; % redirect standard output to the log file, the result file is named [filename '.nc'] by CIVx
    45214525    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
    45224526   % cmd_CIV1=[cmd_CIV1 '\n' 'mv ' filename '.cmx' ' ' filename '.checkciv1.cmx' '\n'];%rename .cmx as .checkciv1.cmx
     
    45264530%     filename=regexprep(filename,'\\','\\\\');
    45274531    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 file
     4532    cmd_CIV1=[cmd_CIV1 '\n "' regexprep(Param.xml.Civ1Bin,'\\','\\\\') '" -f "' filename '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file
    45294533%     namelog=regexprep(namelog,'\\','\\\\');
    45304534    cmd_CIV1=[cmd_CIV1 '\n ' 'copy /Y "' filename '.log' '" "' filename '.civ1.log"']; %preserve the log file as .civ1.log
     
    46784682if(isunix)
    46794683    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 CIVx
     4684    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
    46814685    cmd_CIV2=[cmd_CIV2 '\n' 'mv ' filename '.log' ' ' filename '.civ2.log' '\n' 'chmod g+w ' filename '.nc'];%preserve the log file as .civ2.log
    46824686%    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
     
    46854689    filename=regexprep(filename,'\\','\\\\');
    46864690    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 file
     4691    cmd_CIV2=[cmd_CIV2 '\n "' regexprep(Param.xml.Civ2Bin,'\\','\\\\') '" -f "' filename  '.cmx" >"' filename '.log"' ]; % redirect standard output to the log file
    46884692    cmd_CIV2=[cmd_CIV2 '\n ' 'copy /Y "' filename '.log' '" "' filename '.civ2.log"'];
    46894693 %    cmd_CIV2=[cmd_CIV2 '\n' 'copy /Y "' filename '.cmx' '" "' filename '.checkciv2.cmx"'];
     
    51075111Param.CheckFix2=get(handles.CheckFix2,'Value');
    51085112Param.CheckPatch2=get(handles.CheckPatch2,'Value');
     5113box_test=[Param.CheckCiv1 Param.CheckFix1 Param.CheckPatch1 Param.CheckCiv2 Param.CheckFix2 Param.CheckPatch2];
     5114
    51095115option_civ=find(box_test,1,'last');%last selected option (non-zero index of box_test)
    51105116filecell=get(handles.civ,'UserData');%retrieve the list of output files expected for PIV
     
    54145420    end
    54155421end
     5422
     5423
     5424
     5425function 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
     5432filename=regexprep(filename,'.nc','')
     5433
     5434if isequal(Param.Civ1.Dt,'0')
     5435    Param.Civ1.Dt='1' ;%case of 'displacement' mode
     5436end
     5437Param.Civ1.filename_ima_a=regexprep(Param.Civ1.filename_ima_a,'.png','');
     5438Param.Civ1.filename_ima_b=regexprep(Param.Civ1.filename_ima_b,'.png','');
     5439fid=fopen([filename '.civ1.cmx'],'w');
     5440fprintf(fid,['##############   CMX file' '\n' ]);
     5441fprintf(fid,   ['FirstImage ' regexprep(Param.Civ1.filename_ima_a,'\\','\\\\') '\n' ]);% for windows compatibility
     5442fprintf(fid,   ['LastImage  ' regexprep(Param.Civ1.filename_ima_b,'\\','\\\\') '\n' ]);% for windows compatibility
     5443fprintf(fid,  ['XX' '\n' ]);
     5444fprintf(fid,  ['Mask ' Param.Civ1.maskflag '\n' ]);
     5445fprintf(fid,  ['MaskName ' regexprep(Param.Civ1.maskname,'\\','\\\\') '\n' ]);
     5446fprintf(fid,   ['ImageSize ' num2str(Param.Civ1.npx) ' ' num2str(Param.Civ1.npy) '\n' ]);   %VERIFIER CAS GENERAL ?
     5447fprintf(fid,   ['CorrelationBoxesSize ' num2str(Param.Civ1.Bx) ' ' num2str(Param.Civ1.By) '\n' ]);
     5448fprintf(fid,   ['SearchBoxeSize ' num2str(Param.Civ1.Sx) ' ' num2str(Param.Civ1.Sy) '\n' ]);
     5449fprintf(fid,   ['RO ' num2str(Param.Civ1.Rho) '\n' ]);
     5450fprintf(fid,   ['GridSpacing ' num2str(Param.Civ1.Dx) ' ' num2str(Param.Civ1.Dy) '\n' ]);
     5451fprintf(fid,   ['XX 1.0' '\n' ]);
     5452fprintf(fid,   ['Dt_TO ' num2str(Param.Civ1.Dt) ' ' num2str(Param.Civ1.T0) '\n' ]);
     5453fprintf(fid,  ['PixCmXY ' num2str(Param.Civ1.pxcmx) ' ' num2str(Param.Civ1.pxcmy) '\n' ]);
     5454fprintf(fid,  ['XX 1' '\n' ]);
     5455fprintf(fid,   ['ShiftXY ' num2str(Param.Civ1.Shiftx) ' '  num2str(Param.Civ1.Shifty) '\n' ]);
     5456fprintf(fid,  ['Grid ' Param.Civ1.gridflag '\n' ]);
     5457fprintf(fid,   ['GridName ' regexprep(Param.Civ1.gridname,'\\','\\\\') '\n' ]);
     5458fprintf(fid,   ['XX 85' '\n' ]);
     5459fprintf(fid,   ['XX 1.0' '\n' ]);
     5460fprintf(fid,   ['XX 1.0' '\n' ]);
     5461fprintf(fid,   ['Hart 1' '\n' ]);
     5462fprintf(fid,  [ 'DecimalShift 0' '\n' ]);
     5463fprintf(fid,   ['Deformation 0' '\n' ]);
     5464fprintf(fid,  ['CorrelationMin 0' '\n' ]);
     5465fprintf(fid,   ['IntensityMin 0' '\n' ]);
     5466fprintf(fid,  ['SeuilImage n' '\n' ]);
     5467fprintf(fid,   ['SeuilImageValues 0 4096' '\n' ]);
     5468fprintf(fid,   ['ImageToUse ' Param.Civ1.term_a ' ' Param.Civ1.term_b '\n' ]); % VERIFIER ?
     5469fprintf(fid,   ['ImageUsedBefore null null' '\n' ]);
     5470fclose(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,'\\','\\\\');
     5475if(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'];
     5481else %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'];
     5489end
Note: See TracChangeset for help on using the changeset viewer.