Changeset 675 for trunk/src/uvmat.m
- Timestamp:
- Aug 27, 2013, 11:25:21 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r674 r675 587 587 %------------------------------------------------------------------------ 588 588 %refresh the menu of input fieldname 589 Field s_Callback(hObject, eventdata, handles);589 FieldName_Callback(hObject, eventdata, handles); 590 590 % refresh the current field view 591 591 run0_Callback(hObject, eventdata, handles); … … 874 874 ColorType='falsecolor'; %default 875 875 UvData.MovieObject{index}=VideoObject; 876 if ~isempty(VideoObject) 876 if ~isempty(VideoObject)% case of video data 877 877 imainfo=get(VideoObject); 878 878 TimeUnit='s'; … … 883 883 XmlData.Time=[0;ones(size(i1_series,3)-1,1)]*(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate); 884 884 end 885 set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec885 %set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec 886 886 TimeName='video'; 887 887 ColorType='truecolor'; … … 963 963 (strcmp(FileType,'image')|| strcmp(FileType,'multimage')||strcmp(FileType,'civdata')||strcmp(FileType,'civx')) 964 964 TimeName='xml'; 965 elseif strcmp(FileType,'civdata') 966 TimeName='civdata'; 967 elseif strcmp(FileType,'civx') 968 TimeName='civx'; 965 969 end 966 970 if index==1 … … 1041 1045 1042 1046 %% update the data attached to the uvmat interface 1043 UvData.TimeUnit=TimeUnit; 1047 if ~isempty(TimeUnit) 1048 if index==2 && isfield(UvData,'TimeUnit') && ~strcmp(UvData.TimeUnit,TimeUnit) 1049 msgbox_uvmat('WARNING',['time unit for second file series ' TimeUnit ' inconsistent with first series']) 1050 else 1051 UvData.TimeUnit=TimeUnit; 1052 end 1053 end 1044 1054 UvData.XmlData{index}=XmlData; 1045 1055 UvData.NewSeries=1; … … 1194 1204 %------------------------------------------------------------------------ 1195 1205 %--- update the index display after action on edit boxes i1, i2, j1 or j2 1206 %------------------------------------------------------------------------ 1196 1207 function update_ij(handles,index_rank) 1208 1197 1209 NomType=get(handles.NomType,'String'); 1198 1210 indices=get(handles.FileIndex,'String'); … … 1310 1322 ListFiles=ListFiles(~check_dir);%list of file names (excluding dir) 1311 1323 if ~isempty(ListFiles) 1312 [tild,tild,MaskExt]=fileparts(ListFiles{1}); 1313 [tild,tild,MaskFile,i1_series,i2_series,j1_series,j2_series,MaskNomType,MaskFileType]=find_file_series(MaskPath,ListFiles{1},0); 1314 if strcmp(MaskFileType,'image') && isempty(i2_series) && isempty(j2_series) 1315 mdetect=1; 1316 end 1317 end 1324 for ifile=1:numel(ListFiles) 1325 [tild,tild,MaskExt]=fileparts(ListFiles{1}); 1326 [tild,tild,MaskFile{ifile},i1_series,i2_series,j1_series,j2_series,MaskNomType,MaskFileType]=find_file_series(MaskPath,ListFiles{ifile},0); 1327 if strcmp(MaskFileType,'image') && isempty(i2_series) && isempty(j2_series) 1328 mdetect=1; 1329 end 1330 if ~strcmp(MaskFile{ifile},MaskFile{1}) 1331 mdetect=0;% cancel detection test in case of multiple masks, use the brower for selection 1332 break 1333 end 1334 end 1335 end 1336 RootPath=MaskPath; 1318 1337 end 1319 1338 if mdetect==0 … … 1536 1555 set(handles.MovieBackward,'BusyAction','Cancel') 1537 1556 set(handles.MenuExportMovie,'BusyAction','Cancel') 1538 set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command buttonback to red1557 %set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command buttonback to red 1539 1558 set(handles.Movie,'BackgroundColor',[1 0 0])%paint the command buttonback to red 1540 1559 set(handles.MovieBackward,'BackgroundColor',[1 0 0])%paint the command buttonback to red … … 1556 1575 InputFile.SubDir=regexprep(InputFile.SubDir,'^[\\/]|[\\/]$','');%suppress possible / or \ separator at the beginning or the end of the string 1557 1576 FileExt=InputFile.FileExt; 1558 NomType=get(handles.NomType,'String'); 1559 i1=str2num(get(handles.i1,'String'));%read the field indices (for movie, it is not given by the file name) 1560 i2=[];%default 1561 if strcmp(get(handles.i2,'Visible'),'on') 1562 i2=str2num(get(handles.i2,'String')); 1563 end 1564 j1=[]; 1565 if strcmp(get(handles.j1,'Visible'),'on') 1566 j1=stra2num(get(handles.j1,'String')); 1567 end 1568 j2=j1; 1569 if strcmp(get(handles.j2,'Visible'),'on') 1570 j2=stra2num(get(handles.j2,'String')); 1571 end 1577 NomType=InputFile.NomType; 1578 %NomType=get(handles.NomType,'String'); 1579 % i1=str2num(get(handles.i1,'String'));%read the field indices (for movie, it is not given by the file name) 1580 % i2=[];%default 1581 % if strcmp(get(handles.i2,'Visible'),'on') 1582 % i2=str2num(get(handles.i2,'String')); 1583 % end 1584 % j1=[]; 1585 % if strcmp(get(handles.j1,'Visible'),'on') 1586 % j1=stra2num(get(handles.j1,'String')); 1587 % end 1588 % j2=j1; 1589 % if strcmp(get(handles.j2,'Visible'),'on') 1590 % j2=stra2num(get(handles.j2,'String')); 1591 % end 1592 [tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(InputFile.FileIndex);% check back the indices used 1593 1572 1594 sub_value= get(handles.SubField,'Value'); 1573 1595 if sub_value % a second input file has been entered … … 1584 1606 CheckFixPair=get(handles.CheckFixPair,'Value')||(isempty(i2)&&isempty(j2)); 1585 1607 1586 % i1_1=i1;1587 % i2_1=i2;1588 % j1_1=j1;1589 % j2_1=j2;1590 1608 % the pair i1-i2 or j1-j2 is imposed (check box CheckFixPair selected) 1591 1609 if CheckFixPair && isnumeric(increment) … … 1596 1614 i1_1=i1_1+increment; 1597 1615 i2_1=i2_1+increment; 1598 end 1616 end 1599 1617 else % case of scanning along index j (burst numbers) 1600 1618 j1=j1+increment; … … 1606 1624 end 1607 1625 1608 % the pair i1-i2 or j1-j2 is free (check box CheckFixPair not selected): the list of existing indices recorded in UvData is used1626 % the pair i1-i2 or j1-j2 is free (check box CheckFixPair not selected): the list of existing indices recorded in UvData is used 1609 1627 else 1610 1628 UvData=get(handles.uvmat,'UserData'); … … 1677 1695 end 1678 1696 1679 % case of a second file series 1697 % case of a second file series 1680 1698 if sub_value 1681 1699 ref_i_1=i1_1; … … 1698 1716 else % free increment, synchronise the ref indices with the first series 1699 1717 ref_i_1=ref_i; 1700 ref_j_1=ref_j; 1718 ref_j_1=ref_j; 1701 1719 end 1702 1720 if numel(UvData.i1_series)==1 … … 1734 1752 if ~isempty(UvData.j2_series{2}) 1735 1753 j2_1=UvData.j2_series{1}(ref_indices(end)); 1736 end 1754 end 1737 1755 else% the second series (if needed) is the same file as the first 1738 1756 i1_1=i1; … … 1743 1761 end 1744 1762 filename=fullfile_uvmat(InputFile.RootPath,InputFile.SubDir,InputFile.RootFile,FileExt,NomType,i1,i2,j1,j2); 1763 1764 %% refresh plots 1745 1765 if sub_value 1746 1766 filename_1=fullfile_uvmat(InputFile.RootPath_1,InputFile.SubDir_1,InputFile.RootFile_1,InputFile.FileExt_1,InputFile.NomType_1,i1_1,i2_1,j1_1,j2_1); 1767 errormsg=refresh_field(handles,filename,filename_1,i1,i2,j1,j2,i1_1,i2_1,j1_1,j2_1); 1768 else 1769 errormsg=refresh_field(handles,filename,filename_1,i1,i2,j1,j2); 1747 1770 end 1748 1771 1749 1772 %% refresh plots 1750 errormsg=refresh_field(handles,filename,filename_1,i1,i2,j1,j2,i1_1,i2_1,j1_1,j2_1);1773 % errormsg=refresh_field(handles,filename,filename_1,i1,i2,j1,j2,i1_1,i2_1,j1_1,j2_1); 1751 1774 1752 1775 %% update the index counters if the index move is successfull … … 1773 1796 set(handles.movie_pair,'Value',1) 1774 1797 movie_pair_Callback(hObject, eventdata, handles); %reactivate moviepair if it was activated 1775 end 1798 else 1799 if isempty(i2), set(handles.i2,'String',''); end % suppress the second index display if not used 1800 if isempty(j2), set(handles.j2,'String',''); end 1801 end 1802 set(handles.i1,'BackgroundColor',[1 1 1]) 1803 set(handles.i2,'BackgroundColor',[1 1 1]) 1804 set(handles.j1,'BackgroundColor',[1 1 1]) 1805 set(handles.j2,'BackgroundColor',[1 1 1]) 1806 set(handles.FileIndex,'BackgroundColor',[1 1 1]) 1807 set(handles.FileIndex_1,'BackgroundColor',[1 1 1]) 1776 1808 end 1777 1809 … … 1786 1818 set(handles.i2,'String','') 1787 1819 set(handles.j2,'String','') 1820 set(handles.Dt_txt,'String','') 1788 1821 return 1789 1822 else … … 1861 1894 end 1862 1895 1896 %% display time interval for the image pair 1897 if isfield(UvData,'XmlData')&&isfield(UvData.XmlData{1},'Time') 1898 dt=(UvData.XmlData{1}.Time(num_i2+1,num_j2+1)-UvData.XmlData{1}.Time(num_i1+1,num_j1+1)); 1899 if isfield(UvData,'TimeUnit') 1900 set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) ' m' UvData.TimeUnit] ) 1901 else 1902 set(handles.Dt_txt,'String',['Dt=' num2str(1000*dt,3) ' 10^(-3)'] ) 1903 end 1904 else 1905 set(handles.Dt_txt,'String','') 1906 end 1907 1863 1908 %% get the first image 1864 1909 %Field.AName='image'; … … 1875 1920 end 1876 1921 [Field_b,ParamOut,errormsg] = read_field(imaname_1,UvData.FileType{index},MovieObject,num_frame); 1877 % Field_b.AX=Field_a.AX;1878 % Field_b.AY=Field_a.AY;1879 % % z index1880 % nbslice=str2double(get(handles.num_NbSlice,'String'));1881 % if ~isempty(nbslice)1882 % Field_b.ZIndex=mod(num_i2-1,nbslice)+1;1883 % end1884 % Field_b.CoordUnit='pixel';1885 %1886 % %% determine the input file type1887 % if (test_1 && isfield(UvData,'MovieObject')&& numel(UvData.MovieObject>=2))||(~test_1 && ~isempty(UvData.MovieObject{1}))1888 % FileType='movie';1889 % elseif isequal(lower(Ext),'.avi')1890 % FileType='avi';1891 % elseif isequal(lower(Ext),'.vol')1892 % FileType='vol';1893 % else1894 % form=imformats(Ext(2:end));1895 % if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab1896 % if isequal(NomType,'*');1897 % FileType='multimage';1898 % else1899 % FileType='image';1900 % end1901 % end1902 % end1903 % switch FileType1904 % case 'movie'1905 % if test_11906 % Field_b.A=read(UvData.MovieObject{2},num_i2);1907 % else1908 % Field_b.A=read(UvData.MovieObject{1},num_i2);1909 % end1910 % case 'avi'1911 % mov=aviread(imaname_1,num_i2);1912 % Field_b.A=frame2im(mov(1));1913 % case 'vol'1914 % Field_b.A=imread(imaname_1);1915 % case 'multimage'1916 % Field_b.A=imread(imaname_1,num_i2);1917 % case 'image'1918 % Field_b.A=imread(imaname_1);1919 % end1920 % if get(handles.slices,'Value')1921 % Field.ZIndex=str2double(get(handles.z_index,'String'));1922 % end1923 1922 1924 1923 %px to phys or other transform on field … … 1933 1932 end 1934 1933 1935 1934 % make movie until movie speed is set to 0 or STOP is activated 1936 1935 hima=findobj(handles.PlotAxes,'Tag','ima');% %handles.PlotAxes =main plotting window (A GENERALISER) 1937 1936 set(handles.STOP,'Visible','on') 1938 1937 set(handles.speed,'Visible','on') 1939 1938 set(handles.speed_txt,'Visible','on') 1939 set(handles.i2,'BackgroundColor',[1 1 1])% mark the edit box in white to indicate its use as input 1940 set(handles.j2,'BackgroundColor',[1 1 1])% mark the edit box in white to indicate its use as input 1941 set(handles.FileIndex,'BackgroundColor',[1 1 1])% mark the edit box in white to indicate its use as input 1940 1942 while get(handles.speed,'Value')~=0 && isequal(get(handles.movie_pair,'BusyAction'),'queue')%isequal(get(handles.run0,'BusyAction'),'queue'); % enable STOP command 1941 1943 % read and plot the series of images in non erase mode … … 1946 1948 end 1947 1949 set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red 1948 set(handles.movie_pair,'Value',0) 1950 set(handles.movie_pair,'Value',0) 1951 set(handles.Dt_txt,'String','') 1949 1952 1950 1953 %------------------------------------------------------------------------ … … 1955 1958 drawnow 1956 1959 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles); 1960 [tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(FileIndex);% check back the indices used 1961 if isempty(i2), set(handles.i2,'String',''); end % suppress the second index display if not used 1962 if isempty(j2), set(handles.j2,'String',''); end 1957 1963 filename=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt]; 1958 1964 filename_1='';%default … … 1981 1987 set(handles.j2,'BackgroundColor',[1 1 1]) 1982 1988 set(handles.FileIndex,'BackgroundColor',[1 1 1]) 1983 set(handles.FileIndex_1,'BackgroundColor',[1 1 1]) 1989 set(handles.FileIndex_1,'BackgroundColor',[1 1 1]) 1984 1990 end 1985 1991 set(handles.run0,'BackgroundColor',[1 0 0]) … … 1991 1997 % errormsg: error message char string =[] by default 1992 1998 % INPUT: 1993 % filename: first input file (=[] in the absence of input file)1994 % filename_1: second input file (=[] in the asbsenc of secodninput file)1999 % FileName: first input file (=[] in the absence of input file) 2000 % FileName_1: second input file (=[] in the asbsence of second input file) 1995 2001 % num_i1,num_i2,num_j1,num_j2; frame indices 1996 % Field: structure describing an optional input field (then replace the input file)1997 2002 % i1_1,i2_1,j1_1,j2_1: frame indices for the second input file (needed if FileName_1 is not empty) 2003 %------------------------------------------------------------------------ 1998 2004 function errormsg=refresh_field(handles,FileName,FileName_1,num_i1,num_i2,num_j1,num_j2,i1_1,i2_1,j1_1,j2_1) 1999 2005 %------------------------------------------------------------------------ … … 2320 2326 % get time in the input file, not defined in a xml file or movie 2321 2327 if isempty(abstime) 2322 if ~isempty(regexp(TimeName,'^att:'))||~isempty(regexp(TimeName,'^dim:'))||~isempty(regexp(TimeName,'^var:')) 2328 if strcmp(TimeName,'civdata')||strcmp(TimeName,'civx') 2329 abstime=Field{1}.Time; 2330 elseif ~isempty(regexp(TimeName,'^att:'))||~isempty(regexp(TimeName,'^dim:'))||~isempty(regexp(TimeName,'^var:')) 2323 2331 abstime=Field{1}.(TimeName(5:end));%the time is an attribute or variale selected by get_file 2324 2332 end … … 2362 2370 2363 2371 % get time in the input file of the second series, not defined in a xml file or movie 2364 if isempty(abstime_1) && numel(Field)==2 &&... 2365 ~isempty(regexp(TimeName_1,'^att:')) ||~isempty(regexp(TimeName_1,'^dim:'))||~isempty(regexp(TimeName_1,'^var:')) 2372 if isempty(abstime_1) && numel(Field)==2 2373 if strcmp(TimeName_1,'civdata')||strcmp(TimeName_1,'civx') 2374 abstime_1=Field{2}.Time; 2375 elseif ~isempty(regexp(TimeName_1,'^att:')) ||~isempty(regexp(TimeName_1,'^dim:'))||~isempty(regexp(TimeName_1,'^var:')) 2366 2376 abstime_1=Field{2}.(TimeName_1(5:end));%the time is an attribute or variale selected by get_file 2377 end 2367 2378 end 2368 2379 set(handles.TimeValue_1,'String',num2str(abstime_1,5)) … … 2806 2817 2807 2818 if ~get(handles.CheckFixLimits,'Value') 2808 update_plot(handles); 2819 update_plot(handles) 2820 set(handles.CheckZoom,'Value',0) 2809 2821 end 2810 2822 … … 3069 3081 YName={GetFieldData.Coordinates.Coord_y}; 3070 3082 CName=GetFieldData.PanelVectors.vec_color; 3071 [FieldList,VecColorList]=set_field_list(UName,VName,CName); 3083 FieldList={['vec(' UName ',' VName ')'];... 3084 ['norm(' UName ',' VName ')'];... 3085 UName;VName}; 3086 VecColorList={['norm(' UName ',' VName ')'];... 3087 UName;VName}; 3088 if ~isempty(CName) 3089 VecColorList=[{CName};VecColorList]; 3090 end 3072 3091 case 'scalar' 3073 3092 AName=GetFieldData.PanelScalar.scalar;
Note: See TracChangeset
for help on using the changeset viewer.