Changeset 1181 for trunk/src/get_file_info.m
- Timestamp:
- May 21, 2025, 6:14:05 PM (13 days ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/get_file_info.m
r1180 r1181 1 %'ge t_file_info': determine info about a file (image, multimage, civdata,...) .1 %'gext_file_info': determine info about a file (image, multimage, civdata,...) . 2 2 %------------------------------------------------------------------------ 3 3 % [FileInfo,VideoObject]=get_file_info(fileinput) … … 5 5 % OUTPUT: 6 6 % FileInfo: structure containing info on the file (case of images or video), in particular 7 % .FileType: type of file, needed as input of read_field.m 8 % ='figure': Matlab figure 7 % .FileName: confirms the file name, ='' if the file is not detected 8 % .FileType: type of file, needed as input of read_field.m 9 % ='': unknown format 10 % ='bin': binary file without specific organisation 11 % ='dat': text file for data 12 % ='figure': Matlab figure file, ext .fig 9 13 % ='mat': Matlab data file 14 % ='netcdf': generic netcdf file 10 15 % ='xml': xml file 11 16 % ='xls': Excel file 12 % ='dat': text file for data, 17 % ='civdata': netcdf files provided by civ_series 18 % ='pivdata_fluidimage': PIV data from software 'fluidimage' 19 % different image and movie formats: 13 20 % ='image': image format recognised by Matlab 14 21 % ='multimage': image format recognised by Matlab with multiple frames … … 16 23 % ='mmreader': video from old versions of Matlab (<2009) 17 24 % ='rdvision': images in binary format from company rdvision 18 % ='image_DaVis': images from softwar DaVis (company LaVision) 25 % ='image_DaVis': images from softwar DaVis (company LaVision), requires specific conditions of Matlab version and computer system 19 26 % ='cine_phantom': images from fast camera Phantom 20 % ='bin': binary file without specific organisation 21 % ='netcdf': netcdf file 22 % ='civdata': netcdf files provided by civ_series 23 % ='civx': netcdf files provided by the obsolete program civx (in fortran) 24 % ='pivdata_fluidimage': PIV data from software 'fluidimage' 27 % ='telopsIR': Infrared images from company Telops 25 28 % .FieldType='image' for all kinds of images and movies, =FileType else 26 % .FileIndexing='on'/'off', for data files (when series of indexed files are expected)29 % .FileIndexing='on'/'off', = 'on' for series of indexed files or frames to scan 27 30 % .Height: image height in pixels 28 31 % .Width: image width in pixels … … 30 33 % .ColorType: 'greyscale' or 'color' 31 34 % .NumberOfFrames: defined for images or movies 32 % .FrameRate: nbre of frames per second, =[] for images35 % .FrameRate: nbre of frames per second, =[] if not documented 33 36 % VideoObject: in case of video 34 37 % … … 57 60 58 61 VideoObject=[]; 59 FileInfo.FileType='';% input file does not exist 62 FileInfo.FileName='';% file doe not exist, defautlt 63 FileInfo.FileType='';% input file type not detected 60 64 FileInfo.FieldType=''; %default output 61 65 if ~ischar(fileinput) 62 66 return 63 67 end 64 % check the existence (not possible for OpenDAP data) 68 69 %% check the existence (not possible for OpenDAP data) 65 70 if ~isempty(regexp(fileinput,'^http://','once'))|| exist(fileinput,'file') 66 71 FileInfo.FileName=fileinput; 67 FileInfo.FileType='txt'; %default72 % FileInfo.FileType='txt'; %default 68 73 else 69 74 return %input file does not exist. … … 71 76 [~,~,FileExt]=fileparts(fileinput);%get the file extension FileExt 72 77 78 %% look according to file extension 73 79 switch FileExt 74 case '.fig' 80 case '.fig'% Matlab figure assumed 75 81 FileInfo.FileType='figure'; 76 case '.mat' 82 case '.mat'% Matlab data format 77 83 FileInfo.FileType='mat'; 84 case {'.txt','.log','.stdout','.stderr','.sh'} 85 FileInfo.FileType='txt'; 78 86 case {'.xml','.xls','.dat','.bin'} 79 87 FileInfo.FileType=regexprep(FileExt,'^.','');% eliminate the dot of the extension; 80 case {'.seq','.sqb'} 88 case {'.seq','.sqb'}% data from rdvision 81 89 [~,FileInfo]=read_rdvision(fileinput,[]); 82 case '.im7' 90 case '.im7'% data from LaVision (DaVis), requires specific conditions of Matlab version and computer system 83 91 try 84 92 Input=readimx(fileinput); … … 98 106 end 99 107 catch ME 100 msgbox_uvmat('ERROR',{ME.message;'reading image from DaVis is possible only with Matlab version 2013 or earlier'})108 msgbox_uvmat('ERROR',{ME.message;'reading image from DaVis is not possible with this Matlab version and system'}) 101 109 return 102 110 end 103 case '.h5' 111 case '.h5'% format hdf5, used for specific case of PIV data from 'Fluidimage' 104 112 hinfo=h5info(fileinput); 105 113 FileInfo.CivStage=0; … … 127 135 FileInfo.BitDepth=BitmapInfoHeader.biBitCount; 128 136 FileInfo.TimeName='video'; 129 case '.hcc' 137 case '.hcc' % infrared camera Telops 130 138 installToolboxIRCAM 131 139 [~,InfoArray]=readIRCam(fileinput,'HeadersOnly',true); … … 273 281 end 274 282 275 if ismember (FileInfo.FileType,{'mat','image','image_DaVis','multimage','mmreader','cine_phantom','video','netcdf','civdata'})276 FileInfo.FileIndexing='on'; % allow to detect file index for scanning series277 else278 FileInfo.FileIndexing='off';279 end280 283 FileInfo.FieldType=FileInfo.FileType;%default 281 284 switch FileInfo.FileType 282 285 case {'image','multimage','video','mmreader','rdvision','image_DaVis','cine_phantom','telopsIR'} 283 286 FileInfo.FieldType='image'; 284 case {'civ x','civdata','pivdata_fluidimage'}287 case {'civdata','pivdata_fluidimage'} 285 288 FileInfo.FieldType='civdata'; 286 289 end 287 290 291 if strcmp(FileInfo.FieldType,'image') || ismember (FileInfo.FileType,{'mat','netcdf','civdata'}) 292 FileInfo.FileIndexing='on'; % allow to detect file index for scanning series 293 else 294 FileInfo.FileIndexing='off'; 295 end 296 297
Note: See TracChangeset
for help on using the changeset viewer.