Changeset 263 for trunk


Ignore:
Timestamp:
Oct 21, 2011, 6:31:43 AM (13 years ago)
Author:
sommeria
Message:

stereo option repaired

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r262 r263  
    15081508    return
    15091509end
    1510 [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc]=...
    1511     set_civ_filenames(handles,ref_i,ref_j,box_test);
     1510[filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc,xx,yy,compare]=...
     1511    set_civ_filenames(handles,ref_i,ref_j,box_test)
     1512
    15121513set(handles.civ,'UserData',filecell);%store for futur use of status callback
    15131514if isempty(filecell)% (error message displayed in fct set_civ_filenames)
     
    16021603        if isfield(sparam,'Civ1Bin')
    16031604            Civ1Bin=sparam.Civ1Bin;
    1604             if ~exist(Civ1Bin,'file')||isempty(which(Civ1Bin))% if path defined as relative to uvmat
     1605            if ~exist(Civ1Bin,'file')&&~isempty(which(Civ1Bin))% if path defined as relative to uvmat
    16051606                sparam.Civ1Bin=fullfile(path_UVMAT,Civ1Bin);
    16061607                if ~exist(sparam.Civ1Bin,'file')
     
    16121613        if isfield(sparam,'Civ2Bin')
    16131614            Civ2Bin=sparam.Civ2Bin;
    1614             if ~exist(Civ2Bin,'file')||isempty(which(Civ2Bin))% if path defined as relative to uvmat
     1615            if ~exist(Civ2Bin,'file')&&~isempty(which(Civ2Bin))% if path defined as relative to uvmat
    16151616                sparam.Civ2Bin=fullfile(path_UVMAT,Civ2Bin);
    16161617                if ~exist(sparam.Civ2Bin,'file')
     
    16211622        end
    16221623        if  isfield(sparam,'PatchBin')
    1623             if ~exist(sparam.PatchBin,'file')||isempty(which(sparam.PatchBin))% if path defined as relative to uvmat
     1624            if ~exist(sparam.PatchBin,'file')&&~isempty(which(sparam.PatchBin))% if path defined as relative to uvmat
    16241625                sparam.PatchBin=fullfile(path_UVMAT,sparam.PatchBin);
    16251626            end
    16261627        end
    16271628        if isfield(sparam,'FixBin')
    1628             if ~exist(sparam.FixBin,'file')||isempty(which(sparam.FixBin))% if path defined as relative to uvmat
     1629            if ~exist(sparam.FixBin,'file')&&~isempty(which(sparam.FixBin))% if path defined as relative to uvmat
    16291630                sparam.FixBin=fullfile(path_UVMAT,sparam.FixBin);
    16301631            end
     
    17581759                CivAllxml=set(CivAllxml,1,'name','CivDoc');
    17591760        end
    1760         [Rootbat,Filebat]=fileparts(filecell.nc.civ1{ifile,j});%output netcdf file (without extention)
     1761        [Rootbat,Filebat]=fileparts(filecell.nc.civ1{ifile,j});%output netcdf file (without extension)
    17611762        flname=fullfile(Rootbat,Filebat);
    17621763        if batch
     
    21642165                end
    21652166                if box_test(3)==1
    2166                     Param.Patch1.Rho=rho_patch1;
    2167                     Param.Patch1.Threshold=thresh_patch1;
    2168                     Param.Patch1.SubDomain=subdomain_patch1;
     2167                    if strcmp(compare,'stereo PIV')
     2168                        filebase_A=filecell.filebase;
     2169                        [pp,ff]=fileparts(filebase_A);
     2170                        filebase_B=fullfile(pp,get(handles.RootName_1,'String'));
     2171                        RUN_STLIN(filecell.ncA.civ1{ifile,j},filecell.nc.civ1{ifile,j},'civ1',filecell.st{ifile,j},...
     2172                            str2num(nx_patch1),str2num(ny_patch1),str2num(thresh_patch1),[filebase_A '.xml'],[filebase_B '.xml'])
     2173                    else
     2174                        Param.Patch1.Rho=rho_patch1;
     2175                        Param.Patch1.Threshold=thresh_patch1;
     2176                        Param.Patch1.SubDomain=subdomain_patch1;
     2177                    end
    21692178                end
    21702179                if box_test(4)==1
     
    21932202                    Param.Fix2=fix2;
    21942203                end
    2195                 [Data,erromsg]=civ_uvmat(Param,filecell.nc.civ1{ifile,j});
    2196                 if isempty(errormsg)
    2197                     display([filecell.nc.civ1{ifile,j} ' written'])
    2198                 else
    2199                     msgbox_uvmat('ERROR',errormsg)
     2204                if box_test(6)==1
     2205                    if strcmp(compare,'stereo PIV')
     2206                        filebase_A=filecell.filebase;
     2207                        [pp,ff]=fileparts(filebase_A);
     2208                        filebase_B=fullfile(pp,get(handles.RootName_1,'String'));
     2209                        RUN_STLIN(filecell.ncA.civ2{ifile,j},filecell.nc.civ2{ifile,j},'civ2',filecell.st{ifile,j},...
     2210                            str2num(nx_patch2),str2num(ny_patch2),str2num(thresh_patch2),[filebase_A '.xml'],[filebase_B '.xml'])
     2211                    end
     2212                end
     2213                if ~strcmp(compare,'stereo PIV')
     2214                    [Data,erromsg]=civ_uvmat(Param,filecell.nc.civ1{ifile,j});
     2215                    if isempty(errormsg)
     2216                        display([filecell.nc.civ1{ifile,j} ' written'])
     2217                    else
     2218                        msgbox_uvmat('ERROR',errormsg)
     2219                    end
    22002220                end
    22012221        end
     
    22732293%------------------------------------------------------------------------
    22742294% --- determine the list of filenames and indices needed for launch_job
    2275 function [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc,file_ref_fix1,file_ref_fix2]=...
     2295function [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc,file_ref_fix1,file_ref_fix2,compare]=...
    22762296    set_civ_filenames(handles,ref_i,ref_j,box_test)
    22772297%------------------------------------------------------------------------
     
    25032523        %create the new subdir_civ1
    25042524        if ~exist(fullfile(Path_ima,subdir_civ1_new),'dir')
    2505             cd(Path_ima);         
    2506             [xx,msg1]=mkdir(subdir_civ1_new);
     2525%             cd(Path_ima);         
     2526            [xx,msg1]=mkdir(fullfile(Path_ima,subdir_civ1_new));
    25072527
    25082528            if ~strcmp(msg1,'')
     
    25182538                end
    25192539            end
    2520             cd(currentdir);
     2540%             cd(currentdir);
    25212541        end
    25222542        if strcmp(compare,'stereo PIV')&&(strcmp(mode,'pair j1-j2')||strcmp(mode,'series(Dj)')||strcmp(mode,'series(Di)'))%check second nc series
     
    25442564            end
    25452565            %create the new subdir_civ1
    2546             if exist(fullfile(Path_ima,subdir_civ1_new),'dir')
    2547                    cd(Path_ima);         
    2548                 [xx,msg1]=mkdir(subdir_civ1_new);
    2549                             cd(currentdir);
     2566            if ~exist(fullfile(Path_ima,subdir_civ1_new),'dir')
     2567%                    cd(Path_ima);         
     2568                [xx,msg1]=mkdir(fullfile(Path_ima,subdir_civ1_new));
     2569%                             cd(currentdir);
    25502570                if ~strcmp(msg1,'')
    25512571                    msgbox_uvmat('ERROR',['cannot create ' subdir_civ1_new ': ' msg1])
    2552                     cd(currentdir)
     2572%                     cd(currentdir)
    25532573                    filecell={};
    25542574                    return
     
    25572577                    if ~strcmp(msg2,'')
    25582578                        msgbox_uvmat('ERROR',['pb of permission for ' subdir_civ1_new ': ' msg2])%error message for directory creation
    2559                         cd(currentdir)
     2579%                         cd(currentdir)
    25602580                        filecell={};
    25612581                        return
     
    44634483%------------------------------------------------------------------------
    44644484test=get(handles.compare,'Value');
    4465 if test==2 || test==3
     4485if test==2 || test==3 % case 'dispalcemen' or 'stereo PIV'
    44664486    filebase=get(handles.RootName,'String');
    44674487    browse=get(handles.browse_root,'Userdata');
     
    44754495    if test==2
    44764496        set(handles.mode,'Visible','off')
     4497        set(handles.CivMode,'Value',1) % mode 'civX' selected by default
    44774498    else
    44784499        set(handles.mode,'Visible','on')
     4500        set(handles.CivMode,'Value',3) % mode 'Matlab' selected for stereo
    44794501    end
    44804502   
     
    44964518    sizf=size(fileinput);
    44974519    if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end %stop if fileinput not a character string
    4498     [path,name,ext]=fileparts(fileinput);
     4520    [path,name,ext]=fileparts(fileinput)
    44994521    [path1]=fileparts(filebase);
    4500 %     if isunix
    4501 %         ['readlink ' path]
    4502 %         [status,path]=system(['readlink ' path])
    4503 %         [status,path1]=system(['readlink ' path1])% look for the true path in case of symbolic paths
    4504 %     end
     4522    if isunix
     4523        [status,path]=system(['readlink ' path])
     4524        [status,path1]=system(['readlink ' path1])% look for the true path in case of symbolic paths
     4525    end
    45054526    if ~strcmp(path1,path)
    4506         msgbox_uvmat('ERROR','The two  input image series must be in the same directory')
     4527        msgbox_uvmat('ERROR','The second image series must be in the same directory as the first one')
    45074528        return
    4508     end
    4509     set(handles.RootName_1,'String',name);
     4529     end
     4530%     set(handles.RootName_1,'String',name);
    45104531    [RootPath,RootFile,field_count,str2,str_a,str_b,xx,nom_type,subdir]=name2display(name);
     4532    set(handles.RootName_1,'String',RootFile);
    45114533    browse=get(handles.browse_root,'UserData');
    45124534    browse.nom_type_ima_1=nom_type;
     
    45154537    %check image extension
    45164538    if ~strcmp(ext,get(handles.ImaExt,'String'))
    4517         msgbox_uvmat('ERROR','The two  input image series must have the same extension name')
     4539        msgbox_uvmat('ERROR','The second image series must have the same extension name as the first one')
    45184540        return
    45194541    end
    45204542   
    45214543    %% check coincidence of image sizes
    4522     ref_i=get(handles.ref_i,'string');
    4523     ref_j=get(handles.ref_j,'string');
    4524     [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc]=set_civ_filenames(handles,ref_i,ref_j,[1 0 0 0 0 0]);
    4525     A=imread(filecell.ima1.civ1{1});
    4526     A_1=imread(fileinput);
    4527     npxy=size(A);
    4528     npxy_1=size(A_1);
    4529     if ~isequal(size(A),size(A_1))
    4530         msgbox_uvmat('ERROR','The two input image series do not have the same size')
    4531         return
    4532     end
     4544%     ref_i=get(handles.ref_i,'string');
     4545%     ref_j=get(handles.ref_j,'string');
     4546%     [filecell,num1_civ1,num2_civ1,num_a_civ1,num_b_civ1,num1_civ2,num2_civ2,num_a_civ2,num_b_civ2,nom_type_nc]=set_civ_filenames(handles,ref_i,ref_j,[1 0 0 0 0 0]);
     4547%     A=imread(filecell.ima1.civ1{1});
     4548%     A_1=imread(fileinput);
     4549%     npxy=size(A);
     4550%     npxy_1=size(A_1);
     4551%     if ~isequal(size(A),size(A_1))
     4552%         msgbox_uvmat('ERROR','The two input image series do not have the same size')
     4553%         return
     4554%     end
    45334555else
    45344556    set(handles.mode,'Visible','on')
     
    45414563    set(handles.test_stereo1,'Value',0)
    45424564    set(handles.test_stereo2,'Value',0)
     4565    set(handles.CivMode,'Value',1) % mode 'civX' selected by default
    45434566end
    45444567if test==3 && get(handles.PATCH1,'Value')
    4545     set(handles.stereo1,'Visible','on')
    4546 else
    4547     set(handles.stereo1,'Visible','off')
     4568    set(handles.test_stereo1,'Visible','on')
     4569else
     4570    set(handles.test_stereo1,'Visible','off')
    45484571end
    45494572if test==3 && get(handles.PATCH2,'Value')
    4550     set(handles.stereo2,'Visible','on')
    4551 else
    4552     set(handles.stereo2,'Visible','off')
     4573    set(handles.test_stereo2,'Visible','on')
     4574else
     4575    set(handles.test_stereo2,'Visible','off')
    45534576end
    45544577mode_Callback(hObject, eventdata, handles)
Note: See TracChangeset for help on using the changeset viewer.