Changeset 319 for trunk/src/civ.m


Ignore:
Timestamp:
Dec 6, 2011, 8:14:57 PM (12 years ago)
Author:
sommeria
Message:

civ: bugs for displacement mode repaired
civ and civ_matlab prepared for batch in Matlab (file .civ.xml created)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r317 r319  
    196196    browse=[];%initialisation
    197197else
    198     browse=get(handlesRootName,'UserData');
     198    browse=get(handles.RootName,'UserData');
    199199end
    200200browse.num_i1=num_i1;
     
    289289set(handles.num_Rho,'Value',1)
    290290set(handles.num_Rho,'String',{'1';'2'})
    291 set(handles.BATCH,'Enable','off')
     291% set(handles.BATCH,'Enable','off')
    292292
    293293% -----------------------------------------------------------------------
     
    345345num_ref_i=i1;%efaulmt ref index
    346346num_ref_j=j1;
     347browse=get(handles.RootName,'UserData');
    347348browse.incr_pair=[0 0];%default
    348349
     
    11801181                    cmd=[cmd...
    11811182                        cmd_civ1(filecell.nc.civ1{ifile,j},Param) '\n'];
     1183                    if ~isempty(errormsg)
     1184                        msgbox_uvmat('ERROR',errormsg)
     1185                        return
     1186                    end
    11821187                case 'CivAll'
    11831188                    CivAllCmd=[CivAllCmd ' civ1 '];
     
    14281433                drawnow
    14291434                if ~strcmp(compare,'stereo PIV')
    1430                     [Data,erromsg]=civ_matlab(Param,filecell.nc.civ1{ifile,j});
    1431                     if isempty(errormsg)
    1432                         display([filecell.nc.civ1{ifile,j} ' written'])
     1435                    filename_xml=[OutputFile '.civ.xml'];
     1436                    t=struct2xml(Param);
     1437                    save(t,filename_xml)
     1438                    if batch   
     1439                        batch_file_list{length(batch_file_list)+1}=filename_xml;
    14331440                    else
    1434                         msgbox_uvmat('ERROR',errormsg)
    1435                     end                 
     1441                        [Data,erromsg]=civ_matlab(Param,filecell.nc.civ1{ifile,j});
     1442                        if isempty(errormsg)
     1443                            display([filecell.nc.civ1{ifile,j} ' written'])
     1444                        else
     1445                            msgbox_uvmat('ERROR',errormsg)
     1446                        end
     1447                    end
    14361448                end
    14371449        end
     
    24712483%------------------------------------------------------------------------
    24722484test=get(handles.ListCompareMode,'Value');
    2473 if test==2 || test==3 % case 'dispalcemen' or 'stereo PIV'
     2485if test==2 || test==3 % case 'displacement' or 'stereo PIV'
    24742486    filebase=get(handles.RootName,'String');
    2475     browse=get(handlesRootName,'Userdata');
     2487    browse=get(handles.RootName,'Userdata');
    24762488    browse.nom_type_ima1=browse.nom_type_ima;
    2477     set(handlesRootName,'UserData',browse);
     2489    set(handles.RootName,'UserData',browse);
    24782490    set(handles.sub_txt,'Visible','on')
    24792491    set(handles.RootName_1,'Visible','On');%mkes the second file input window visible
     
    25192531    [RootPath,RootFile,field_count,str2,str_a,str_b,xx,nom_type,subdir]=name2display(name);
    25202532    set(handles.RootName_1,'String',RootFile);
    2521     browse=get(handlesRootName,'UserData');
     2533    browse=get(handles.RootName,'UserData');
    25222534    browse.nom_type_ima_1=nom_type;
    2523     set(handlesRootName,'UserData',browse)
     2535    set(handles.RootName,'UserData',browse)
    25242536   
    25252537    %check image extension
     
    25492561    set(handles.ListPairMode,'Value',1)
    25502562    set(handles.ListPairMode,'String',mode_store)
    2551     set(handles.test_stereo1,'Value',0)
     2563%     set(handles.test_stereo1,'Value',0)
    25522564    set(handles.CheckStereo,'Value',0)
    25532565    set(handles.ListPairMode,'Value',1) % mode 'civX' selected by default
    25542566end
    25552567if test==3 && get(handles.CheckPatch1,'Value')
    2556     set(handles.test_stereo1,'Visible','on')
    2557 else
    2558     set(handles.test_stereo1,'Visible','off')
     2568    set(handles.CheckStereo,'Visible','on')
     2569else
     2570    set(handles.CheckStereo,'Visible','off')
    25592571end
    25602572if test==3 && get(handles.CheckPatch2,'Value')
     
    25632575    set(handles.CheckStereo,'Visible','off')
    25642576end
    2565 mode_Callback(hObject, eventdata, handles)
     2577ListPairMode_Callback(hObject, eventdata, handles)
    25662578
    25672579
     
    27012713    displ_num(3,1)=0;
    27022714    displ_num(4,1)=0;
    2703     if nbfield > 1
     2715    if nbfield > 1 || nbfield==0
    27042716        set(handles.itext,'Visible','On')
    27052717        set(handles.first_i,'Visible','On')
     
    36563668
    36573669%% if hObject is on the checkciv1 frame, duplicate action for checkciv2 frame
    3658 PanelName=get(hparent,'tag')
     3670PanelName=get(hparent,'tag');
    36593671if strcmp(PanelName,'Civ1')
    36603672    hchildren=get(handles.Civ2,'children');
     
    40384050%pixels per cm and matrix of the image times, read from the .civ file by uvmat
    40394051%changes : filename_cmx -> filename ( no extension )
     4052cmd='';
     4053errormsg=''; %default
    40404054filename=regexprep(filename,'.nc',''); %file name for the result
    40414055if isequal(Param.Civ1.Dt,'0')
     
    40454059Param.Civ1.ImageB=regexprep(Param.Civ1.ImageB,'.png','');
    40464060fid=fopen([filename '.civ1.cmx'],'w');
     4061if isequal(fid,-1)
     4062    display(['cmd file ' filename ' cannot be created'])
     4063    return
     4064end
    40474065fprintf(fid,['##############   CMX file' '\n' ]);
    40484066fprintf(fid,   ['FirstImage ' regexprep(Param.Civ1.ImageA,'\\','\\\\') '\n' ]);% for windows compatibility
     
    43584376    Data.ListVarName={'ny','nx','A'};
    43594377    Data.VarDimName= {'ny','nx',{'ny','nx'}};
    4360 
    4361     Param=read_GUI(handles.civ)
    4362     Param.CheckOutputFile=0;
    4363     [Data,errormsg]=civ_matlab(Param,filecell.nc.civ1{1})% get the grid of x, y positions set for PIV
    4364     if ~isempty(errormsg)
    4365         msgbox_uvmat('ERROR',Data.Txt)
    4366         return
    4367     end
    4368     set(handles.TestCiv1,'BackgroundColor',[1 0 0])
     4378   
     4379    param_patch1=read_GUI(handles.Patch1);
     4380    param_patch1.CivFile=filecell.nc.civ1{1};
     4381    Param.Patch1=param_patch1;
     4382    for irho=1:7
     4383        [Data,errormsg]=civ_matlab(Param);% get the grid of x, y positions set for PIV
     4384        if ~isempty(errormsg)
     4385            msgbox_uvmat('ERROR',Data.Txt)
     4386            return
     4387        end
     4388        SmoothingParam(irho)=Param.Patch1.SmoothingParam;
     4389        Data.Civ1_U_Diff=Data.Civ1_U_Diff(Data.Civ1_FF==0);
     4390        Data.Civ1_V_Diff=Data.Civ1_V_Diff(Data.Civ1_FF==0);
     4391        DiffVel(irho)=sqrt(mean(Data.Civ1_U_Diff.*Data.Civ1_U_Diff+Data.Civ1_V_Diff.*Data.Civ1_V_Diff))
     4392        Param.Patch1.SmoothingParam=2*Param.Patch1.SmoothingParam;
     4393    end
     4394    figure
     4395    plot(SmoothingParam,DiffVel)
     4396    set(handles.TestPatch1,'BackgroundColor',[1 0 0])
    43694397else
    43704398    corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display
     
    43724400        delete(corrfig)
    43734401    end
    4374     hview_field=findobj(allchild(0),'tag','view_field');% look for view_field   
     4402    hview_field=findobj(allchild(0),'tag','view_field');% look for view_field
    43754403    if ~isempty(hview_field)
    43764404        delete(hview_field)
Note: See TracChangeset for help on using the changeset viewer.