Changeset 252


Ignore:
Timestamp:
May 15, 2011, 11:17:08 PM (13 years ago)
Author:
sommeria
Message:

various bugs corrected.

Location:
trunk/src
Files:
1 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/check_functions.m

    r204 r252  
    3434          'civ_3D';... function associated with the interface 'civ_3D.fig' for PIV in volume (in progress)
    3535          'civ_3D.fig';...
     36          'civ_uvmat';...% civ programs, Matlab version (called by civ.m, option Civuvmat)
    3637          'close_fig';...% function  activated when a figure is closed
    3738          'copyfields';...% copy fields between two matlab structures
     
    3940          'create_grid.fig';...% GUI corresponding to create_grid.m
    4041          'dataview';...% function for scanning directories in a campaign
     42          'dataview.fig';...% GUI corresponding to dataview
    4143          'delete_object';...%delete a projection object, defined by its index in the Uvmat list or by its graphic handle 
    4244          'editxml';...%display and edit xml files using a xls schema
     
    6163          'nc2struct';...% transform a netcdf file in a corresponding matlab structure
    6264          'peaklock';...%
     65          'phys_XYZ';...% transform coordiantes from pixels to phys
     66          'pivlab';...% PIV program (Civ1), called by civ_uvmat
     67          'px_XYZ';...% transform coordiantes from phys to pixels
    6368          'plot_field';...%displays a vector field and/or scalar or images
    6469          'plot_object';...%draws a projection object (points, line, plane...)
     
    7075           'read_xls';...%read excel files containing the list of the experiments
    7176           'reinit';...% suppress the personal parameter file 'uvmat_perso.mat'
    72            'RUN_FIX';...% fix velocity fields
    7377           'RUN_STLIN';...% combine 2 displacement fields for stereo PIV
    7478           'series';...% master function for analysis field series, with interface 'series.fig'
  • trunk/src/civ.m

    r251 r252  
    6262% Update handles structure
    6363guidata(hObject, handles);
    64 set(hObject,'WindowButtonUpFcn',{'mouse_up_GUI',handles}) %set mouse action (zoom on uicontrols)
     64set(hObject,'WindowButtonDownFcn',{'mouse_alt_gui',handles}) % allows mouse action with right button (zoom for uicontrol display)
    6565%default initial parameters
    6666filebase=''; % root file name ('filebase'.civ)
    6767ext=[];
    6868set(handles.CivAll,'String',{'CivX';'CivAll';'CivUvmat'})
     69set(handles.subdomain_patch1,'String','1500')% default values
     70set(handles.subdomain_patch2,'String','1500')
     71delete(handles.grid_patch1)
     72delete(handles.get_gridpatch1)
     73delete(handles.grid_patch2)
     74delete(handles.get_gridpatch2)
     75
    6976%default input parameters:
    7077num_i1=1; % set of field i numbers
     
    447454%------------------------------------------------------------------------
    448455set(handles.compare,'Visible','on')
    449 %ext_ima=get(handles.ImaExt,'String');
    450456ext_ima='';%default
    451457nom_type_ima=[];%default
     
    472478    field_count=browse.num_i1;% get an image index type already determined by an input file
    473479end
     480set(handles.civ,'UserData',[]); %refresh list of previous civ files (for STATUS)
    474481
    475482%default first_i and j and increments
     
    11611168    mode='displacement';
    11621169else
    1163     mode_list=get(handles.mode,'String');
    1164     mode_value=get(handles.mode,'Value');
     1170    mode_list=get(handles.mode,'String')
     1171    mode_value=get(handles.mode,'Value')
    11651172    mode=mode_list{mode_value};
    11661173end
     
    21582165                Param.Civ2=par_civ2;
    21592166            end
     2167            if box_test(5)==1
     2168                fix2.WarnFlags=[];
     2169                if get(handles.vec_Fmin2_2,'Value')
     2170                    fix2.WarnFlags=[fix2.WarnFlags -2];
     2171                end
     2172                if get(handles.vec_F4,'Value')
     2173                    fix2.WarnFlags=[fix2.WarnFlags 4];
     2174                end
     2175                if get(handles.vec_F3_2,'Value')
     2176                    fix2.WarnFlags=[fix2.WarnFlags 3];
     2177                end
     2178                fix2.LowerBoundCorr=thresh_vec2C;
     2179                if get(handles.inf_sup2,'Value')
     2180                    fix2.UppperBoundVel=thresh_vel2;
     2181                else
     2182                    fix2.LowerBoundVel=thresh_vel2;
     2183                end   
     2184                if get(handles.get_mask_fix2,'Value')
     2185                    fix2.MaskName=maskname;
     2186                end     
     2187                Param.Fix2=fix2;
     2188            end
    21602189            [Data,erromsg]=civ_uvmat(Param,filecell.nc.civ1{ifile,j});
    21612190            if isempty(errormsg)
     
    25092538                [xx,msg1]=mkdir(subdir_civ1_new);
    25102539                            cd(currentdir);
    2511                 if ~strcmpl(msg1,'')
     2540                if ~strcmp(msg1,'')
    25122541                    msgbox_uvmat('ERROR',['cannot create ' subdir_civ1_new ': ' msg1])
    25132542                    cd(currentdir)
     
    32503279function get_mask_civ1_Callback(hObject, eventdata, handles)
    32513280%------------------------------------------------------------------------
    3252 maskval=get(handles.get_mask_civ1,'Value');
     3281maskval=get(handles.get_mask_civ1,'Value')
    32533282if isequal(maskval,0)
    32543283    set(handles.mask_civ1,'String','')
     
    35073536    str=num2str(num);
    35083537end
    3509 
    3510 % %------------------------------------------------------------------------
    3511 % function mask_civ1_Callback(hObject, eventdata, handles)
    3512 % %------------------------------------------------------------------------
    3513 % set(handles.mask_civ1,'UserData',[])
    3514 % set(handles.mask_civ1,'String','')
    3515 %
    3516 % %------------------------------------------------------------------------
    3517 % function mask_civ2_Callback(hObject, eventdata, handles)
    3518 % %------------------------------------------------------------------------
    3519 % set(handles.mask_civ2,'UserData',[])
    3520 % set(handles.mask_civ2,'String','')
    3521 %
    3522 % %------------------------------------------------------------------------
    3523 % function mask_fix1_Callback(hObject, eventdata, handles)
    3524 % %------------------------------------------------------------------------
    3525 % set(handles.mask_fix1,'UserData',[])
    3526 % set(handles.mask_fix1,'String','')
    3527 %
    3528 % %------------------------------------------------------------------------
    3529 % function mask_fix2_Callback(hObject, eventdata, handles)
    3530 % %------------------------------------------------------------------------
    3531 % set(handles.mask_fix2,'UserData',[])
    3532 % set(handles.mask_fix2,'String','')
    35333538
    35343539%------------------------------------------------------------------------
     
    37843789% if ~isempty(patch_newBin)
    37853790set(handles.test_interp,'Visible','off');
     3791stereo_test=get(handles.compare,'Value');
     3792if stereo_test==3
     3793    set(handles.test_stereo1,'Visible','on')
     3794end
    37863795% end
    3787 set(handles.get_gridpatch1,'Visible','on')
    3788 set(handles.grid_patch1,'string','none');
    3789 set(handles.grid_patch1,'Visible','on')
     3796%set(handles.get_gridpatch1,'Visible','on')
     3797%set(handles.grid_patch1,'string','none');
     3798%set(handles.grid_patch1,'Visible','on')
    37903799
    37913800%------------------------------------------------------------------------
     
    38033812set(handles.nx_patch1_title,'Visible','off')
    38043813set(handles.ny_patch1_title,'Visible','off')
     3814set(handles.test_stereo1,'Visible','off')
    38053815%set(handles.test_interp,'Visible','off')
    3806 set(handles.get_gridpatch1,'Visible','off')
    3807 set(handles.grid_patch1,'Visible','off')
     3816%set(handles.get_gridpatch1,'Visible','off')
     3817%set(handles.grid_patch1,'Visible','off')
    38083818
    38093819%------------------------------------------------------------------------
     
    39343944set(handles.nx_patch2_title,'Visible','on')
    39353945set(handles.ny_patch2_title,'Visible','on')
    3936 set(handles.get_gridpatch2,'Visible','on')
    3937 set(handles.grid_patch2,'Visible','on')
     3946% set(handles.get_gridpatch2,'Visible','on')
     3947% set(handles.grid_patch2,'Visible','on')
    39383948set(handles.list_pair_civ2,'Visible','on')
    39393949set(handles.subdir_civ2,'Visible','on')
    39403950set(handles.subdir_civ2_text,'Visible','on')
     3951stereo_test=get(handles.compare,'Value');
     3952if stereo_test==3
     3953    set(handles.test_stereo2,'Visible','on')
     3954end
    39413955
    39423956%------------------------------------------------------------------------
     
    39543968set(handles.nx_patch2_title,'Visible','off')
    39553969set(handles.ny_patch2_title,'Visible','off')
    3956 set(handles.get_gridpatch2,'Visible','off')
    3957 set(handles.grid_patch2,'Visible','off')
     3970% set(handles.get_gridpatch2,'Visible','off')
     3971% set(handles.grid_patch2,'Visible','off')
    39583972if isequal(get(handles.CIV2,'Value'),0) & isequal(get(handles.FIX2,'Value'),0)
    39593973    set(handles.list_pair_civ2,'Visible','off')
     
    39613975    set(handles.subdir_civ2_text,'Visible','off')
    39623976end
    3963 
     3977set(handles.test_stereo2,'Visible','off')
    39643978%------------------------------------------------------------------------
    39653979function enable_pair1(handles,state)
     
    45184532    set(handles.test_stereo2,'Value',0)
    45194533end
     4534if test==3 && get(handles.PATCH1,'Value')
     4535    set(handles.stereo1,'Visible','on')
     4536else
     4537    set(handles.stereo1,'Visible','off')
     4538end
     4539if test==3 && get(handles.PATCH2,'Value')
     4540    set(handles.stereo2,'Visible','on')
     4541else
     4542    set(handles.stereo2,'Visible','off')
     4543end
    45204544mode_Callback(hObject, eventdata, handles)
    45214545
     
    47104734    Param.Civ1=par_civ1;
    47114735    Data=civ_uvmat(Param);
    4712 %     stepx=str2num(par_civ1.dx);
    4713 %     stepy=str2num(par_civ1.dy);
    4714 %     ibx2=ceil(str2num(par_civ1.ibx)/2);
    4715 %     iby2=ceil(str2num(par_civ1.iby)/2);
    4716 %     isx2=ceil(str2num(par_civ1.isx)/2);
    4717 %     isy2=ceil(str2num(par_civ1.isy)/2);
    4718 %     shiftx=str2num(par_civ1.shiftx);
    4719 %     shifty=str2num(par_civ1.shifty);
    4720 % %             ibx=2*ibx2-1;%ibx and iby odd, reduced by 1 if even
    4721 % %             iby=2*iby2-1;
    4722 %     miniy=max(1+isy2-shifty,1+iby2)
    4723 %     minix=max(1+isx2-shiftx,1+ibx2)
    4724 %     maxiy=min(size(Data.A,1)-isy2-shifty,size(Data.A,1)-iby2)
    4725 %     maxix=min(size(Data.A,2)-isx2-shiftx,size(Data.A,2)-ibx2)
    4726 % %             maxix=stepx*(floor(size(image1_roi,2)/stepx))-(2*ibx2-2)+ibx2;
    4727 %     [GridX,GridY]=meshgrid(minix:stepx:maxix,miniy:stepy:maxiy);
    4728 %     PointCoord(:,1)=reshape(GridX,[],1);
    4729 %     PointCoord(:,2)=reshape(GridY,[],1);
    47304736    Data.ListVarName=[Data.ListVarName {'ny','nx','A'}];
    47314737    Data.VarDimName=[Data.VarDimName {'ny','nx',{'ny','nx'}}];
     
    47374743    hhview_field=guihandles(hview_field);
    47384744    set(hview_field,'CurrentAxes',hhview_field.axes3)
    4739     %hpoints=line(PointCoord(:,1),PointCoord(:,2),'Color','y','LineStyle','.','Marker','*','LineWidth',4,'Tag','grid_points');
    47404745    ViewData=get(hview_field,'UserData');
    47414746    ViewData.CivHandle=handles.civ;% indicate the handle of the civ GUI in view_field
     
    47744779val=get(handles.status,'Value');
    47754780if val==0
     4781    set(handles.status,'BackgroundColor',[0 1 0])
    47764782    hfig=findobj(allchild(0),'name','civ_status');
    47774783    if ~isempty(hfig)
     
    47804786    return
    47814787end
     4788set(handles.status,'BackgroundColor',[1 1 0])
     4789drawnow
    47824790listtype={'civ1','fix1','patch1','civ2','fix2','patch2'};
    47834791box_test(1)=get(handles.CIV1,'Value');
     
    47884796box_test(6)=get(handles.PATCH2,'Value');
    47894797option_civ=find(box_test,1,'last');%last selected option (non-zero index of box_test)
    4790 filecell=get(handles.civ,'UserData');
     4798filecell=get(handles.civ,'UserData');%retrieve the list of output files expected for PIV
     4799test_new=0;
    47914800if ~isfield(filecell,'nc')
     4801    test_new=1;
    47924802    [ref_i,ref_j,errormsg]=find_ref_indices(handles);
    47934803    if ~isempty(errormsg)
     
    47954805        return
    47964806    end
    4797     filecell=set_civ_filenames(handles,ref_i,ref_j,box_test);%determine the list of output files expected from the GUI status
    4798 end
    4799 
     4807    filecell=set_civ_filenames(handles,ref_i,ref_j,box_test);%determine the output file expected from the GUI status
     4808end
    48004809if ~isequal(box_test(4:6),[0 0 0])
    4801     civ_files=filecell.nc.civ2;
     4810    civ_files=filecell.nc.civ2;%case of civ2 operations
    48024811else
    48034812    civ_files=filecell.nc.civ1;
     
    48074816hfig=findobj(allchild(0),'name','civ_status');
    48084817if isempty(hfig)
    4809     hfig=figure;
     4818    hfig=figure('DeleteFcn',@stop_status);
    48104819    set(hfig,'name','civ_status')
    48114820    hlist=uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', @open_view_field,'tag','list');
    4812     uicontrol('Style','listbox','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','msgbox');
     4821    uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','msgbox','Max',2,'String','checking files...');
    48134822    uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]);
    48144823    uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','OK','FontWeight','bold','FontUnits','normalized','FontSize',0.9,'Callback',@close_GUI);
    48154824    BarPosition=[0.05 0.81 0.01 0.05];
    48164825    hwaitbar=uicontrol('Style','frame','Units','normalized', 'Position',BarPosition ,'BackgroundColor',[1 0 0],'tag','waitbar');
     4826    drawnow
    48174827end
    48184828% datnum=[];
     
    48764886        [first,ind]=min(datnum);
    48774887        [last,indlast]=max(datnum);
     4888        if test_new
     4889            message='existing file status, no processing launched yet';
     4890        else
    48784891        message={[num2str(count) ' file(s) done over ' num2str(nbfiles)] ;['oldest modification:  ' cell2mat(filefound(ind)) ' : ' datestr(first)];...
    48794892            ['latest modification:  ' cell2mat(filefound(indlast)) ' : ' datestr(last)]};
     4893        end
    48804894    end
    48814895    hfig=findobj(allchild(0),'name','civ_status');
    4882     if isempty(hfig)
    4883         set(handles.status,'Value',0)%stop program if the figure has been suppressed
     4896    if isempty(hfig)% the status list has been deleted
    48844897        return
    48854898    else
     
    48894902        set(hlist,'String',Tabchar)
    48904903        set(hmsgbox,'String', message)
    4891         if count>0
     4904        if count>0 && ~test_new
    48924905            BarPosition(3)=0.9*count/nbfiles;
    48934906            set(hwaitbar,'Position',BarPosition)
     
    48954908    end
    48964909    set(hlist,'UserData',rootroot)
    4897     pause(5)% wait 5 seconds for next check
     4910    pause(10)% wait 10 seconds for next check
    48984911end
    48994912
    49004913   
    4901 %-------------------------------------------------------------------   
    4902 % call 'view_field.fig' to display the selected field
     4914%------------------------------------------------------------------------   
     4915% call 'view_field.fig' to display the  field selected in the list of 'status'
    49034916function open_view_field(hObject, eventdata)
    4904 %-------------------------------------------------------------------
    4905      list=get(hObject,'String');
    4906      index=get(hObject,'Value');
    4907      rootroot=get(hObject,'UserData');
    4908      filename=list{index};
    4909      ind_dot=findstr(filename,'...');
    4910      filename=filename(1:ind_dot-1);
    4911       filename=fullfile(rootroot,filename);
    4912       delete(get(hObject,'parent'))%delete the display figure to stop the check process
    4913       if exist(filename,'file')%visualise the vel field if it exists
    4914         uvmat(filename)
    4915         set(gcbo,'Value',1)
    4916       end
    4917 
    4918 %-------------------------------------------------------------------   
    4919 % call 'view_field.fig' to display the selected field
     4917%------------------------------------------------------------------------
     4918list=get(hObject,'String');
     4919index=get(hObject,'Value');
     4920rootroot=get(hObject,'UserData');
     4921filename=list{index};
     4922ind_dot=findstr(filename,'...');
     4923filename=filename(1:ind_dot-1);
     4924filename=fullfile(rootroot,filename);
     4925delete(get(hObject,'parent'))%delete the display figure to stop the check process
     4926if exist(filename,'file')%visualise the vel field if it exists
     4927    uvmat(filename)
     4928    set(gcbo,'Value',1)
     4929end
     4930
     4931%------------------------------------------------------------------------   
     4932% launched by pressing OK on the status figure
    49204933function close_GUI(hObject, eventdata)
    4921 %-------------------------------------------------------------------
    4922      delete(gcbf)
    4923 
    4924 
     4934%------------------------------------------------------------------------
     4935    delete(gcbf)
     4936   
     4937%------------------------------------------------------------------------   
     4938% launched by deleting the status figure
     4939function stop_status(hObject, eventdata)
     4940%------------------------------------------------------------------------
     4941hciv=findobj(allchild(0),'tag','civ');
     4942hhciv=guidata(hciv);
     4943set(hhciv.status,'value',0) %reset the status uicontrol in the GUI civ
     4944set(hhciv.status,'BackgroundColor',[0 1 0])
     4945
     4946%------------------------------------------------------------------------
    49254947% --- Executes on button press in CivAll.
    49264948function CivAll_Callback(hObject, eventdata, handles)
     4949%------------------------------------------------------------------------
    49274950Listprog=get(handles.CivAll,'String');
    49284951index=get(handles.CivAll,'Value');
     
    49324955        set(handles.thresh_patch1,'Visible','off')
    49334956        set(handles.thresh_text1,'Visible','off')
     4957        set(handles.thresh_patch2,'Visible','off')
     4958        set(handles.thresh_text2,'Visible','off')
    49344959        set(handles.rho,'Style','edit')
    49354960        set(handles.rho,'String','1')
     4961        set(handles.BATCH,'Enable','on')
    49364962    case 'CivAll'
    49374963        if get(handles.PATCH1,'Value')
     
    49414967        set(handles.rho,'Style','edit')
    49424968        set(handles.rho,'String','1')
     4969        set(handles.BATCH,'Enable','on')
    49434970    case 'CivUvmat'
    49444971        if get(handles.PATCH1,'Value')
     
    49464973            set(handles.thresh_text1,'Visible','on')
    49474974        end
     4975        if get(handles.PATCH2,'Value')
     4976            set(handles.thresh_patch2,'Visible','on')
     4977            set(handles.thresh_text2,'Visible','on')
     4978        end
    49484979        set(handles.rho,'Style','popupmenu')
    49494980        set(handles.rho,'Value',1)
    49504981        set(handles.rho,'String',{'1';'2'})
    4951 end
    4952 
     4982        set(handles.BATCH,'Enable','off')
     4983end
     4984
  • trunk/src/civ_uvmat.m

    r251 r252  
    3232    PointCoord(:,1)=reshape(GridX,[],1);
    3333    PointCoord(:,2)=reshape(GridY,[],1);
    34     if ~isempty(par_civ1.maskname)
     34    if isfield(par_civ1,'maskname') && ~isempty(par_civ1.maskname)
    3535        maskname=par_civ1.maskname;
    3636        mask=imread(maskname);
     
    133133            Data.fix=1;
    134134            Data.ListVarName=[Data.ListVarName {'vec_FixFlag'}];
    135             Data.VarDimName=[Data.VardimName {'nb_vectors'}];
     135            Data.VarDimName=[Data.VarDimName {'nb_vectors'}];
    136136        end
    137137        Data.vec_FixFlag=fix_uvmat(Param.Fix1,Data.vec_F,Data.vec_C,Data.vec_U,Data.vec_V,Data.vec_X,Data.vec_Y);
     
    174174%% Civ2
    175175if isfield (Param,'Civ2')
    176     par_civ2=Param.Civ2
     176    par_civ2=Param.Civ2;
    177177    image1=imread(par_civ2.filename_ima_a);
    178178    image2=imread(par_civ2.filename_ima_b);
     
    235235    Data.CivStage=Data.CivStage+1;
    236236end
     237
     238%% Fix2
     239if isfield (Param,'Fix2')
     240    ListFixParam=fieldnames(Param.Fix2);
     241    for ilist=1:length(ListFixParam)
     242        ParamName=ListFixParam{ilist};
     243        ListName=['Fix1_' ParamName];
     244        eval(['Data.ListGlobalAttribute=[Data.ListGlobalAttribute ''' ParamName '''];'])
     245        eval(['Data.' ListName '=Param.Fix2.' ParamName ';'])
     246    end
     247    if test_civx
     248        if ~isfield(Data,'fix2')
     249            Data.ListGlobalAttribute=[Data.ListGlobalAttribute 'fix2'];
     250            Data.fix2=1;
     251            Data.ListVarName=[Data.ListVarName {'vec2_FixFlag'}];
     252            Data.VarDimName=[Data.VarDimName {'nb_vectors2'}];
     253        end
     254        Data.vec_FixFlag=fix_uvmat(Param.Fix2,Data.vec2_F,Data.vec2_C,Data.vec2_U,Data.vec2_V,Data.vec2_X,Data.vec2_Y);
     255    else
     256        Data.ListVarName=[Data.ListVarName {'Civ2_FF'}];
     257        Data.VarDimName=[Data.VarDimName {'nbvec2'}];
     258        nbvar=length(Data.ListVarName);
     259        Data.VarAttribute{nbvar}.Role='errorflag';   
     260        Data.Civ2_FF=fix_uvmat(Param.Fix2,Data.Civ2_F,Data.Civ2_C,Data.Civ2_U,Data.Civ2_V);
     261        Data.CivStage=5;   
     262    end
     263end   
     264
     265%% Patch2
     266if isfield (Param,'Patch2')
     267    Data.ListGlobalAttribute=[Data.ListGlobalAttribute {'Patch2_Rho','Patch2_Threshold','Patch2_SubDomain'}];
     268    Data.Patch2_Rho=str2double(Param.Patch2.Rho);
     269    Data.Patch2_Threshold=str2double(Param.Patch2.Threshold);
     270    Data.Patch2_SubDomain=str2double(Param.Patch2.SubDomain);
     271    Data.ListVarName=[Data.ListVarName {'Civ2_U_Diff','Civ2_V_Diff','Civ2_X_SubRange','Civ2_Y_SubRange','Civ2_NbSites','Civ2_X_tps','Civ2_Y_tps','Civ2_U_tps','Civ2_V_tps'}];
     272    Data.VarDimName=[Data.VarDimName {'NbVec2','NbVec2',{'NbSubDomain2','Two'},{'NbSubDomain2','Two'},'NbSubDomain2',...
     273             {'NbVec2Sub','NbSubDomain2'},{'NbVec2Sub','NbSubDomain2'},{'Nbtps2','NbSubDomain2'},{'Nbtps2','NbSubDomain2'}}];
     274    nbvar=length(Data.ListVarName);
     275    Data.VarAttribute{nbvar-1}.Role='vector_x';
     276    Data.VarAttribute{nbvar}.Role='vector_y';
     277    Data.Civ2_U_Diff=zeros(size(Data.Civ2_X));
     278    Data.Civ2_V_Diff=zeros(size(Data.Civ2_X));
     279    if isfield(Data,'Civ2_FF')
     280        ind_good=find(Data.Civ2_FF==0);
     281    else
     282        ind_good=1:numel(Data.Civ2_X);
     283    end
     284    [Data.Civ2_X_SubRange,Data.Civ2_Y_SubRange,Data.Civ2_NbSites,FFres,Ures, Vres,Data.Civ2_X_tps,Data.Civ2_Y_tps,Data.Civ2_U_tps,Data.Civ2_V_tps]=...
     285                            patch_uvmat(Data.Civ2_X(ind_good)',Data.Civ2_Y(ind_good)',Data.Civ2_U(ind_good)',Data.Civ2_V(ind_good)',Data.Patch2_Rho,Data.Patch2_Threshold,Data.Patch2_SubDomain);
     286      Data.Civ2_U_Diff(ind_good)=Data.Civ2_U(ind_good)-Ures;
     287      Data.Civ2_V_Diff(ind_good)=Data.Civ2_V(ind_good)-Vres;
     288      Data.Civ2_FF(ind_good)=FFres;
     289      Data.CivStage=3;                             
     290end   
     291
    237292%% write result
    238293% 'TESTcalc'
     
    266321
    267322function FF=fix_uvmat(Param,F,C,U,V,X,Y)
    268 %error=[]; %default
    269 Param
    270323FF=zeros(size(F));%default
    271324
  • trunk/src/geometry_calib.m

    r242 r252  
    8787guidata(hObject, handles);
    8888set(hObject,'DeleteFcn',{@closefcn})%
     89set(hObject,'WindowButtonDownFcn',{'mouse_alt_gui',handles}) % allows mouse action with right button (zoom for uicontrol display)
    8990
    9091%set the position of the interface
  • trunk/src/mouse_down.m

    r244 r252  
    113113            end
    114114            break
    115         elseif isequal(htype,'uicontrol') && isequal(get(hchild(ichild),'Visible'),'on')
     115        elseif isequal(get(hObject,'SelectionType'),'alt') && isequal(htype,'uicontrol') && isequal(get(hchild(ichild),'Visible'),'on') && ~isequal(get(hchild(ichild),'tag'),'frame_object')&&...
     116             ~isequal(get(hchild(ichild),'tag'),'list_object_2') && ~isequal(get(hchild(ichild),'tag'),'list_object_1')
    116117                msg_pos(1:2)=currentfig_pos(1:2)+obj_pos(1:2).*currentfig_pos(3:4);
    117118                msgbox_uvmat(['uicontrol: ' get(hchild(ichild),'Tag')],'',get(hchild(ichild),'String'),msg_pos)
    118             %msgbox(get(hchild(ichild),'String'),get(hchild(ichild),'Tag'))
    119119            break
    120120        end
  • trunk/src/mouse_up.m

    r221 r252  
    250250    if  isequal(get(currentfig,'SelectionType'),'normal');%if left button has been pressed, zoom in by a factor of 2
    251251        xlim(1)=0.5*xy(1,1)+0.5*xlim(1);
    252         xlim(2)=0.5*xy(1,1)+0.5*xlim(2);
     252        xlim(2)=0.5*xy(1,1)+0.5*xlim(2);%double the field whith the middle at the selected points
    253253        set(currentaxes,'XLim',xlim)
    254254        ylim(2)=0.5*xy(1,2)+0.5*ylim(2);
     
    257257 % if right mouse button has been pressed, zoom out by a factor of 2
    258258    else
    259         xlim(1)=2*xlim(1)-xy(1,1);
     259        xlim(1)=2*xlim(1)-xy(1,1);% reverse of the zoom on action
    260260        xlim(2)=2*xlim(2)-xy(1,1);
    261261        ylim(1)=2*ylim(1)-xy(1,2);
    262262        ylim(2)=2*ylim(2)-xy(1,2);
    263263        if isfield(AxeData,'RangeX')&& isfield(AxeData,'RangeY')
    264             'TESTup'
    265             AxeData
    266264            xlim(1)=max(AxeData.RangeX(1),xlim(1));
    267265            xlim(2)=min(AxeData.RangeX(2),xlim(2));
    268266            ylim(1)=max(AxeData.RangeY(1),ylim(1));
    269267            ylim(2)=min(AxeData.RangeY(2),ylim(2));
     268            if ylim(1)>=ylim(2)|| xlim(1)>=xlim(2)
     269                xlim=AxeData.RangeX;
     270                ylim=AxeData.RangeY;
     271            end
    270272         % desactivate the zoom if the full field is visible within the axes
    271273            if isequal(xlim,AxeData.RangeX) && isequal(ylim,AxeData.RangeY)
     
    276278            end
    277279        end
    278         xlim
    279         ylim
    280280        set(currentaxes,'XLim',xlim)
    281281        set(currentaxes,'YLim',ylim)
  • trunk/src/name2display.m

    r138 r252  
    182182    subdir=[subdir extdir];
    183183end
     184
     185%resolve ambigous nomenclature types when the number of 0 is unknown (type %0...):
     186ind_zero=findstr('0',nom_type);
     187nb_zero=numel(ind_zero);
     188if ~isempty(ind_zero)
     189    for itest=0:nb_zero-1
     190        filename=name_generator(fullfile(RootPath,RootFile),1,1,ext,nom_type,1,1,1,subdir);
     191        if exist(filename,'file')
     192            break
     193        else
     194            nom_type(ind_zero(1))=[] % remove a zero in nom_type
     195        end
     196    end
     197end
  • trunk/src/plot_field.m

    r247 r252  
    241241    msgbox_uvmat('ERROR', errormsg)
    242242end
    243 if isfield(PlotParamOut,'RangeX')&& isfield(PlotParamOut,'RangeY')
     243if isfield(PlotParamOut,'MinX')
    244244%     'TESTplot'
    245245%     haxes
     
    248248%     set(haxes,'XLim',[PlotParamOut.MinX PlotParamOut.MaxX])
    249249%     set(haxes,'YLim',[PlotParamOut.MinY PlotParamOut.MaxY])
    250     AxeData.RangeX=PlotParamOut.RangeX;%'[PlotParamOut.MinX PlotParamOut.MaxX];
    251     AxeData.RangeY=PlotParamOut.RangeY;%[PlotParamOut.MinY PlotParamOut.MaxY]
     250    AxeData.RangeX=[PlotParamOut.MinX PlotParamOut.MaxX];%'[PlotParamOut.MinX PlotParamOut.MaxX];
     251    AxeData.RangeY=[PlotParamOut.MinY PlotParamOut.MaxY];%[PlotParamOut.MinY PlotParamOut.MaxY]
    252252end
    253253
     
    10711071%store the coordinate extrema occupied by the field
    10721072if ~isempty(Data)
     1073    XMin=[];
     1074    XMax=[];
     1075    YMin=[];
     1076    YMax=[];
    10731077    fix_lim=isfield(PlotParam,'FixLimits') && PlotParam.FixLimits;
    10741078    if fix_lim
    10751079        if ~isfield(PlotParam,'MinX')||~isfield(PlotParam,'MaxX')||~isfield(PlotParam,'MinY')||~isfield(PlotParam,'MaxY')
    1076             fix_lim=0; %free limits if lits are not set,
     1080            fix_lim=0; %free limits if limits are not set,
     1081        else
     1082            XMin=PlotParam.MinX
     1083            XMax=PlotParam.MaxX;
     1084            YMin=PlotParam.MinY;
     1085            YMax=PlotParam.MaxY;
    10771086        end  %else PlotParamOut.XMin =PlotParam.XMin...
    1078     end
    1079 %     if ~fix_lim
    1080         XMin=[];
    1081         XMax=[];
    1082         YMin=[];
    1083         YMax=[];
    1084         if test_ima%both background image and vectors coexist, take the wider bound
     1087    else
     1088        if test_ima %both background image and vectors coexist, take the wider bound
    10851089            XMin=min(AX);
    10861090            XMax=max(AX);
    10871091            YMin=min(AY);
    10881092            YMax=max(AY);
    1089         end
    1090         if test_vec
    1091             XMin=min(XMin,min(vec_X));
    1092             XMax=max(XMax,max(vec_X));
    1093             YMin=min(YMin,min(vec_Y));
    1094             YMax=max(YMax,max(vec_Y));
    1095         end
    1096         PlotParamOut.RangeX=[XMin XMax]; %range of x, to be stored in the user data of the plot axes
    1097         PlotParamOut.RangeY=[YMin YMax]; %range of x, to be stored in the user data of the plot axes
    1098     if ~fix_lim
     1093            if test_vec
     1094                XMin=min(XMin,min(vec_X));
     1095                XMax=max(XMax,max(vec_X));
     1096                YMin=min(YMin,min(vec_Y));
     1097                YMax=max(YMax,max(vec_Y));
     1098            end
     1099        elseif test_vec
     1100            XMin=min(vec_X);
     1101            XMax=max(vec_X);
     1102            YMin=min(vec_Y);
     1103            YMax=max(vec_Y);
     1104        end
     1105    end
     1106%     PlotParamOut.RangeX=[XMin XMax]; %range of x, to be stored in the user data of the plot axes
     1107%     PlotParamOut.RangeY=[YMin YMax]; %range of x, to be stored in the user data of the plot axes
     1108%     if ~fix_lim
    10991109        PlotParamOut.MinX=XMin;
    11001110        PlotParamOut.MaxX=XMax;
     
    11071117            set(haxes,'YLim',[YMin YMax]);% set x limits of frame in axes coordinates
    11081118        end
    1109     end
     1119%     end
    11101120    set(haxes,'YDir','normal')
    11111121    set(get(haxes,'XLabel'),'String',[XName ' (' x_units ')']);
  • trunk/src/series.m

    r248 r252  
    125125    FieldCell{1}=param.list_fields{param.index_fields};
    126126end
    127 % if isfield(param,'velTypeMenu')&&isfield(param,'velTypeIndex')
    128 %     set(handles.VelTypeMenu,'Value',param.VelTypeIndex)
    129 %     set(handles.VelTypeMenu,'String',param.VelTypeMenu)
    130 % end 
    131 set(hObject,'WindowButtonUpFcn',{'mouse_up_gui',handles})
     127set(hObject,'WindowButtonDownFcn',{'mouse_alt_gui',handles}) % allows mouse action with right button (zoom for uicontrol display)
    132128NomType_Callback(hObject, eventdata, handles)
    133129
  • trunk/src/set_object.m

    r233 r252  
    8484end
    8585set(hObject,'KeyPressFcn',{'keyboard_callback',handles})%set keyboard action function (allow action on uvmat when set_object is in front)
     86set(hObject,'WindowButtonDownFcn',{'mouse_alt_gui',handles}) % allows mouse action with right button (zoom for uicontrol display)
    8687enable_plot=0;%default: does not allow plot of object and projection
    8788
  • trunk/src/uvmat.m

    r251 r252  
    230230set(hObject,'WindowButtonUpFcn',{'mouse_up',handles})
    231231set(hObject,'DeleteFcn',{@closefcn})%
     232set(handles.list_object_1,'ButtonDownFcn',{@list_object_1_Callback,handles})% allows activation of lis_object_1_callback with right mouse click
     233set(handles.list_object_2,'ButtonDownFcn',{@list_object_2_Callback,handles})
    232234
    233235%% refresh projection plane
     
    16761678function runplus_Callback(hObject, eventdata, handles)
    16771679%-------------------------------------------------------------------
     1680eventdata
    16781681set(handles.runplus,'BackgroundColor',[1 1 0])%paint the command button in yellow
    16791682drawnow
     
    25702573else
    25712574    % create a default projection
    2572 %     UvData.Object{1}.ProjMode='projection';%main plotting plane
    2573 %     UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat
    2574 %     set(handles.list_object_1,'Value',1);
    2575 %     set(handles.list_object_1,'String',{''});
     2575    UvData.Object{1}.ProjMode='projection';%main plotting plane
     2576    UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat
     2577    set(handles.list_object_1,'Value',1);
     2578    list_object=get(handles.list_object_1,'String')
     2579    if isempty(list_object)
     2580        list_object={''};
     2581    elseif ~isempty(list_object{1})
     2582        list_object=[{''};list_object];
     2583    end
     2584    set(handles.list_object_1,'String',list_object);
     2585    set(handles.list_object_2,'String',list_object);
    25762586end
    25772587% if ~isfield(UvData.Object{1},'plotaxes')
     
    42954305list_str=get(handles.list_object_1,'String');
    42964306IndexObj=get(handles.list_object_1,'Value');
    4297 str_1=list_str{IndexObj};
    4298 % val_2=get(handles.list_object_2,'Value');
    4299 % str_2=get(handles.list_object_2,'String');
    4300 % if isequal(val_2,IndexObj)% if the first selection is equal to the second, it will suppress the second
    4301 %     set(handles.list_object_2,'Value',numel(str_2))%select the end of the list ('...')
    4302 %     list_object_2_Callback(hObject, eventdata, handles)
    4303 % end
    4304 update_object(handles,IndexObj,1,str_1)
     4307%IndexObj(2)=get(handles.list_object_2,'Value');
     4308update_object(handles,IndexObj,1,list_str{IndexObj})
    43054309
    43064310%------------------------------------------------------------------------
     
    43104314list_str=get(handles.list_object_2,'String');
    43114315IndexObj=get(handles.list_object_2,'Value');
    4312 if ischar(list_str) || isempty(list_str{IndexObj})% || strcmp(list_str{IndexObj},'...')
     4316%IndexObj(2)=get(handles.list_object_2,'Value')-1;
     4317% if no projection object is selected, close view_field
     4318if ischar(list_str) || isempty(list_str{IndexObj})
    43134319    hview_field=findobj(allchild(0),'Tag','view_field');
    43144320    if ~isempty(hview_field)
     
    43204326    end
    43214327else
    4322     update_object(handles,IndexObj,2,list_str{IndexObj})
     4328    if isequal(get(handles.uvmat,'SelectionType'),'alt')
     4329        option=4;%will show object properties on the GUI set_object
     4330    else
     4331        option=2; % just update the projection
     4332    end
     4333    update_object(handles,IndexObj,option,list_str{IndexObj})   
    43234334end
    43244335
     
    43274338%------------------------------------------------------------------------
    43284339UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
    4329 if numel(UvData.Object)<IndexObj;
     4340if numel(UvData.Object)<max(IndexObj);
    43304341    return
    43314342end
     4343% if option==1 ||option==3
    43324344ObjectData=UvData.Object{IndexObj};
     4345% else
     4346%    ObjectData=UvData.Object{IndexObj};
     4347% end
    43334348ObjectData.Name=ObjectName;
    43344349if isequal(get(handles.edit_object,'Value'),1)
     
    43524367    end
    43534368end
    4354 hset_object=set_object(ObjectData,[],ZBounds);% call the set_object interface,
    4355 
    4356 % %project the current field on the object and plot it
    4357 ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData
    4358 if option==1%length(UvData.Object)>= IndexObj && isfield(UvData.Object{IndexObj},'plotaxes')&& ishandle(UvData.Object{IndexObj}.plotaxes)
     4369
     4370if option==3 ||option==4% right mouse selection, show the GUI set_object:
     4371    hset_object=set_object(ObjectData,[],ZBounds);
     4372end
     4373
     4374%project on the selected object and update the corresponding plot
     4375hview_field=findobj(allchild(0),'tag','view_field');
     4376% PlotHandles=guidata(hview_field);
     4377if option==1 ||  option==3%length(UvData.Object)>= IndexObj && isfield(UvData.Object{IndexObj},'plotaxes')&& ishandle(UvData.Object{IndexObj}.plotaxes)
    43594378    PlotHandles=handles;
    43604379else
    4361     hview_field=findobj(allchild(0),'tag','view_field');
    43624380    if isempty(hview_field)
    43634381        hview_field=view_field;
     
    43654383    PlotHandles=guidata(hview_field);
    43664384end
    4367 %plot_field(ProjData,PlotHandles.axes3,PlotHandles);
    4368 set(handles.uvmat,'UserData',UvData)
    4369 hother=findobj('Tag','proj_object');%find all the proj objects
     4385if option==1 ||option==2% lefet mouse selection, peroject the field:
     4386    ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData
     4387    plot_field(ProjData,PlotHandles.axes3,read_plot_param(PlotHandles));%read plotting parameters on the uvmat interfacPlotHandles);
     4388    UvData.Object=update_obj(UvData,IndexObj,[]);
     4389    set(handles.uvmat,'UserData',UvData)
     4390end
     4391
     4392
     4393% set(handles.uvmat,'UserData',UvData)
     4394hother=[findobj(handles.axes3,'Tag','proj_object') ;findobj(PlotHandles.axes3,'Tag','proj_object')] ;%find all the proj objects
     4395hother=[hother ;findobj(handles.axes3,'Tag','DeformPoint'); findobj(PlotHandles.axes3,'Tag','DeformPoint')];
    43704396for iobj=1:length(hother)
    43714397    if isequal(get(hother(iobj),'Type'),'rectangle')||isequal(get(hother(iobj),'Type'),'patch')
     
    43834409    set(hother(iobj),'Selected','off')
    43844410end
    4385 hother=findobj('Tag','DeformPoint');
    4386 set(hother,'Color','b');
    4387 set(hother,'Selected','off')
    43884411if isfield(ObjectData,'DisplayHandle_uvmat')
    43894412    if ishandle(ObjectData.DisplayHandle_uvmat)
     
    44174440        end
    44184441    end
    4419     %     end
    4420 end
    4421 % pause(0.1)
    4422 figure(hset_object)%put set_object in front
     4442end
    44234443
    44244444%------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.