- Timestamp:
- Jul 2, 2014, 9:30:32 AM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/find_file_series.m
r788 r790 48 48 %% get input root name and nomenclature type 49 49 fullfileinput=fullfile(FilePath,fileinput);% input file name with path 50 [RootPath,SubDir,RootFile,i1_input,i2_input,j1_input,j2_input,FileExt,NomType]=fileparts_uvmat(fullfileinput); 51 50 [FileInfo,MovieObject]=get_file_info(fullfileinput); 52 51 53 52 %% check for particular file types: images, movies, civ data 54 i1_series=zeros(1,1,1); 55 i2_series=zeros(1,1,1); 56 j1_series=zeros(1,1,1); 57 j2_series=zeros(1,1,1); 58 [FileInfo,MovieObject]=get_file_info(fullfileinput); 53 checkfileindexing=0; 54 if isfield(FileInfo,'FileIndexing') && strcmp(FileInfo.FileIndexing,'on') 55 [RootPath,SubDir,RootFile,i1_input,i2_input,j1_input,j2_input,FileExt,NomType]=fileparts_uvmat(fullfileinput); 56 i1_series=zeros(1,1,1); 57 i2_series=zeros(1,1,1); 58 j1_series=zeros(1,1,1); 59 j2_series=zeros(1,1,1); 60 checkfileindexing=1; 61 else % no file indexing 62 [PathDir,RootFile]=fileparts(fullfileinput); 63 [RootPath,SubDir,DirExt]=fileparts(PathDir); 64 SubDir=[SubDir DirExt];% include part after . in the name (considered as a file extension) 65 NomType='*'; 66 i1_series=[];i2_series=[];j1_series=[];j2_series=[]; 67 i1_input=1;i2_input=[];j1_input=[];j2_input=[]; 68 end 59 69 if ~exist(FilePath,'dir') 60 70 return % don't go further if the dir path does not exist 61 71 end 72 if checkfileindexing 62 73 NomTypePref=''; 63 74 if isempty(NomType) … … 251 262 if isequal(j1_series,0), j1_series=[]; end 252 263 if isequal(j2_series,0), j2_series=[]; end 253 254 % % detect rdvision format255 if strcmp(FileExt,'.bin')256 if exist(fullfile(RootPath,SubDir,[RootFile '.seq']),'file')257 FileInfo.FileType='rdvision';258 FileInfo.SeqFile=[RootFile '.seq'];259 end260 end264 end 265 % %% detect rdvision format 266 % if strcmp(FileExt,'.bin') 267 % if exist(fullfile(RootPath,SubDir,[RootFile '.seq']),'file') 268 % FileInfo.FileType='rdvision'; 269 % FileInfo.SeqFile=[RootFile '.seq']; 270 % end 271 % end 261 272 262 273 %% introduce the frame index in case of movies or multimage type -
trunk/src/get_file_info.m
r784 r790 32 32 case {'.xml','.xls','.dat','.bin'} 33 33 FileInfo.FileType=regexprep(FileExt,'^.','');% eliminate the dot of the extension; 34 case '.seq' 35 FileInfo=ini2struct(fileinput); 36 if isfield(FileInfo,'sequenceSettings')&& isfield(FileInfo.sequenceSettings,'numberoffiles') 37 FileInfo.NumberOfFrames=str2double(FileInfo.sequenceSettings.numberoffiles); 38 FileInfo.FrameRate=str2double(FileInfo.sequenceSettings.framepersecond); 39 FileInfo.ColorType='grayscale'; 40 else 41 FileInfo.FileType=''; 42 return 43 end 44 FileInfo.FileType='rdvision'; % file used to store info from image acquisition systems of rdvision 45 nbfield=numel(fieldnames(FileInfo)); 46 FileInfo=orderfields(FileInfo,[nbfield nbfield-1 nbfield-2 (1:nbfield-3)]); %reorder the fields of fileInfo for clarity 34 case {'.seq','.sqb'} 35 [A,FileInfo,timestamps,errormsg]=read_rdvision(fileinput,[]); 36 47 37 otherwise 48 38 if ~isempty(FileExt)% exclude empty extension … … 120 110 end 121 111 end 112 switch FileInfo.FileType 113 case {'image','multimage','mmreader','video','netcdf','civdata'} 114 FileInfo.FileIndexing='on'; % allow to detect file index for scanning series 115 end -
trunk/src/read_rdvision.m
r785 r790 1 function [A,FileInfo,timestamps ]=read_rdvision(filename,frame_idx)1 function [A,FileInfo,timestamps,errormsg]=read_rdvision(filename,frame_idx) 2 2 % BINREAD_RDV Permet de lire les fichiers bin générés par Hiris à partir du 3 3 % fichier seq associé. … … 21 21 % NB_FRAMES : Nombres d'images dans la séquence. 22 22 23 23 errormsg=''; 24 24 if nargin<2% no frame indices specified 25 25 frame_idx=-1;% all the images in the series are read … … 27 27 A=[]; 28 28 timestamps=[]; 29 s=ini2struct(filename); 29 [PathDir,RootFile,Ext]=fileparts(filename); 30 RootPath=fileparts(PathDir); 31 switch Ext 32 case '.seq' 33 filename_seq=filename; 34 filename_sqb=fullfile(PathDir,[RootFile '.sqb']); 35 case '.sqb' 36 filename_seq=fullfile(PathDir,[RootFile '.seq']); 37 filename_sqb=filename; 38 otherwise 39 errormsg='input file extension must be .seq or .sqb'; 40 end 41 if ~exist(filename_seq,'file') 42 errormsg=[filename_seq ' does not exist']; 43 return 44 end 45 s=ini2struct(filename_seq); 30 46 FileInfo=s.sequenceSettings; 47 if isfield(s.sequenceSettings,'numberoffiles') 48 FileInfo.NumberOfFrames=str2double(s.sequenceSettings.numberoffiles); 49 FileInfo.FrameRate=str2double(s.sequenceSettings.framepersecond); 50 FileInfo.ColorType='grayscale'; 51 else 52 FileInfo.FileType=''; 53 return 54 end 55 FileInfo.FileType='rdvision'; % file used to store info from image acquisition systems of rdvision 56 nbfield=numel(fieldnames(FileInfo)); 57 FileInfo=orderfields(FileInfo,[nbfield nbfield-1 nbfield-2 (1:nbfield-3)]); %reorder the fields of fileInfo for clarity 31 58 32 59 % read the images the input frame_idxis not empty … … 37 64 bin_file=FileInfo.binfile; 38 65 nb_frames=str2double(FileInfo.numberoffiles); 39 40 [bin_dir,f]=fileparts(filename); 41 42 sqb_file=fullfile(bin_dir,[f '.sqb']); 43 m = memmapfile(sqb_file,'Format', { 'uint32' [1 1] 'offset'; ... 66 m = memmapfile(filename_sqb,'Format', { 'uint32' [1 1] 'offset'; ... 44 67 'uint32' [1 1] 'garbage1';... 45 68 'double' [1 1] 'timestamp';... … … 61 84 for i=1:length(frame_idx) 62 85 ii=frame_idx(i); 63 binfile=fullfile( bin_dir,sprintf('%s%.5d.bin',bin_file,data(ii).file_idx));86 binfile=fullfile(RootPath,FileInfo.binrepertoire,sprintf('%s%.5d.bin',bin_file,data(ii).file_idx)); 64 87 fid=fopen(binfile,'rb'); 65 88 fseek(fid,data(ii).offset,-1);
Note: See TracChangeset
for help on using the changeset viewer.