Changeset 122 for trunk/src/name2display.m
- Timestamp:
- Nov 14, 2010, 9:58:15 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/name2display.m
r120 r122 13 13 % nom_type='': constant name [filebase ext] (default output if 'nom_type' is undefined) 14 14 % nom_type='*':constant name for a file representing a series (e.g. avi movie) 15 % nom_type='_i': series of files with a single index i preceded by '_'(e.g. 'aa_45.png'). 16 % nom_type='#', series of indexed images wich is not series_i [filebase index ext], e.g. 'aa045.jpg' or 'aa45.tif' 17 % nom_type='_i_j': matrix of files with two indices i and j separated by '_'(e.g. 'aa_45_2.png') 18 % nom_type='_i1-i2': from pairs from a single index (e.g. 'aa_45-47.nc') 15 % nom_type='1','01',or '001'...': series of files with a single index i without separator(e.g. 'aa045.png'). 16 % nom_type='_1','_01','_001'...': series of files with a single index i with separator '_'(e.g. 'aa_045.png'). 17 % nom_type='1a','1A','01a','01A',... with a numerical index and an index letter(e.g.'aa45b.png') (lower or upper case) 18 % nom_type='_1a','_1A','_01a','_01A',...: idem, with a separator '_' before the index 19 % nom_type='_1_1','_01_1',...: matrix of files with two indices i and j separated by '_'(e.g. 'aa_45_2.png') 20 % nom_type='_i1-i2': from pairs from a single index (e.g. 'aa_45-47.nc') 19 21 % nom_type='_i_j1-j2': pairs of j indices (e.g. 'aa_45_2-3.nc') 20 22 % nom_type='_i1-i2_j': pairs of i indices (e.g. 'aa_45-46_2.nc') 21 % nom_type='#a','#A", with a numerical index and an index letter(e.g.'aa045b.png') (lower or upper case) 22 % nom_type='raw_SMD', same as '#' but with no extension ext='', OBSOLETE 23 % nom_type='#_ab', from pairs of '#' images (e.g. 'aa045bc.nc'), ext='.nc', OBSOLETE (replaced by '_i_j1-j2') 23 % nom_type='_1_ab','1_ab','01_ab'..., from pairs of '#' images (e.g.'aa045bc.nc'), ext='.nc' 24 24 %subdir: name of the subdirectory for netcdf files 25 25 % … … 44 44 45 45 %recognize the name form 46 filerawascii=double(RootFile);%ascci code47 val=(48>filerawascii)|(filerawascii>57); % test for the non-numerical characters48 indsel= find(val);% character indices of non numerical characters46 % filerawascii=double(RootFile);%ascci code 47 % val=(48>filerawascii)|(filerawascii>57); % test for the non-numerical characters 48 indsel=regexp(RootFile,'\D');% character indices of non numerical characters 49 49 filelit=RootFile(indsel);% fileraw name with numbers removed 50 50 nbchar=length(indsel); … … 69 69 penult=double(RootFile(indcur-1));%ascii code of the penultimate character 70 70 testsub=0; %default 71 % case of an indexed series in a single file 71 72 if strcmpi(ext,'.avi') 72 73 nom_type='*'; 73 %case of old image nomenclature 74 elseif (strcmp(ext,'.png') || strcmp(ext,'')) && penult >= 48 && penult <= 57 && (last < 48 || last > 57) 75 % if the penultimate character is a number and the last a letter 76 % search the appendix a,b,c, 77 str_a=last_str; %put appendix a,b,c.... 78 indcur=indcur-1; 79 if strcmp(ext,'.png'), nom_type='#a'; end 80 if strcmp(ext,''), nom_type='raw_SMD'; end 81 num=1;count=0; % extract the numerical appendix 82 while num==1; 83 filascii=double(RootFile(indcur)); 84 if (48>filascii)||(filascii>57); % select the non-numerical characters 85 num=0; 86 else 87 indcur=indcur-1; count=count+1; 88 end 74 %case of a numerical index follewed by a lower case letter (e.g. a,b,c): 75 %the penultimate character is a number and the last one a letter (lower case: last >= 97 && last <= 122 76 % capital letter: last >= 65 && last <= 90) 77 elseif penult >= 48 && penult <= 57 && (last >= 65 && last <= 90)||(last >= 97 && last <= 122) 78 str_a=last_str; %extract appendix a,b,c... or A,B,C... as output. 79 ind_end=indcur-1; %current index just before the suffix letter 80 indices_root=regexp(RootFile(1:indcur-1),'\D');%detect non digit characters 81 indcur=max(indices_root); 82 field_count=RootFile(indcur+1:ind_end); 83 charstring=['%0' num2str(length(field_count)) 'd']; 84 nom_type=num2str(1,charstring); 85 if strcmp(RootFile(indcur),'_') 86 nom_type=['_' nom_type]; 87 indcur=indcur-1; 89 88 end 90 if count~=0 91 field_count=RootFile(indcur+1:indcur+count);% set the selected field number 92 end 93 elseif penult >= 48 && penult <= 57 && (last <= 66 && last >= 65)% PCO camera Toulouse, end with A or B (NEW) 94 % if the penultimate character is a number and the last a letter 95 % search the appendix a,b,c, 96 str_a=last_str; %put appendix a,b,c.... 97 indcur=indcur-1; 98 num=1;count=0; % extract the numerical appendix 99 while num==1; 100 filascii=double(RootFile(indcur)); 101 if (48>filascii)||(filascii>57); % select the non-numerical characters 102 num=0; 103 else 104 indcur=indcur-1; count=count+1; 105 end 106 end 107 if strcmp('0',RootFile(indcur+1)); % select the non-numerical characters 108 nom_type=['%0' num2str(length(RootFile(indcur+1:end-1))) 'dA']; 89 if (last >= 65 && last <= 90) 90 nom_type=[nom_type 'A']; 109 91 else 110 nom_type='#A'; 111 end 112 113 if count~=0 114 field_count=RootFile(indcur+1:indcur+count);% set the selected field number 92 nom_type=[nom_type 'a']; 115 93 end 116 % indcur=indcur-1;117 94 elseif strcmp(filelit(end-2:end),'-_-_')%new nomenclature appendix num1-num2_num_a-num_b 118 95 field_count=num0; … … 149 126 str2=''; 150 127 str_a=num3; 151 nom_type='_ i_j';128 nom_type='_1_1'; 152 129 elseif strcmp(filelit(end),'_') 153 130 indcur=separ3-1; … … 157 134 %detect zeros before the number 158 135 % count=0; % extract the numerical appendix 159 if strcmp('0',RootFile(separ3+1)); % select the non-numerical characters 160 nom_type=['_%0' num2str(length(RootFile(separ3+1:end))) 'd']; 161 else 162 nom_type='_i'; 163 end 164 field_count=RootFile(separ3+1:end);% set the selected field number'%03d' 136 field_count=RootFile(separ3+1:end);% set the selected field number'%03d' 137 charstring=['%0' num2str(length(field_count)) 'd']; 138 nom_type=['_' num2str(1,charstring)]; 139 % if strcmp('0',RootFile(separ3+1)); % select the non-numerical characters 140 % nom_type=['_%0' num2str(length(RootFile(separ3+1:end))) 'd']; 141 % else 142 % nom_type='_i'; 143 % end 144 165 145 elseif RootFile(indcur-2)=='_'% search appendix a,b,c,d 166 146 last=RootFile(indcur-1:indcur); 167 if isequal(length(last),2) && double(last(1)) >= 97 && double(last(1)) <= 122 ...% = 1 for letters 168 && double(last(2)) >= 97 && double(last(2)) <= 122 147 if isequal(length(last),2) 169 148 str_a=last(1);%put appendix a,b,c, ou d 170 149 str_b=last(2);%put appendix a,b,c, ou d 171 150 % indcur=indcur-3; 172 151 separ0=indsel(end-3); 173 num0=RootFile(separ0+1:separ1-1); 174 field_count=num0; 152 field_count=RootFile(separ0+1:separ1-1); 175 153 indcur=separ0; 176 nom_type='#_ab'; 177 testsub=1; 154 if double(last) >= 97 & double(last)<= 122 155 nom_type='_ab'; 156 testsub=1; 157 elseif double(last) >= 65 & double(last) <= 90 158 nom_type='_AB'; 159 testsub=1; 160 end 161 charstring=['%0' num2str(length(field_count)) 'd']; 162 nom_type=[num2str(1,charstring) nom_type]; 178 163 end 179 164 %search for other names with counter … … 191 176 if count~=0 192 177 field_count=RootFile(indcur+1:indcur+count);% set the selected field number'%03d' 193 if isequal(field_count(1),'0') 194 nbfigures=length(field_count); 195 nom_type=['%0' num2str(nbfigures) 'd']; 196 else 197 nom_type='#'; 198 end 178 charstring=['%0' num2str(length(field_count)) 'd']; 179 nom_type=num2str(1,charstring); 180 % if isequal(field_count(1),'0') 181 % nbfigures=length(field_count); 182 % nom_type=['%0' num2str(nbfigures) 'd']; 183 % else 184 % nom_type='#'; 185 % end 199 186 end 200 187 end
Note: See TracChangeset
for help on using the changeset viewer.