- Timestamp:
- May 10, 2018, 8:30:27 AM (7 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/find_field_cells.m
r1027 r1041 137 137 CellInfo{icell}.CoordSize=prod(CellInfo{icell}.CoordSize); 138 138 end 139 ind_scalar=find(strcmp('scalar',Role(VarIndex))); 140 ind_vector_x=find(strcmp('vector_x',Role(VarIndex))); 141 ind_vector_y=find(strcmp('vector_y',Role(VarIndex))); 139 142 ind_y=find(strcmp('coord_y',Role(VarIndex))); 140 if numel(VarIndex)==2||isempty(ind_y)% no variable, except possibly y 143 if numel([ind_scalar ind_vector_x ind_vector_y])==0 144 % if numel(VarIndex)==2||isempty(ind_y)% no variable, except possibly y 141 145 NbDim(icell)=1; 142 146 else -
trunk/src/get_file_info.m
r1040 r1041 55 55 function [FileInfo,VideoObject]=get_file_info(fileinput) 56 56 VideoObject=[]; 57 FileInfo.FileType='';% input file does not exist 58 FileInfo.FieldType=''; %default output 59 % check the existence (not possible for OpenDAP data) 57 60 if ~isempty(regexp(fileinput,'^http://'))|| exist(fileinput,'file') 58 61 FileInfo.FileName=fileinput; 59 62 FileInfo.FileType='txt'; %default 60 63 else 61 FileInfo.FileType='';% input file does not exist 62 return 64 return %input file does not exist. 63 65 end 64 66 [tild,tild,FileExt]=fileparts(fileinput);%get the file extension FileExt … … 186 188 end 187 189 end 190 188 191 if ismember (FileInfo.FileType,{'image','image_DaVis','multimage','mmreader','cine_phantom','video','netcdf','civdata'}) 189 192 FileInfo.FileIndexing='on'; % allow to detect file index for scanning series 193 else 194 FileInfo.FileIndexing='off'; 190 195 end 191 196 FileInfo.FieldType=FileInfo.FileType;%default … … 193 198 case {'image','multimage','video','mmreader','rdvision','image_DaVis','cine_phantom'} 194 199 FileInfo.FieldType='image'; 195 end 196 200 case {'civx','civdata','pivdata_fluidimage'} 201 FileInfo.FieldType='civdata'; 202 end 203 -
trunk/src/read_field.m
r1033 r1041 101 101 checkU=0; 102 102 checkV=0; 103 % scan the list InputField 103 104 for ilist=1:numel(InputField) 104 105 % look for input variables to read 105 106 r=regexp(InputField{ilist},'(?<Operator>(^vec|^norm))\((?<UName>.+),(?<VName>.+)\)$','names'); 106 107 if isempty(r)% no operator used 107 if isempty(find(strcmp(InputField{ilist},ListVar) ))108 if isempty(find(strcmp(InputField{ilist},ListVar),1)) 108 109 ListVar=[ListVar InputField(ilist)];%append the variable name if not already in the list 109 110 ListInputField=[ListInputField InputField(ilist)]; … … 111 112 end 112 113 if check_colorvar(ilist) 113 if isempty(find(strcmp(InputField{ilist},ListVar) ))114 if isempty(find(strcmp(InputField{ilist},ListVar),1)) 114 115 Role{numel(ListVar)}='ancillary';% not projected with interpolation 115 116 ProjModeRequest{numel(ListVar)}=''; … … 118 119 Role{numel(ListVar)}='scalar'; 119 120 ProjModeRequest{numel(ListVar)}='interp_lin';%scalar field (requires interpolation for plot) 121 end 122 if isfield(ParamIn,'Coord_y') 123 if ~isempty(strcmp(InputField{ilist},ParamIn.Coord_y)) 124 Role{numel(ListVar)}='coord_y'; 125 end 120 126 end 121 127 else % an operator 'vec' or 'norm' is used … … 139 145 Role=[Role {'vector_y'}]; 140 146 ProjModeRequest=[ProjModeRequest {ProjModeRequestVar}]; 141 ListInputField=[ListInputField InputField(ilist)]; 142 147 ListInputField=[ListInputField InputField(ilist)]; 143 148 else 144 149 checkV=1; … … 301 306 Npz=1;%default 302 307 npxy=size(A); 303 % Rangx=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers304 % Rangy=[npxy(1)-0.5 0.5]; %305 308 Field.NbDim=2;%default 306 309 Field.AName='image'; … … 318 321 ParamOut.Npy=npxy(1); 319 322 end 320 % Field.VarAttribute{3}.Mesh=1;321 323 else 322 324 Field.NbDim=3; … … 330 332 ParamOut.Npy=npxy(2); 331 333 end 332 % Field.VarAttribute{4}.Mesh=1;333 334 end 334 335 else … … 336 337 Field.Coord_y=[npxy(1)-0.5 0.5]; 337 338 Field.Coord_x=[0.5 npxy(2)-0.5]; % coordinates of the first and last pixel centers 338 % ParamOut.Npx=npxy(2);% display image size on the interface339 % ParamOut.Npy=npxy(1);340 % Field.VarAttribute{3}.Mesh=1;341 339 end 342 340 Field.A=A; 343 341 Field.CoordUnit='pixel'; %used for mouse_motion 344 345 end 346 347 348 342 end 343 344 345 -
trunk/src/series/civ_series.m
r1027 r1041 176 176 end 177 177 case 'displacement' 178 if isfield(Param.ActionInput,'OriginIndex') 178 179 i1_series_Civ1=Param.ActionInput.OriginIndex*ones(size(i1_series{1})); 180 else 181 i1_series_Civ1=ones(size(i1_series{1})); 182 end 179 183 i1_series_Civ2=i1_series_Civ1; 180 184 i2_series_Civ1=i1_series{1}; -
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.