Changeset 1194 for trunk/src/find_file_series.m
- Timestamp:
- Feb 23, 2026, 3:58:54 PM (8 days ago)
- File:
-
- 1 edited
-
trunk/src/find_file_series.m (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/find_file_series.m
r1181 r1194 1 1 %'find_file_series': check the content of an input file and find the corresponding file series 2 2 %-------------------------------------------------------------------------- 3 % function [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileInfo,Object,i1_input,i2_input,j1_input,j2_input]=find_file_series(FilePath,fileinput ,checkxml)3 % function [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileInfo,Object,i1_input,i2_input,j1_input,j2_input]=find_file_series(FilePath,fileinput) 4 4 % 5 5 % OUTPUT: … … 7 7 % SubDir: data dir containing the input file series 8 8 % RootFile: root file detected in fileinput, possibly modified for movies (indexing is then done on image view, not file) 9 % i1_series(pair,ref_j+1, ref_i+1),i2_series,j1_series,j2_series: set of indices (i1,i2,j1,j2) sorted by ref index ref_i, ref_j, and pairindex in case of multiple pairs with the same ref 10 % (ref_i+1 is used to deal with the image index zero sometimes used) 9 % i1_series(pair,ref_j+1, ref_i+1): set of indices i1 sorted by ref index ref_i, ref_j, and pair index in case of multiple pairs with the same ref. 10 % (ref_i+1 is used to deal with the image index zero sometimes used) 11 % i2_series,j1_series,j2_series: same as i1_series but for the indices i2,j1,j2. 12 % 11 13 % NomType: nomenclature type corrected after checking the first file (problem of 0 before the number string) 12 14 % FileInfo: structure containing info on the input files (assumed identical on the whole series) … … 24 26 % FilePath: path to the directory to be scanned 25 27 % fileinput: name (without path) of the input file sample 26 % checkxml: =1(default) take into account xml file existence to possibly include indexes in RootFile27 % =0: do not take into account xml file existence28 28 29 29 %======================================================================= … … 45 45 %======================================================================= 46 46 47 function [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileInfo,MovieObject,i1_input,i2_input,j1_input,j2_input]=find_file_series(FilePath,fileinput ,checkxml)47 function [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileInfo,MovieObject,i1_input,i2_input,j1_input,j2_input]=find_file_series(FilePath,fileinput) 48 48 %------------------------------------------------------------------------ 49 49 … … 75 75 end 76 76 else 77 %% if checkxml=1, possibly include the first index in the root name, if there exists a corresponding xml file 78 if ~exist('checkxml','var')||checkxml 79 r=regexp(NomType,'^(?<tiretnum>_|\d+)','names');%look for a number or _1 at the beginning of NomType 80 if ~isempty(r) %if NomType begins by a number or _1 81 fileinput_end=regexprep(fileinput,['^' RootFile],'');%remove RootFile at the beginning of fileinput 82 if isempty(regexp(r.tiretnum,'^_','once'))% if a separator '_' is not detected 83 rr=regexp(fileinput_end,'^(?<i1>\d+)','names'); 84 else% if a separator '_' is detected 85 rr=regexp(fileinput_end,'^(?<i1>_\d+)','names'); 86 end 87 if ~isempty(rr) 88 RootFile_i=[RootFile rr.i1];% new root file 89 %look for an xml file correspoonding to the new root name 90 if exist(fullfile(RootPath,SubDir,[RootFile_i '.xml']),'file') || (strcmp(FileExt,'.nc') && exist(fullfile(RootPath,[RootFile_i '.xml']),'file')) 91 RootFile=RootFile_i; 92 NomTypePref=r.tiretnum; 93 NomType=regexprep(NomType,['^' NomTypePref],''); 94 i1_input=j1_input; 95 i2_input=j2_input; 96 j1_input=[]; 97 j2_input=[]; 98 end 99 end 100 end 101 end 77 102 78 103 79 %% analyse the list of existing files when relevant
Note: See TracChangeset
for help on using the changeset viewer.
