Changeset 1155 for trunk


Ignore:
Timestamp:
Jul 8, 2024, 9:45:18 AM (3 months ago)
Author:
sommeria
Message:

civ2vel_3C updated

Location:
trunk/src/series
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series/civ2vel_3C.m

    r1144 r1155  
    437437    mfy=(XmlData{1}.GeometryCalib.fx_fy(2)+XmlData{2}.GeometryCalib.fx_fy(2))/2;
    438438    MergeData.Error=0.25*(mfx+mfy)*sqrt(sum(Error.^2,3));
     439    MergeData.U(MergeData.Error>1)=NaN;%suppress vectors which are not with reasonable error range estimated as 1 pixel
     440    MergeData.V(MergeData.Error>1)=NaN;
     441    MergeData.W(MergeData.Error>1)=NaN;
    439442    errormsg=struct2nc(OutputFile,MergeData);%save result file
    440443    if isempty(errormsg)
  • trunk/src/series/civ_input.m

    r1154 r1155  
    110110        ind_opening=SeriesData.FileInfo{1}.CivStage;
    111111        if isempty(regexp(NomTypeInput,'[ab|AB|-]', 'once'))
    112             set(handles.ListCompareMode,'Value',2) %mode displacement advised if the nomencalture does not involve index pairs
     112            set(handles.ListCompareMode,'Value',2) %mode displacement advised if the nomenclature does not involve index pairs
    113113        else
    114114            set(handles.ListCompareMode,'Value',1)
    115115        end
    116         [Data,tild,tild,errormsg]=nc2struct(SeriesData.FileInfo{1}.FileName,[]);
     116        [Data,~,~,errormsg]=nc2struct(SeriesData.FileInfo{1}.FileName,[]);
    117117        if ~isempty(errormsg)
    118118            msgbox_uvmat('ERROR',['error in netcdf input file: ' errormsg])
     
    120120        end
    121121        if isfield(Data,'.Civ1_ImageA')
    122         [PathCiv1_ImageA,Civ1_ImageA,FileExtA]=fileparts(Data.Civ1_ImageA);%look for the source image A
    123         [PathCiv1_ImageB,Civ1_ImageB,FileExtA]=fileparts(Data.Civ1_ImageB);%look for the source image B
     122        %[PathCiv1_ImageA,Civ1_ImageA,FileExtA]=fileparts(Data.Civ1_ImageA);%look for the source image A
     123        %[PathCiv1_ImageB,Civ1_ImageB,FileExtA]=fileparts(Data.Civ1_ImageB);%look for the source image B
    124124        end
    125125        if isfield(Data,'Civ2_ImageA')
    126             [PathCiv2_ImageA,Civ2_ImageA,FileExtA]=fileparts(Data.Civ2_ImageA);
    127             [PathCiv2_ImageB,Civ2_ImageB,FileExtA]=fileparts(Data.Civ2_ImageB);
     126            %[PathCiv2_ImageA,Civ2_ImageA,FileExtA]=fileparts(Data.Civ2_ImageA);
     127            %[PathCiv2_ImageB,Civ2_ImageB,FileExtA]=fileparts(Data.Civ2_ImageB);
    128128        end
    129129        if size(Param.InputTable,1)==1
    130130             if isfield(Data,'.Civ1_ImageA')
    131131            series('display_file_name',hhseries,Data.Civ1_ImageA,'append');%append the image series to the input list
    132                     [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomTypeImaA]=fileparts_uvmat(Data.Civ1_ImageA);
    133         [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomTypeImaB]=fileparts_uvmat(Data.Civ1_ImageB);
     132                    [~,~,~,~,~,~,~,~,NomTypeImaA]=fileparts_uvmat(Data.Civ1_ImageA);
     133       % [~,~,~,~,~,~,~,~,NomTypeImaB]=fileparts_uvmat(Data.Civ1_ImageB);
    134134             else
    135135                 series('display_file_name',hhseries,Data.Civ2_ImageA,'append');%append the image series to the input list
    136                          [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomTypeImaA]=fileparts_uvmat(Data.Civ2_ImageA);
    137         [RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomTypeImaB]=fileparts_uvmat(Data.Civ2_ImageB);
     136                         [~,~,~,~,~,~,~,~,NomTypeImaA]=fileparts_uvmat(Data.Civ2_ImageA);
     137        %[RootPath,SubDir,RootFile,i1,i2,j1,j2,FileExt,NomTypeImaB]=fileparts_uvmat(Data.Civ2_ImageB);
    138138             end
    139139        end
     
    16291629% --------------------------------------------------------------------
    16301630function TestPatch1_Callback(hObject, eventdata, handles)
    1631 msgbox_uvmat('WARNING','open the civ file and run "series/test_patch_tps" ')
    1632 
    1633 % if get(handles.TestPatch1,'Value')% if TestPatch1 is activated
    1634 %     hseries=findobj(allchild(0),'Tag','series');
    1635 %     Param=read_GUI(hseries);
    1636 %     CivDir=fullfile(Param.OutputPath,Param.Experiment,Param.Device,[Param.OutputSubDir Param.OutputDirExt]);
    1637 %     % ListXml=dir(CivXmlDir);
    1638 %     if exist(CivDir,'dir')
    1639 %         CivFile=uigetfile_uvmat('pick .nc file with civ1-fix1 data',CivDir,'.nc');
    1640 %         [Field,VelTypeOut,errormsg]=read_civdata(CivFile)
    1641 %         for ilist=1:numel(Field.ListGlobalAttribute)
    1642 %             r=regexp(Field.ListGlobalAttribute{ilist},'Civ1_(?<field>.+)','names');% \D = not a digit, \d =digi
    1643 %             if ~isempty(r)
    1644 %                 ParamTest.Civ1.(r.field)=(Field.(['Civ1_' r.field]));
    1645 %             end
    1646 %             r=regexp(Field.ListGlobalAttribute{ilist},'Fix1_(?<field>.+)','names');% \D = not a digit, \d =digi
    1647 %             if ~isempty(r)
    1648 %                 ParamTest.Fix1.(r.field)=(Field.(['Fix1_' r.field]));
    1649 %             end
    1650 %         end
    1651 %         fill_GUI(ParamTest,handles.civ_input)% fill the elements of the GUI series with the input parameters
    1652 %         drawnow
    1653 %         update_CivOptions(handles,0)
    1654 %
    1655 %         set(handles.TestPatch1,'BackgroundColor',[1 1 0])%paint TestPatch1 button in yellow to indicate activation
    1656 % %         set(handles.Civ1,'BackgroundColor',[1 1 0])% indicate civ1 calculation is performed
    1657 %         Param.Action.RUN=1;
    1658 %          Param.ActionInput=read_GUI(handles.civ_input);
    1659 %          Param.ActionInput.CheckCiv1=0;% do not repeat Civ1 computation       
    1660 %         if isfield(Param.ActionInput,'Civ2')%remove options that may be selected beyond Patch1
    1661 %             Param.ActionInput=rmfield(Param.ActionInput,'Civ2');
    1662 %         end
    1663 %         if isfield(Param.ActionInput,'Fix2')
    1664 %             Param.ActionInput=rmfield(Param.ActionInput,'Fix2');
    1665 %         end
    1666 %         if isfield(Param.ActionInput,'Patch2')
    1667 %             Param.ActionInput=rmfield(Param.ActionInput,'Patch2');
    1668 %         end
    1669 %         if isfield(Param,'OutputSubDir')
    1670 %             Param=rmfield(Param,'OutputSubDir'); %remove output file option from civ_series
    1671 %         end
    1672 %         ParamPatch1=Param.ActionInput.Patch1; %store the patch1 parameters
    1673 %         Param.ActionInput=rmfield(Param.ActionInput,'Patch1');% does not execute Patch
    1674 %         Param.IndexRange.first_i=str2num(get(handles.ref_i,'String'));
    1675 %         Param.IndexRange.last_i=Param.IndexRange.first_i;
    1676 %         if strcmp(get(handles.ref_j,'Visible'),'on')
    1677 %             Param.IndexRange.first_j=str2num(get(handles.ref_j,'String'));
    1678 %             Param.IndexRange.last_j=Param.IndexRange.first_j;
    1679 %         else
    1680 %             Param.IndexRange.first_j=1;
    1681 %             Param.IndexRange.last_j=1;
    1682 %         end
    1683 %         [Data,errormsg]=civ_series(Param);% get the civ1+fix1 results
    1684 %         bckcolor=get(handles.civ_input,'Color');
    1685 %         set(handles.Civ1,'BackgroundColor',bckcolor)% indicate civ1 calculation is finished
    1686 %
    1687 %         %% prepare Param for iterative Patch processing without input file reading
    1688 %         Param.Civ1_X=Data.Civ1_X;
    1689 %         Param.Civ1_Y=Data.Civ1_Y;
    1690 %         Param.Civ1_U=Data.Civ1_U;
    1691 %         Param.Civ1_V=Data.Civ1_V;
    1692 %         Param.Civ1_FF=Data.Civ1_FF;
    1693 %         Param=rmfield(Param,'InputTable');%desactivate input file reading
    1694 %         if isfield(Param.ActionInput,'Civ1')
    1695 %             Param.ActionInput=rmfield(Param.ActionInput,'Civ1');%desactivate civ1: remove civ1 input param if relevant
    1696 %         end
    1697 %         if isfield(Param.ActionInput,'Fix1')
    1698 %             Param.ActionInput=rmfield(Param.ActionInput,'Fix1');%desactivate fix1:remove fix1 input param if relevant
    1699 %         end
    1700 %         SmoothingParam=(ParamPatch1.FieldSmooth/10)*2.^(1:7);%scan the smoothing param from 1/10 to 12.8 current value
    1701 %         NbGood=numel(find(Data.Civ1_FF==0));
    1702 %         NbExclude=zeros(1,7);% initialize the set of smoothing parameters
    1703 %         DiffVel=zeros(1,7);% initialize the rms difference between patch and civ
    1704 %         Param.ActionInput.Patch1=ParamPatch1;% retrieve Patch1 parameters
    1705 %         for irho=1:7
    1706 %             Param.ActionInput.Patch1.FieldSmooth=SmoothingParam(irho);
    1707 %             [Data,errormsg]= civ_series(Param);%apply the processing fct
    1708 %             if ~isempty(errormsg)
    1709 %                 msgbox_uvmat('ERROR',errormsg)
    1710 %                 return
    1711 %             end
    1712 %             ind_good=find(Data.Civ1_FF==0);
    1713 %             Civ1_U_Diff=Data.Civ1_U(ind_good)-Data.Civ1_U_smooth(ind_good);
    1714 %             Civ1_V_Diff=Data.Civ1_V(ind_good)-Data.Civ1_V_smooth(ind_good);
    1715 %             DiffVel(irho)=sqrt(mean(Civ1_U_Diff.*Civ1_U_Diff+Civ1_V_Diff.*Civ1_V_Diff));
    1716 %             NbExclude(irho)=(NbGood-numel(ind_good))/NbGood;
    1717 %         end
    1718 %         figure(1)
    1719 %         semilogx(SmoothingParam,DiffVel,'b',SmoothingParam,NbExclude,'r',SmoothingParam,0.2*ones(size(SmoothingParam)),'m')
    1720 %         grid on
    1721 %         legend('rms velocity diff. Patch1-Civ1 (pixels)','proportion of excluded vectors (between 0 to 1)','recommended diff Patch1-Civ1')
    1722 %         xlabel('smoothing parameter')
    1723 %         ylabel('smoothing effect')
    1724 %         set(handles.TestPatch1,'BackgroundColor',[0 1 0])
    1725 %     else
    1726 %         corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display
    1727 %         if ~isempty(corrfig)
    1728 %             delete(corrfig)
    1729 %         end
    1730 %         hview_field=findobj(allchild(0),'tag','view_field');% look for view_field
    1731 %         if ~isempty(hview_field)
    1732 %             delete(hview_field)
    1733 %         end
    1734 %     end
    1735 % else
    1736 %     msgbox_uvmat('ERROR','no output file: first perform a civ1-fix1 computation')
    1737 %     return
    1738 % end
    1739  
    1740 %------------------------------------------------------------------------
    1741 % --- Executes on button press in TestCiv2.
    1742 %------------------------------------------------------------------------
    1743 function TestCiv2_Callback(hObject, eventdata, handles)
    1744 drawnow
    1745 if get(handles.TestCiv2,'Value')
    1746     set(handles.TestCiv2,'BackgroundColor',[1 1 0])% paint TestCiv1 button to yellow to confirm civ launch
    1747     set(handles.CheckFix2,'value',0)% desactivate next step
    1748     set(handles.CheckPatch2,'value',0)% desactivate next step
    1749     update_CivOptions(handles,0)
    1750       hseries=findobj(allchild(0),'Tag','series');
    1751      Param=read_GUI(hseries);
    1752      Param.Action.RUN=1;
    1753      Param.ActionInput=read_GUI(handles.civ_input);
    1754      if isfield(Param,'OutputSubDir')
    1755      Param=rmfield(Param,'OutputSubDir'); %remove output file option from civ_series
    1756      end
    1757      Param.ActionInput.Civ2.CorrSmooth=0;% launch Civ2 with no data point (to get the image names for A and B)
    1758      set(handles.Civ1,'BackgroundColor',[1 1 0])
    1759      set(handles.Fix1,'BackgroundColor',[1 1 0])
    1760      set(handles.Patch1,'BackgroundColor',[1 1 0])
    1761      Param.IndexRange.first_i=str2num(get(handles.ref_i,'String'));
    1762      Param.IndexRange.last_i=Param.IndexRange.first_i;
    1763      if strcmp(get(handles.ref_j,'Visible'),'on')
    1764          Param.IndexRange.first_j=str2num(get(handles.ref_j,'String'));
    1765          Param.IndexRange.last_j=Param.IndexRange.first_j;
    1766      else
    1767          Param.IndexRange.first_j=1;
    1768          Param.IndexRange.last_j=1;
    1769      end
    1770      [Data,errormsg]=civ_series(Param);% get the civ1+fix1 results
    1771      
    1772      %% create image data ImageData for display
    1773      ImageData.ListVarName={'ny','nx','A'};
    1774      ImageData.VarDimName= {'ny','nx',{'ny','nx'}};
    1775      ImageData.A=imread(Data.Civ2_ImageA); % read the first image
    1776      if ndims(ImageData.A)==3 %case of color image
    1777          ImageData.VarDimName= {'ny','nx',{'ny','nx','rgb'}};
    1778      end
    1779      ImageData.ny=[size(ImageData.A,1) 1];
    1780      ImageData.nx=[1 size(ImageData.A,2)];
    1781      ImageData.CoordUnit='pixel';% used to set equal scaling for x and y in image dispa=ly
    1782 
    1783      %% create the figure view_field for image visualization
    1784     hview_field=view_field(ImageData); %view the image in the GUI view_field
    1785     set(0,'CurrentFigure',hview_field)
    1786     % plot the boundaries of the subdomains used for patch
    1787     for isub=1:size(Data.Civ1_SubRange,3);
    1788         pos_x=Data.Civ1_SubRange(1,1,isub);
    1789         pos_y=Data.Civ1_SubRange(2,1,isub);
    1790         width=Data.Civ1_SubRange(1,2,isub)-Data.Civ1_SubRange(1,1,isub);
    1791         height=Data.Civ1_SubRange(2,2,isub)-Data.Civ1_SubRange(2,1,isub);
    1792         rectangle('Position',[pos_x pos_y width height],'EdgeColor',[0 0 1])
    1793     end
    1794     hhview_field=guihandles(hview_field);%
    1795     set(hview_field,'CurrentAxes',hhview_field.PlotAxes)
    1796     ViewData=get(hview_field,'UserData'); % get the currently plotted field (the image A)
    1797     % store info in the UserData of view-field
    1798     ViewData.CivHandle=handles.civ_input;% indicate the handle of the civ GUI in view_field
    1799     ViewData.PlotAxes.B=imread(Data.Civ2_ImageB);%store the second image in the UserData of the GUI view_field
    1800     ViewData.PlotAxes.X=Data.Civ2_X';
    1801     ViewData.PlotAxes.Y=Data.Civ2_Y';
    1802     ViewData.PlotAxes.ShiftX=Data.Civ2_U';% shift at each point (from patch1) estimated by the preliminary run of civ2
    1803     ViewData.PlotAxes.ShiftY=Data.Civ2_V';
    1804     ViewData.PlotAxes.Civ1_SubRange=Data.Civ1_SubRange;
    1805     ViewData.PlotAxes.Civ1_NbCentres=Data.Civ1_NbCentres;
    1806     ViewData.PlotAxes.Civ1_Coord_tps=Data.Civ1_Coord_tps;
    1807     ViewData.PlotAxes.Civ1_U_tps=Data.Civ1_U_tps;
    1808     ViewData.PlotAxes.Civ1_V_tps=Data.Civ1_V_tps;
    1809     ViewData.PlotAxes.Civ1_Dt=Data.Civ1_Dt;
    1810     ViewData.PlotAxes.Civ2_Dt=Data.Civ2_Dt;
    1811     set(hview_field,'UserData',ViewData)% store the info in the UserData of image view_field
    1812     bckcolor=get(handles.civ_input,'Color');
    1813     set(handles.Civ1,'BackgroundColor',bckcolor)% indicate civ1 calmculation is finished
    1814     set(handles.Fix1,'BackgroundColor',bckcolor)
    1815     set(handles.Patch1,'BackgroundColor',bckcolor)
    1816     drawnow
    1817    
    1818     %% look for a current figure for image correlation display
    1819     corrfig=findobj(allchild(0),'tag','corrfig');
    1820     if isempty(corrfig)
    1821         corrfig=figure;
    1822         set(corrfig,'tag','corrfig')
    1823         set(corrfig,'name','image correlation')
    1824         set(corrfig,'DeleteFcn',{@closeview_field})%
    1825         set(handles.TestCiv1,'BackgroundColor',[1 0 0])
    1826     else
    1827         set(handles.TestCiv1,'BackgroundColor',[1 0 0])% paint button to red
    1828         corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display
    1829         if ~isempty(corrfig)
    1830             delete(corrfig)
    1831         end
    1832         hview_field=findobj(allchild(0),'tag','view_field');% look for view_field
    1833         if ~isempty(hview_field)
    1834             delete(hview_field)
    1835         end
    1836     end   
    1837 else
    1838     hview_field=findobj(allchild(0),'Tag','view_field'); %view the image in the GUI view_field
    1839     if ~isempty(hview_field)
    1840         delete(hview_field)
    1841     end     
    1842 end
    1843 
    1844 
    1845 % --- Executes on button press in TestPatch2.
    1846 function TestPatch2_Callback(hObject, eventdata, handles)
    1847 if get(handles.TestPatch2,'Value')% if TestPatch2 is activated
    1848     msgbox_uvmat('WARNING','open the civ file and run "series/test_patch_tps" ')
    1849 end
    1850 %      set(handles.TestPatch2,'BackgroundColor',[1 1 0])%paint TestPatch2 button in yellow to indicate activation
    1851 %      set(handles.Civ1,'BackgroundColor',[1 1 0])% indicate civ1 calculation is activated
    1852 %      set(handles.Fix1,'BackgroundColor',[1 1 0])% indicate fix1 calculation is activated
    1853 %      set(handles.Patch1,'BackgroundColor',[1 1 0])% indicate Patch1 calculation is activated
    1854 %      set(handles.Civ2,'BackgroundColor',[1 1 0])% indicate civ2 calculation is activated
    1855 %      set(handles.Fix2,'BackgroundColor',[1 1 0])% indicate fix2 calculation is activated
    1856 %      hseries=findobj(allchild(0),'Tag','series');
    1857 %      Param=read_GUI(hseries);
    1858 %      Param.Action.RUN=1;
    1859 %      Param.ActionInput=read_GUI(handles.civ_input);
    1860 %      if isfield(Param,'OutputSubDir')
    1861 %      Param=rmfield(Param,'OutputSubDir'); %remove output file option from civ_series
    1862 %      end
    1863 %      ParamPatch2=Param.ActionInput.Patch2; %store the patch1 parameters
    1864 %      Param.ActionInput=rmfield(Param.ActionInput,'Patch2');% does not execute Patch
    1865 %      Param.IndexRange.first_i=str2num(get(handles.ref_i,'String'));
    1866 %      Param.IndexRange.last_i=Param.IndexRange.first_i;
    1867 %      if strcmp(get(handles.ref_j,'Visible'),'on')
    1868 %          Param.IndexRange.first_j=str2num(get(handles.ref_j,'String'));
    1869 %          Param.IndexRange.last_j=Param.IndexRange.first_j;
    1870 %      else
    1871 %          Param.IndexRange.first_j=1;
    1872 %          Param.IndexRange.last_j=1;
    1873 %      end
    1874 %      [Data,errormsg]=civ_series(Param);% get the civ1+fix1 results
    1875 %      bckcolor=get(handles.civ_input,'Color');
    1876 %      set(handles.Civ1,'BackgroundColor',bckcolor)% indicate civ1 calculation is finished
    1877 %      set(handles.Fix1,'BackgroundColor',bckcolor)% indicate fix1 calculation is finished
    1878 %      set(handles.Patch1,'BackgroundColor',bckcolor)% indicate Patch1 calculation is finished
    1879 %      set(handles.Civ2,'BackgroundColor',bckcolor)% indicate civ2 calculation is finished
    1880 %      set(handles.Fix2,'BackgroundColor',bckcolor)% indicate fix2 calculation is finished
    1881 %
    1882 %      %% prepare Param for iterative Patch processing without input file reading
    1883 %      Param.Civ2_X=Data.Civ2_X;
    1884 %      Param.Civ2_Y=Data.Civ2_Y;
    1885 %      Param.Civ2_U=Data.Civ2_U;
    1886 %      Param.Civ2_V=Data.Civ2_V;
    1887 %      Param.Civ2_FF=Data.Civ2_FF;
    1888 %      Param=rmfield(Param,'InputTable');%desactivate input file reading
    1889 %     if isfield(Param.ActionInput,'Civ1')
    1890 %         Param.ActionInput=rmfield(Param.ActionInput,'Civ1');%desactivate civ1: remove civ1 input param if relevant
    1891 %     end
    1892 %     if isfield(Param.ActionInput,'Fix1')
    1893 %         Param.ActionInput=rmfield(Param.ActionInput,'Fix1');%desactivate fix1:remove fix1 input param if relevant
    1894 %     end
    1895 %     if isfield(Param.ActionInput,'Patch1')
    1896 %         Param.ActionInput=rmfield(Param.ActionInput,'Patch1');%desactivate fix1:remove fix1 input param if relevant
    1897 %     end
    1898 %     if isfield(Param.ActionInput,'Civ2')
    1899 %         Param.ActionInput=rmfield(Param.ActionInput,'Civ2');%desactivate civ2: remove civ2 input param if relevant
    1900 %     end
    1901 %     if isfield(Param.ActionInput,'Fix2')
    1902 %         Param.ActionInput=rmfield(Param.ActionInput,'Fix2');%desactivate fix1:remove fix1 input param if relevant
    1903 %     end
    1904 %     SmoothingParam=(ParamPatch2.FieldSmooth/10)*2.^(1:7);%scan the smoothing param from 1/10 to 12.8 current value
    1905 %     NbGood=numel(find(Data.Civ2_FF==0));
    1906 %     NbExclude=zeros(1,7);% initialize the set of smoothing parameters
    1907 %     DiffVel=zeros(1,7);% initialize the rms difference between patch and civ
    1908 %     Param.ActionInput.Patch2=ParamPatch2;% retrieve Patch2 parameters
    1909 %     for irho=1:7
    1910 %         Param.ActionInput.Patch2.FieldSmooth=SmoothingParam(irho);
    1911 %         [Data,errormsg]= civ_series(Param);%apply the processing fct
    1912 %         if ~isempty(errormsg)
    1913 %             msgbox_uvmat('ERROR',errormsg)
    1914 %             return
    1915 %         end
    1916 %         ind_good=find(Data.Civ2_FF==0);
    1917 %         Civ2_U_Diff=Data.Civ2_U(ind_good)-Data.Civ2_U_smooth(ind_good);
    1918 %         Civ2_V_Diff=Data.Civ2_V(ind_good)-Data.Civ2_V_smooth(ind_good);
    1919 %         DiffVel(irho)=sqrt(mean(Civ2_U_Diff.*Civ2_U_Diff+Civ2_V_Diff.*Civ2_V_Diff));
    1920 %         NbExclude(irho)=(NbGood-numel(ind_good))/NbGood;
    1921 %     end
    1922 %     figure(1)
    1923 %     semilogx(SmoothingParam,DiffVel,'b',SmoothingParam,NbExclude,'r',SmoothingParam,0.1*ones(size(SmoothingParam)),'m')
    1924 %     grid on
    1925 %     legend('rms velocity diff. Patch2-Civ2 (pixels)','proportion of excluded vectors (between 0 to 1)','recommended value diff. Patch2-Civ2')
    1926 %     xlabel('smoothing parameter')
    1927 %     ylabel('smoothing effect')
    1928 %     set(handles.TestPatch2,'BackgroundColor',[0 1 0])
    1929 % else
    1930 %     corrfig=findobj(allchild(0),'tag','corrfig');% look for a current figure for image correlation display
    1931 %     if ~isempty(corrfig)
    1932 %         delete(corrfig)
    1933 %     end
    1934 %     hview_field=findobj(allchild(0),'tag','view_field');% look for view_field
    1935 %     if ~isempty(hview_field)
    1936 %         delete(hview_field)
    1937 %     end
    1938 % end
    1939 %
     1631msgbox_uvmat('WARNING','open the civ file and run "series/test_filter_tps" ')
     1632
    19401633
    19411634%'nomtype2pair': creates nomenclature for index pairs knowing the image nomenclature
  • trunk/src/series/civ_series.m

    r1154 r1155  
    364364                if strcmp(FileExt_A,'.nc')% case of input images in format netcdf
    365365                    FieldName_A=Param.InputFields.FieldName;
    366                     [DataIn,tild,tild,errormsg]=nc2struct(ImageName_A,{FieldName_A});
     366                    [DataIn,~,~,errormsg]=nc2struct(ImageName_A,{FieldName_A});
    367367                    par_civ1.ImageA=DataIn.(FieldName_A);
    368368                else % usual image formats for image A
     
    370370                        [FileInfo_A,VideoObject_A]=get_file_info(ImageName_A);
    371371                        FileType_A=FileInfo_A.FileType;
    372                         if isempty(Time) && ~isempty(find(strcmp(FileType_A,{'mmreader','video','cine_phantom'})))% case of video input
     372                        if isempty(Time) && ~isempty(find(strcmp(FileType_A,{'mmreader','video','cine_phantom'}), 1))% case of video input
    373373                            Time=zeros(FileInfo_A.NumberOfFrames+1,2);
    374374                            Time(:,2)=(0:1/FileInfo_A.FrameRate:(FileInfo_A.NumberOfFrames)/FileInfo_A.FrameRate)';
     
    383383                        end
    384384                    end
    385                     if isempty(regexp(ImageName_A,'(^http://)|(^https://)')) && ~exist(ImageName_A,'file')
     385                    if isempty(regexp(ImageName_A,'(^http://)|(^https://)', 'once')) && ~exist(ImageName_A,'file')
    386386                        disp([ImageName_A ' missing'])
    387387                        continue
     
    394394                if strcmp(FileExt_B,'.nc') % case of input images in format netcdf
    395395                    FieldName_B=Param.InputFields.FieldName;
    396                     [DataIn,tild,tild,errormsg]=nc2struct(ImageName_B,{FieldName_B});
     396                    [DataIn,~,~,errormsg]=nc2struct(ImageName_B,{FieldName_B});
    397397                    par_civ1.ImageB=DataIn.(FieldName_B);
    398398                else % usual image formats for image B
     
    401401                        FileType_B=FileInfo_B.FileType;
    402402                    end
    403                     if isempty(regexp(ImageName_B,'(^http://)|(^https://)')) && ~exist(ImageName_B,'file')
     403                    if isempty(regexp(ImageName_B,'(^http://)|(^https://)', 'once')) && ~exist(ImageName_B,'file')
    404404                        disp([ImageName_B ' missing'])
    405405                        continue
     
    462462        if par_civ1.CheckMask&&~isempty(par_civ1.Mask)
    463463            if isfield(par_civ1,'NbSlice')
    464                 [RootPath_mask,SubDir_mask,RootFile_mask,i1_mask,i2_mask,j1_mask,j2_mask,Ext_mask]=fileparts_uvmat(Param.ActionInput.Civ1.Mask);
     464                [RootPath_mask,SubDir_mask,RootFile_mask,~,~,~,~,Ext_mask]=fileparts_uvmat(Param.ActionInput.Civ1.Mask);
    465465                i1_mask=mod(i1-1,par_civ1.NbSlice)+1;
    466466                maskname=fullfile_uvmat(RootPath_mask,SubDir_mask,RootFile_mask,Ext_mask,'_1',i1_mask);
     
    471471                par_civ1.Mask=mask; %use mask already opened
    472472            else
    473                 if ~isempty(regexp(maskname,'(^http://)|(^https://)'))|| exist(maskname,'file')
     473                if ~isempty(regexp(maskname,'(^http://)|(^https://)', 'once'))|| exist(maskname,'file')
    474474                    try
    475475                        par_civ1.Mask=imread(maskname);%update the mask, an store it for future use
     
    606606        Data.Civ1_U_smooth(ind_good)=Ures;% take the interpolated (smoothed) velocity values for good vectors, keep civ1 data for the other
    607607        Data.Civ1_V_smooth(ind_good)=Vres;
    608         Data.Civ1_FF(ind_good)=uint8(4*FFres);
     608        Data.Civ1_FF(ind_good)=uint8(4*FFres);%set FF to value =4 for vectors eliminated by filter_tps
    609609        time_patch1=toc(tstart_patch1);
    610610        disp('patch1 performed')
     
    721721            end
    722722        end
    723         if par_civ2.CheckMask&&~isempty(par_civ2.Mask)       
     723        i1=i1_series_Civ2(ifield);
     724        i2=i1;
     725        if ~isempty(i2_series_Civ2)
     726            i2=i2_series_Civ1(ifield);
     727        end
     728        j1=1;
     729        if ~isempty(j1_series_Civ2)
     730            j1=j1_series_Civ1(ifield);
     731        end
     732        j2=j1;
     733        if ~isempty(j2_series_Civ2)
     734            j2=j2_series_Civ2(ifield);
     735        end
     736        if par_civ2.CheckMask&&~isempty(par_civ2.Mask)
    724737            if isfield(par_civ2,'NbSlice')
    725                 [RootPath_mask,SubDir_mask,RootFile_mask,i1_mask,i2_mask,j1_mask,j2_mask,Ext_mask]=fileparts_uvmat(Param.ActionInput.Civ2.Mask);
     738                [RootPath_mask,SubDir_mask,RootFile_mask,~,~,~,~,Ext_mask]=fileparts_uvmat(Param.ActionInput.Civ2.Mask);
    726739                i1_mask=mod(i1-1,par_civ2.NbSlice)+1;
    727740                maskname=fullfile_uvmat(RootPath_mask,SubDir_mask,RootFile_mask,Ext_mask,'_1',i1_mask);
     
    894907        time_total=toc(tstart);
    895908        disp(['ellapsed time ' num2str(time_total/60,2) ' minutes'])
    896         if exist('time_input','var')
    897             disp(['time image reading ' num2str(time_input,2) ' s'])
    898         end
    899909        disp(['time civ1 ' num2str(time_civ1,2) ' s'])
    900910        disp(['time patch1 ' num2str(time_patch1,2) ' s'])
    901911        disp(['time civ2 ' num2str(time_civ2,2) ' s'])
    902912        disp(['time patch2 ' num2str(time_patch2,2) ' s'])
    903         disp(['time other ' num2str((time_total-time_input-time_civ1-time_patch1-time_civ2-time_patch2),2) ' s'])
     913        if exist('time_input','var')
     914            disp(['time image reading ' num2str(time_input,2) ' s'])
     915            disp(['time other ' num2str((time_total-time_input-time_civ1-time_patch1-time_civ2-time_patch2),2) ' s'])
     916        end
    904917    end
    905918end
  • trunk/src/series/test_filter_tps.m

    r1154 r1155  
    107107                CivStage='civ2';
    108108                MaxDiff=1.5; SubDomainSize=250; FieldSmooth=5; %default
    109             case 6
     109            otherwise
    110110                CivStage='civ2';
    111111                 MaxDiff=Data.Patch2_MaxDiff;
Note: See TracChangeset for help on using the changeset viewer.