Changeset 224 for trunk/src


Ignore:
Timestamp:
Mar 18, 2011, 10:41:48 PM (13 years ago)
Author:
sommeria
Message:

civ : case of relative path for binaries treated. Test_civ improved: real time calculation of image correlation

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r220 r224  
    182182elseif isequal(ind_opening,4)
    183183    set(handles.CIV2,'Value',1)
    184     enable_civ2(handles,1)
     184    enable_civ2(handles,'on')
    185185elseif isequal(ind_opening,5)
    186186    set(handles.FIX2,'Value',1)
     
    424424elseif isequal(ind_opening,4)
    425425    set(handles.CIV2,'Value',1)
    426     enable_civ2(handles,1)
     426    enable_civ2(handles,'on')
    427427elseif isequal(ind_opening,5)
    428428    enable_pair1(handles,'off')
     
    17101710    end
    17111711    if isfield(sparam,'CivBin')
    1712         if ~exist(sparam.CivBin,'file')
     1712        if ~exist(sparam.CivBin,'file')||~isequal(which(sparam.CivBin),sparam.CivBin)% if path defined as relative to uvmat
    17131713            CivBin=sparam.CivBin;
    17141714            sparam.CivBin=fullfile(path_UVMAT,sparam.CivBin);
     
    17201720    end
    17211721    if isfield(sparam,'Civ1Bin')
    1722         if ~exist(sparam.Civ1Bin,'file')
    1723             CivBin=sparam.Civ1Bin;
     1722        if ~exist(sparam.Civ1Bin,'file')||~isequal(which(sparam.Civ1Bin),sparam.Civ1Bin)% if path defined as relative to uvmat
     1723%             CivBin=sparam.Civ1Bin;
    17241724            sparam.Civ1Bin=fullfile(path_UVMAT,sparam.Civ1Bin);
    1725             if ~exist(sparam.CivBin,'file')
    1726                  msgbox_uvmat('ERROR',['civ1 binary ' CivBin ' defined in PARAM.xm does not exist'])
     1725            if ~exist(sparam.Civ1Bin,'file')
     1726                 msgbox_uvmat('ERROR',['civ1 binary ' sparam.Civ1Bin ' defined in PARAM.xm does not exist'])
    17271727                 return
    17281728            end
     
    17301730    end
    17311731    if isfield(sparam,'Civ2Bin')
    1732         CivBin=sparam.Civ2Bin;
    1733         if ~exist(sparam.Civ2Bin,'file')
     1732%         CivBin=sparam.Civ2Bin;
     1733        if ~exist(sparam.Civ2Bin,'file')||~isequal(which(sparam.Civ2Bin),sparam.Civ2Bin)% if path defined as relative to uvmat
    17341734            sparam.Civ2Bin=fullfile(path_UVMAT,sparam.Civ2Bin);
    17351735            if ~exist(sparam.Civ2Bin,'file')
    1736                  msgbox_uvmat('ERROR',['civ2 binary ' CivBin ' defined in PARAM.xm does not exist'])
     1736                 msgbox_uvmat('ERROR',['civ2 binary ' sparam.Civ2Bin ' defined in PARAM.xm does not exist'])
    17371737                 return
    17381738            end
     
    17401740    end
    17411741    if  isfield(sparam,'PatchBin')
    1742         if ~exist(sparam.PatchBin,'file')
     1742        if ~exist(sparam.PatchBin,'file')||~isequal(which(sparam.PatchBin),sparam.PatchBin)% if path defined as relative to uvmat
    17431743            sparam.PatchBin=fullfile(path_UVMAT,sparam.PatchBin);
    17441744        end
    17451745    end
    17461746    if isfield(sparam,'FixBin')
    1747         if ~exist(sparam.FixBin,'file')
     1747        if ~exist(sparam.FixBin,'file')||~isequal(which(sparam.FixBin),sparam.FixBin)% if path defined as relative to uvmat
    17481748            sparam.FixBin=fullfile(path_UVMAT,sparam.FixBin);
    17491749        end
     
    29802980    %     npx=npxy(2);
    29812981    if box_test(1)==1 %if civ1 is performed
    2982         h = waitbar(0,['copy images to the .png format for civ1']);% display a wait bar
     2982        h = waitbar(0,'copy images to the .png format for civ1');% display a wait bar
    29832983        for ifile=1:nbfield
    29842984            waitbar(ifile/nbfield);
     
    30273027function cmd_PATCH=PATCH_CMD(filename_nc,nx_patch,ny_patch,rho_patch,subdomain_patch,thresh_value,test_interp,PatchBin)
    30283028%------------------------------------------------------------------------
    3029 namelog=[filename_nc([1:end-3]) '_patch.log'];
     3029namelog=[filename_nc(1:end-3) '_patch.log'];
    30303030if test_interp==0
    30313031    if isunix
     
    30453045function cmd=RUN_STINTERP(stinterpBin,filename_A_nc,filename_B_nc,filename_nc,nx_patch,ny_patch,rho_patch,subdomain_patch,thresh_value,xmlA,xmlB)
    30463046%------------------------------------------------------------------------
    3047 namelog=[filename_nc([1:end-3]) '_stinterp.log'];
     3047namelog=[filename_nc(1:end-3) '_stinterp.log'];
    30483048cmd=[stinterpBin ' -f1 ' filename_A_nc  ' -f2 ' filename_B_nc ' -f  ' filename_nc ...
    30493049    ' -m ' nx_patch  ' -n ' ny_patch ' -ro ' rho_patch ' -nopt ' subdomain_patch ' -c1 ' xmlA ' -c2 ' xmlB '  -xy  x -Nfy 1024 > ' namelog ' 2>&1']; % redirect standard output to the log file
     
    36443644function enable_civ1(handles,state)
    36453645%------------------------------------------------------------------------
    3646 if isequal(state,0)
    3647     state='off';
    3648 end
    3649 if isequal(state,1)
    3650     state='on';
    3651 end
    36523646if isequal(state,'on')
    36533647    set(handles.frame_civ1,'BackgroundColor',[1 1 0])
     
    36983692set(handles.shift_title,'Visible',state)
    36993693set(handles.rho_title,'Visible',state)
     3694set(handles.TestCiv1,'Visible',state)
     3695%set(handles.CivAll,'Visible',state)
    37003696
    37013697%------------------------------------------------------------------------
     
    37313727function enable_patch1(handles)
    37323728%------------------------------------------------------------------------
    3733 global patch_newBin
    37343729set(handles.frame_patch1,'BackgroundColor',[1 1 0])
    37353730set(handles.rho_patch1,'Visible','on')
    37363731set(handles.rho_text1,'Visible','on')
    3737 set(handles.thresh_patch1,'Visible','on')
    3738 set(handles.thresh_text1,'Visible','on')
     3732if get(handles.CivAll,'Value')
     3733    set(handles.thresh_patch1,'Visible','on')
     3734    set(handles.thresh_text1,'Visible','on')
     3735end
    37393736set(handles.subdomain_patch1,'Visible','on')
    37403737set(handles.subdomain_text1,'Visible','on')
     
    37443741set(handles.ny_patch1_title,'Visible','on')
    37453742% if ~isempty(patch_newBin)
    3746 %     set(handles.test_interp,'Visible','on');
     3743set(handles.test_interp,'Visible','off');
    37473744% end
    37483745set(handles.get_gridpatch1,'Visible','on')
     
    45834580end
    45844581
    4585 
     4582%------------------------------------------------------------------------
    45864583% --- Executes on button press in TestCiv1.
    45874584function TestCiv1_Callback(hObject, eventdata, handles)
     4585%------------------------------------------------------------------------
    45884586test_civ1=get(handles.TestCiv1,'Value');
    45894587if test_civ1
    4590 [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]=...
    4591     set_civ_filenames(handles,[1 0 0 0 0 0]);
    4592 Data.ListVarName={'ny','nx','A'};
    4593 Data.VarDimName={'ny','nx',{'ny','nx'}};
    4594 Data.A=imread(filecell.ima1.civ1{1});
    4595 Data.ny=[size(Data.A,1) 1];
    4596 Data.nx=[1 size(Data.A,2)];
    4597 hh=view_field(Data);
    4598 ViewData=get(hh,'UserData');
    4599 ViewData.axes3.B=imread(filecell.ima2.civ1{1});
    4600 set(hh,'UserData',ViewData)
    4601 end
    4602 
     4588    [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]=...
     4589        set_civ_filenames(handles,[1 0 0 0 0 0]);
     4590    Data.ListVarName={'ny','nx','A'};
     4591    Data.VarDimName={'ny','nx',{'ny','nx'}};
     4592    Data.A=imread(filecell.ima1.civ1{1});
     4593    Data.ny=[size(Data.A,1) 1];
     4594    Data.nx=[1 size(Data.A,2)];
     4595    hh=view_field(Data);
     4596    ViewData=get(hh,'UserData');
     4597    ViewData.axes3.B=imread(filecell.ima2.civ1{1});%store the second image in the UserData of the GUI view_field
     4598    corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display
     4599    if isempty(corrfig)
     4600        corrfig=figure;
     4601        set(corrfig,'tag','corrfig')
     4602        set(corrfig,'name','image correlation')
     4603        set(corrfig,'DeleteFcn',{@closeview_field})%
     4604    end
     4605    set(hh,'UserData',ViewData)
     4606else
     4607    corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display
     4608    if ~isempty(corrfig)
     4609        delete(corrfig)
     4610    end
     4611    hview_field=findobj(allchild(0),'tag','view_field');% look for view_field   
     4612    if ~isempty(hview_field)
     4613        delete(hview_field)
     4614    end
     4615end
     4616
     4617function closeview_field(gcbo,eventdata)
     4618hview_field=findobj(allchild(0),'tag','view_field');% look for view_field   
     4619    if ~isempty(hview_field)
     4620        delete(hview_field)
     4621    end
    46034622%-------------------------------------------------------------------
    46044623% --- Executes on button press in status.
     
    47544773% --- Executes on button press in CivAll.
    47554774function CivAll_Callback(hObject, eventdata, handles)
    4756 % hObject    handle to CivAll (see GCBO)
    4757 % eventdata  reserved - to be defined in a future version of MATLAB
    4758 % handles    structure with handles and user data (see GUIDATA)
    4759 
    4760 % Hint: get(hObject,'Value') returns toggle state of CivAll
    4761 
    4762 
     4775if get(handles.CivAll,'Value')
     4776    if get(handles.PATCH1,'Value')
     4777        set(handles.thresh_patch1,'Visible','on')
     4778        set(handles.thresh_text1,'Visible','on')
     4779    end
     4780else
     4781    set(handles.thresh_patch1,'Visible','off')
     4782    set(handles.thresh_text1,'Visible','off')
     4783end
     4784
  • trunk/src/mouse_motion.m

    r213 r224  
    220220                        isx2=floor((str2double(par.isx)-1)/2);
    221221                        isy2=floor((str2double(par.isy)-1)/2);
     222                        shiftx=str2double(par.shiftx);
     223                        shifty=str2double(par.shifty);
    222224                        hhh=findobj(haxes,'Tag','PIV_box_marker');
    223225                        hhhh=findobj(haxes,'Tag','PIV_search_marker');
    224226                        if isempty(hhh)
    225                             %hstack=findobj(allchild(0),'Type','figure');%current stack order of figures in matlab
    226227                            set(0,'CurrentFigure',currentfig)
    227228                            set(currentfig,'CurrentAxes',haxes)
     
    230231                                'LineStyle','-','Tag','PIV_box_marker');
    231232                            rectangle('Curvature',[0 0],...
    232                                 'Position',[xround-isx2 yround-isy2 2*isx2 2*isy2],'EdgeColor','m',...
     233                                'Position',[xround-isx2+shiftx yround-isy2+shifty 2*isx2 2*isy2],'EdgeColor','m',...
    233234                                'LineStyle','- -','Tag','PIV_search_marker');
    234                             % set(0,'Children',hstack);%put back the initial figure stack after plot creation
    235235                        else
    236236%                             set(hhh,'Visible','on')
    237237                            set(hhh,'Position',[xround-ibx2 yround-iby2 2*ibx2 2*iby2])
    238                             set(hhhh,'Position',[xround-isx2 yround-isy2 2*isx2 2*isy2])
    239                         end
    240                         Asub=Field.A(xround-ibx2:xround+ibx2,yround-iby2:yround+iby2);
    241                         Asub=reshape(Asub,[],1);
    242                         rangx(1)=-(isx2-ibx2);
    243                         rangx(2)=isx2-ibx2;
    244                         rangy(1)=isy2-iby2;
    245                         rangy(2)=-(isy2-iby2);
     238                            set(hhhh,'Position',[xround-isx2+shiftx yround-isy2+shifty 2*isx2 2*isy2])
     239                        end
     240                        Asub=Field.A(yround-iby2:yround+iby2,xround-ibx2:xround+ibx2);%first sub-image
     241                        Asub=reshape(Asub,[],1);%first sub-image reshaped as matlab vector
     242                        rangx(1)=-(isx2-ibx2)+shiftx;
     243                        rangx(2)=isx2-ibx2+shiftx
     244                        rangy(1)=-(isy2-iby2)-shifty;
     245                        rangy(2)=(isy2-iby2)-shifty
     246                        correl=zeros(rangy(2)-rangy(1)+1,rangx(2)-rangx(1)+1);
    246247                        for id=rangx(1):rangx(2)
    247                             for jd=rangy(2):rangy(1)
    248                                 Bsub=Field.B(xround-ibx2+id:xround+ibx2+id,yround-iby2+jd:yround+iby2+jd);
     248                            for jd=rangy(1):rangy(2)
     249                                Bsub=Field.B(yround-iby2+jd:yround+iby2+jd,xround-ibx2+id:xround+ibx2+id);
    249250                                Bsub=reshape(Bsub,[],1);
    250                                 correl(jd-rangy(2)+1,id-rangx(1)+1)=corr(double(Asub),double(Bsub));
     251                                correl(jd-rangy(1)+1,id-rangx(1)+1)=corr(double(Asub),double(Bsub));
    251252                            end
    252253                        end
     
    261262                        if isempty(hcorr)
    262263                            corrfig=findobj(allchild(0),'tag','corrfig');
    263                             if isempty(corrfig)
    264                                 corrfig=figure;
    265                                 set(corrfig,'tag','corrfig')
    266                             end
    267                             set(0,'CurrentFigure',corrfig)
    268                             AxeData.CurrentCorrImage=imagesc(rangx,rangy,correl,[0 1]);
    269                             colorbar
    270 %                             map_r=ones(42,1)*[1 0 0];
    271 %                             map_g=ones(11,1)*[0 1 0];
    272 %                             map_b=ones(11,1)*[0 0 1];
    273 %                             map=[map_r;map_g;map_b];
    274 %                             set(corrfig,'colormap',map)
    275                             set(haxes,'UserData',AxeData)
     264                            if ~isempty(corrfig)
     265                                set(0,'CurrentFigure',corrfig(1))
     266                                AxeData.CurrentCorrImage=imagesc(rangx,-rangy,correl,[0 1]);
     267                                colorbar
     268                                set(haxes,'UserData',AxeData)
     269                                set(get(AxeData.CurrentCorrImage,'parent'),'YDir','normal')
     270                            end
    276271                        else
    277272                            set(AxeData.CurrentCorrImage,'CData',correl)
     273                            set(AxeData.CurrentCorrImage,'XData',rangx)
     274                            set(AxeData.CurrentCorrImage,'YData',-rangy)
    278275                        end       
    279276                    end
Note: See TracChangeset for help on using the changeset viewer.