Changeset 1041 for trunk/src/uvmat.m
- Timestamp:
- May 10, 2018, 8:30:27 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/uvmat.m
r1040 r1041 1846 1846 % detect the file type, get the movie object if relevant, and look for the corresponding file series: 1847 1847 % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists 1848 % if isempty(regexp(fileinput,'^http://')) 1849 [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileInfo,MovieObject,i1,i2,j1,j2]=find_file_series(FilePath,[FileName FileExt]); 1850 % else 1851 % FileInfo.FileType='netcdf'; 1852 % [RootPath,SubDir,RootFile,i1,i2,j1,j2,Ext,NomType]=fileparts_uvmat(fileinput); 1853 % i1_series=[0 i1 i2]; 1854 % i2_series=[]; 1855 % j1_series=[0 j1 j1]; 1856 % j2_series=[0 j1 j1]; 1857 % MovieObject=[]; 1858 % % [RootPath,RootFile]=fileparts(fileinput); 1859 % % [RootPath,SubDir]=fileparts(RootPath); 1860 % % NomType='*'; 1861 % end 1862 FileType=FileInfo.FileType; 1863 if strcmp(FileType,'txt') 1864 try 1865 edit(fileinput) 1866 catch ME 1867 msgbox_uvmat('ERROR','invalid intput file') 1868 end 1869 return 1870 elseif strcmp(FileType,'xml') 1871 editxml(fileinput) 1872 return 1873 elseif strcmp(FileType,'figure') 1874 open(fileinput) 1875 return 1876 end 1848 [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileInfo,MovieObject,i1,i2,j1,j2]=... 1849 find_file_series(FilePath,[FileName FileExt]); 1877 1850 1878 1851 %% open the file or fill the GUI uvmat according to the detected file type 1879 switch FileType 1852 FieldType=FileInfo.FieldType; 1853 switch FieldType 1880 1854 case '' 1881 1855 msgbox_uvmat('ERROR','invalid input file type') 1856 return 1882 1857 case 'txt' 1883 1858 edit(fileinput) 1859 return 1884 1860 case 'figure' %display matlab figure 1885 1861 hfig=open(fileinput); … … 1887 1863 set(hfig,'WindowButtonUpFcn','mouse_up')%set mouse click action function 1888 1864 set(hfig,'WindowButtonUpFcn','mouse_down')%set mouse click action function 1865 return 1889 1866 case 'xml' % edit xml files 1890 1867 t=xmltree(fileinput); … … 1895 1872 editxml(fileinput); 1896 1873 end 1874 return 1897 1875 case 'xls'% Excel file opended by editxml 1898 1876 editxml(fileinput); 1877 return 1899 1878 otherwise 1900 1879 set(handles_RootPath,'String',RootPath); 1901 1880 set(handles_SubDir,'String',['/' SubDir]); 1902 1881 set(handles_RootFile,'String',['/' RootFile]); %display the separator 1903 % if strcmp(NomType,'level') 1904 % rootname=fullfile(RootPath,SubDir,'level'); 1905 % rr=regexp(fileinput,['^' rootname '(?<j>\d+)/' RootFile '(?<i>\d+)' FileExt '$'],'names'); 1906 % if ~isempty(rr) 1907 % set(handles_FileIndex,'String',rr.i); 1908 % end 1909 % else 1910 if isempty(regexp(RootPath,'^http://')) 1882 if isempty(regexp(RootPath,'^http://')) 1911 1883 rootname=fullfile(RootPath,SubDir,RootFile); 1912 else 1913 rootname=[RootPath '/' SubDir '/' RootFile]; 1914 end 1915 indices=fileinput(length(rootname)+1:end); 1916 indices(end-length(FileExt)+1:end)=[]; %remove extension 1917 set(handles_FileIndex,'String',indices); 1918 % end 1884 else 1885 rootname=[RootPath '/' SubDir '/' RootFile]; 1886 end 1887 indices=fileinput(length(rootname)+1:end); 1888 indices(end-length(FileExt)+1:end)=[]; %remove extension 1889 set(handles_FileIndex,'String',indices); 1919 1890 set(handles_NomType,'String',NomType); 1920 1891 set(handles_FileExt,'String',FileExt); … … 1931 1902 i2_s=i2_0; 1932 1903 else 1933 i2_s=i2;1904 i2_s=i2; 1934 1905 end 1935 1906 j1_0=stra2num(get(handles.j1,'String')); … … 1946 1917 end 1947 1918 end 1948 1919 1949 1920 % synchronise indices of the second input file if it exists 1950 1921 if get(handles.SubField,'Value')==1% if the subfield button is activated, update the field numbers … … 1975 1946 set(handles.FileIndex_1,'String',FileIndex_1) 1976 1947 end 1977 1948 1978 1949 %enable other menus 1979 1950 set(handles.MenuOpenCampaign,'Enable','on') … … 1982 1953 set(handles.MenuExportMovie,'Enable','on') 1983 1954 set(handles.MenuTools,'Enable','on') 1984 1955 1985 1956 % initiate input file series and inputfilerefresh the current field view: 1986 1957 update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileInfo,MovieObject,index); 1987 1988 1958 end 1989 1959 … … 1997 1967 for ifile=1:min(length(MenuFile),5) 1998 1968 set(handles.(['MenuFile_' num2str(ifile)]),'Label',MenuFile{ifile}); 1999 %set(handles.(['MenuFile_' num2str(ifile) '_1']),'Label',MenuFile{ifile});2000 1969 end 2001 1970 dir_perso=prefdir; … … 2062 2031 XmlData.Time=[0;ones(size(i1_series,3)-1,1)]*(0:1/FileInfo.FrameRate:(FileInfo.NumberOfFrames)/FileInfo.FrameRate); 2063 2032 end 2064 % if strcmp(FileInfo.FileType,'rdvision')2065 % TimeName='timestamp';2066 % else2067 % TimeName='video';2068 % end2069 2033 end 2070 2034 if isfield(FileInfo,'TimeName') … … 2111 2075 ind_start=0; 2112 2076 end 2113 % complement the input if the whole time series is not defined2114 % if size(i1_series,3)>size(XmlDataRead.Time,1)-ind_start %only the first time interval is defined, extrapolate to the whole series2115 % Dti_total=XmlDataRead.Time(end)-XmlDataRead.Time(1);%total time interval covered by the time vector2116 % missing_indices=sizDti+1+ind_start:size(i1_series,3)+1;% remaining set of frame indices for which time needs to be found2117 % repeat_nbre=1+floor((missing_indices-sizDti-ind_start)/(sizDti-1));% number of repetitions of Dti2118 % time_indices=1+mod(missing_indices-sizDti-1,sizDti-1);2119 % for j=1:size(XmlDataRead.Time,2)2120 % XmlData.Time(missing_indices,j)=XmlDataRead.Time(time_indices,j)+repeat_nbre'*Dti_total;2121 % end2122 % % update the xml file with NbDti2123 % t=xmltree(XmlFileName);2124 % uid_NbDti=find(t,'ImaDoc/Camera/BurstTiming/NbDti')2125 % if isempty(uid_NbDti)2126 % uid_BurstTiming=find(t,'ImaDoc/Camera/BurstTiming')2127 % [t,uid_NbDti]=add(t,uid_BurstTiming,'element','NbDti');2128 % end2129 % [t,uid_NbDti]=add(t,uid_NbDti,'chardata',num2str(repeat_nbre(end)-1));2130 % save(t,XmlFileName)2131 % end2132 2077 end 2133 2078 set(handles.view_xml,'BackgroundColor',[1 1 1])% paint back to white … … 2160 2105 %% Define timing 2161 2106 % time not set by the input file: images or civ data: indicate that time is read from the xml file 2162 FileType=FileInfo.FileType;2107 %FileType=FileInfo.FileType; 2163 2108 if isfield(XmlData,'Time')&& ~isempty(XmlData.Time) && ... 2164 (strcmp(File Type,'image')|| strcmp(FileType,'multimage'))%||strcmp(FileType,'civdata')||strcmp(FileType,'civx'))2109 (strcmp(FileInfo.FileType,'image')|| strcmp(FileInfo.FileType,'multimage'))%||strcmp(FileType,'civdata')||strcmp(FileType,'civx')) 2165 2110 TimeName='xml'; 2166 elseif strcmp(File Type,'civdata')% ajouter pivdata_fluidimage2111 elseif strcmp(FileInfo.FieldType,'civdata')% ajouter pivdata_fluidimage 2167 2112 TimeName='civdata'; 2168 elseif strcmp(FileType,'civx')2169 TimeName='civx';2170 2113 end 2171 2114 if index==1 … … 2260 2203 2261 2204 %% set default options in menu 'FieldName' 2262 switch File Type2263 case {'civx','civdata','pivdata_fluidimage'}2205 switch FileInfo.FieldType 2206 case 'civdata' 2264 2207 [FieldList,ColorList]=set_field_list('U','V','C'); 2265 2208 set(handles_Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data … … 3318 3261 FieldName='';%default 3319 3262 VelType='';%default 3320 if strcmp(UvData.FileInfo{1}.FieldType,'image')3263 if isfield(UvData.FileInfo{1},'FieldType') && strcmp(UvData.FileInfo{1}.FieldType,'image') 3321 3264 FieldName='image'; 3322 3265 frame_index=1;%default … … 3376 3319 ParamIn.Coord_x=get(handles.Coord_x,'String'); 3377 3320 ParamIn.Coord_y=get(handles.Coord_y,'String'); 3321 if iscell(ParamIn.Coord_y) 3322 ParamIn.Coord_y=ParamIn.Coord_y'; 3323 end 3378 3324 ParamIn.Coord_z=get(handles.Coord_z,'String'); 3379 3325 %ParamIn.CheckCoordIndex=strcmp(get(handles.SwitchCoordIndex,'String'),'dim'); … … 3555 3501 %% update the display menu for the first velocity type (first menuline) 3556 3502 test_veltype=0; 3557 if (strcmp(UvData.FileInfo{1}.FileType,'civx')||strcmp(UvData.FileInfo{1}.FileType,'civdata')||strcmp(UvData.FileInfo{1}.FileType,'pivdata_fluidimage'))... 3558 && ~strcmp(FieldName,'get_field...') 3503 if isfield(UvData.FileInfo{1},'FieldType') && strcmp(UvData.FileInfo{1}.FieldType,'civdata')&& ~strcmp(FieldName,'get_field...') 3559 3504 test_veltype=1; 3560 3505 set(handles.VelType,'Visible','on') … … 3581 3526 if isempty(FileName_1) 3582 3527 elseif ~test_keepdata_1 3583 if (strcmp(UvData.FileType{2},'civx')||strcmp(UvData.FileType{2},'civdata')||strcmp(UvData.FileInfo{1}.FileType,'pivdata_fluidimage'))... 3584 && ~strcmp(FieldName_1,'get_field...') 3528 if strcmp(UvData.FileInfo{2}.FieldType,'civdata')&& ~strcmp(FieldName_1,'get_field...') 3585 3529 test_veltype_1=1; 3586 3530 set(handles.VelType_1,'Visible','on') … … 4504 4448 case '1D plot' 4505 4449 YName=GetFieldData.PanelOrdinate.ordinate; 4506 FieldList={''}; 4450 FieldList={''}; 4451 set(handles.uvmat,'ToolBar','figure') 4452 set(handles.Coord_y,'Max',2) 4453 %set(huvmat, 4507 4454 case 'civdata...'%reinitiate input, return to automatic civ data reading 4508 4455 display_file_name(handles,FileName,1)
Note: See TracChangeset
for help on using the changeset viewer.