Changeset 961
- Timestamp:
- Jun 28, 2016, 9:05:33 AM (8 years ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/find_file_series.m
r935 r961 77 77 end 78 78 if checkfileindexing 79 NomTypePref=''; 80 if isempty(NomType)||strcmp(NomType,'*') 81 if exist(fullfileinput,'file') 82 [tild,RootFile]=fileparts(fileinput);% case of constant name (no indexing), get the filename without its extension 79 NomTypePref=''; 80 if isempty(NomType)||strcmp(NomType,'*') 81 if exist(fullfileinput,'file') 82 [tild,RootFile]=fileparts(fileinput);% case of constant name (no indexing), get the filename without its extension 83 else 84 RootFile=''; 85 end 83 86 else 84 RootFile=''; 85 end 86 else 87 %% if checkxml=1, possibly include the first index in the root name, if there exists a corresponding xml file 88 if ~exist('checkxml','var')||checkxml 89 r=regexp(NomType,'^(?<tiretnum>_|\d+)','names');%look for a number or _1 at the beginning of NomType 90 if ~isempty(r) %if NomType begins by a number or _1 91 fileinput_end=regexprep(fileinput,['^' RootFile],'');%remove RootFile at the beginning of fileinput 92 if isempty(regexp(r.tiretnum,'^_','once'))% if a separator '_' is not detected 93 rr=regexp(fileinput_end,'^(?<i1>\d+)','names'); 94 else% if a separator '_' is detected 95 rr=regexp(fileinput_end,'^(?<i1>_\d+)','names'); 96 end 97 if ~isempty(rr) 98 RootFile_i=[RootFile rr.i1];% new root file 99 %look for an xml file correspoonding to the new root name 100 if exist(fullfile(RootPath,SubDir,[RootFile_i '.xml']),'file') || (strcmp(FileExt,'.nc') && exist(fullfile(RootPath,[RootFile_i '.xml']),'file')) 101 RootFile=RootFile_i; 102 NomTypePref=r.tiretnum; 103 NomType=regexprep(NomType,['^' NomTypePref],''); 104 i1_input=j1_input; 105 i2_input=j2_input; 106 j1_input=[]; 107 j2_input=[]; 108 end 109 end 110 end 111 end 112 %% analyse the list of existing files when relevant 113 sep1=''; 114 sep2=''; 115 i1_str='(?<i1>)';%will set i1=[]; 116 i1_star=''; 117 i2_str='(?<i2>)';%will set i2=[]; 118 i2_star=''; 119 j1_str='(?<j1>)';%will set j1=[]; 120 j1_star=''; 121 j2_str='(?<j2>)';%will set j2=[]; 122 j2_star=''; 123 %Look for cases with letter indexing for the second index 124 r=regexp(NomType,'^(?<sep1>_?)(?<i1>\d+)(?<sep2>_?)(?<j1>[a|A])(?<j2>[b|B]?)$','names'); 125 if ~isempty(r) 126 sep1=r.sep1; 127 sep2=r.sep2; 128 i1_str='(?<i1>\d+)'; 129 i1_star='*'; 130 if strcmp(lower(r.j1),r.j1)% lower case index 131 j1_str='(?<j1>[a-z])'; 132 else 133 j1_str='(?<j1>[A-Z])'; % upper case index 134 end 135 j1_star='*'; 136 if ~isempty(r.j2) 137 if strcmp(lower(r.j1),r.j1) 138 j2_str='(?<j2>[a-z])'; 139 else 140 j2_str='(?<j2>[A-Z])'; 141 end 142 j2_star='*'; 143 end 144 else %numerical indexing 145 r=regexp(NomType,'^(?<sep1>_?)(?<i1>\d+)(?<i2>(-\d+)?)(?<j1>(_\d+)?)(?<j2>(-\d+)?)$','names'); 87 %% if checkxml=1, possibly include the first index in the root name, if there exists a corresponding xml file 88 if ~exist('checkxml','var')||checkxml 89 r=regexp(NomType,'^(?<tiretnum>_|\d+)','names');%look for a number or _1 at the beginning of NomType 90 if ~isempty(r) %if NomType begins by a number or _1 91 fileinput_end=regexprep(fileinput,['^' RootFile],'');%remove RootFile at the beginning of fileinput 92 if isempty(regexp(r.tiretnum,'^_','once'))% if a separator '_' is not detected 93 rr=regexp(fileinput_end,'^(?<i1>\d+)','names'); 94 else% if a separator '_' is detected 95 rr=regexp(fileinput_end,'^(?<i1>_\d+)','names'); 96 end 97 if ~isempty(rr) 98 RootFile_i=[RootFile rr.i1];% new root file 99 %look for an xml file correspoonding to the new root name 100 if exist(fullfile(RootPath,SubDir,[RootFile_i '.xml']),'file') || (strcmp(FileExt,'.nc') && exist(fullfile(RootPath,[RootFile_i '.xml']),'file')) 101 RootFile=RootFile_i; 102 NomTypePref=r.tiretnum; 103 NomType=regexprep(NomType,['^' NomTypePref],''); 104 i1_input=j1_input; 105 i2_input=j2_input; 106 j1_input=[]; 107 j2_input=[]; 108 elseif exist([RootPath '.xml'],'file')% new convention with j indices in sub-folders level0, 1... 109 rj=regexp(SubDir,'^level(?<j1>\d+)$','names'); 110 if ~isempty(rj) 111 j1_input=rj.j1; 112 NomType='level'; 113 [RootPath,SubDir]=fileparts(RootPath); 114 end 115 end 116 end 117 end 118 end 119 120 %% analyse the list of existing files when relevant 121 sep1=''; 122 sep2=''; 123 i1_str='(?<i1>)';%will set i1=[]; 124 i1_star=''; 125 i2_str='(?<i2>)';%will set i2=[]; 126 i2_star=''; 127 j1_str='(?<j1>)';%will set j1=[]; 128 j1_star=''; 129 j2_str='(?<j2>)';%will set j2=[]; 130 j2_star=''; 131 %Look for cases with letter indexing for the second index 132 r=regexp(NomType,'^(?<sep1>_?)(?<i1>\d+)(?<sep2>_?)(?<j1>[a|A])(?<j2>[b|B]?)$','names'); 146 133 if ~isempty(r) 147 134 sep1=r.sep1; 135 sep2=r.sep2; 148 136 i1_str='(?<i1>\d+)'; 149 137 i1_star='*'; 150 if ~isempty(r.i2) 151 i2_str='(?<i2>-\d+)'; 152 i2_star='-*'; 153 end 154 if ~isempty(r.j1) 155 j1_str='(?<j1>_\d+)'; 156 j1_star='_*'; 157 end 138 if strcmp(lower(r.j1),r.j1)% lower case index 139 j1_str='(?<j1>[a-z])'; 140 else 141 j1_str='(?<j1>[A-Z])'; % upper case index 142 end 143 j1_star='*'; 158 144 if ~isempty(r.j2) 159 j2_str='(?<j2>-\d+)'; 160 j2_star='-*'; 161 end 162 end 163 end 164 detect_string=['^' RootFile sep1 i1_str i2_str sep2 j1_str j2_str FileExt '$'];%string used in regexp to detect file indices 165 %find the string used to extract the relevant files with the command dir 166 star_string=[RootFile sep1 i1_star i2_star sep2 j1_star j2_star FileExt]; 167 wd=pwd;%current working directory 168 cd (FilePath)% move to the local dir to save time in the operation dir. 169 dirpair=dir(star_string);% look for relevant files in the file directory 170 cd(wd) 171 nbpair=numel(dirpair); 172 ref_i_list=zeros(1,nbpair); 173 ref_j_list=zeros(1,nbpair); 174 if nbpair==0% no detected file 175 RootFile=''; 176 end 177 % scan the list of relevant files, extract the indices 178 for ifile=1:nbpair 179 rr=regexp(dirpair(ifile).name,detect_string,'names'); 180 if ~isempty(rr) 181 i1=str2num(rr.i1); 182 i2=str2num(regexprep(rr.i2,'^-','')); 183 j1=stra2num(regexprep(rr.j1,'^_','')); 184 j2=stra2num(regexprep(rr.j2,'^-','')); 185 ref_i=i1; 186 if isempty(i2_input) 187 if ~isempty(i2)% invalid file name if i2 does not exist in the input file 188 break 189 end 145 if strcmp(lower(r.j1),r.j1) 146 j2_str='(?<j2>[a-z])'; 147 else 148 j2_str='(?<j2>[A-Z])'; 149 end 150 j2_star='*'; 151 end 152 else %numerical indexing 153 r=regexp(NomType,'^(?<sep1>_?)(?<i1>\d+)(?<i2>(-\d+)?)(?<j1>(_\d+)?)(?<j2>(-\d+)?)$','names'); 154 if ~isempty(r) 155 sep1=r.sep1; 156 i1_str='(?<i1>\d+)'; 157 i1_star='*'; 158 if ~isempty(r.i2) 159 i2_str='(?<i2>-\d+)'; 160 i2_star='-*'; 161 end 162 if ~isempty(r.j1) 163 j1_str='(?<j1>_\d+)'; 164 j1_star='_*'; 165 end 166 if ~isempty(r.j2) 167 j2_str='(?<j2>-\d+)'; 168 j2_star='-*'; 169 end 170 end 171 end 172 if strcmp(NomType,'level') 173 star_string=[RootFile '*' FileExt]; 174 detect_string=['^' RootFile '(?<i1>\d+)' FileExt '$'];%string used in regexp to detect file indices 175 wd=pwd;%current working directory 176 cd (FilePath)% move to the local dir to save time in the operation dir. 177 dirpair=dir(star_string);% look for relevant files in the file directory 178 cd(wd) 179 nbpair=numel(dirpair); 180 i1_series=zeros(1,nbpair); 181 if nbpair==0% no detected file 182 RootFile=''; 183 end 184 % scan the list of relevant files, extract the indices 185 for ifile=1:nbpair 186 rr=regexp(dirpair(ifile).name,detect_string,'names'); 187 if ~isempty(rr) 188 i1_series(ifile)=str2num(rr.i1); 189 end 190 end 191 % look for the list of subfolders level# 192 cd (fullfile(RootPath,SubDir))% move to the local dir to save time in the operation dir. 193 dirpair=dir('level*');% look for relevant files in the file directory 194 cd(wd) 195 nbpair=numel(dirpair); 196 jfile=0; 197 for ifile=1:nbpair 198 rr=regexp(dirpair(ifile).name,'^level(?<i1>\d+)$','names'); 199 if ~isempty(rr) 200 jfile=jfile+1; 201 j1_series(jfile)=str2num(rr.i1); 202 end 203 end 204 [i1_series,j1_series]=meshgrid(i1_series,j1_series); 205 i1_series=reshape(i1_series,1,[]); 206 j1_series=reshape(j1_series,1,[]); 207 else 208 detect_string=['^' RootFile sep1 i1_str i2_str sep2 j1_str j2_str FileExt '$'];%string used in regexp to detect file indices 209 %find the string used to extract the relevant files with the command dir 210 star_string=[RootFile sep1 i1_star i2_star sep2 j1_star j2_star FileExt]; 211 wd=pwd;%current working directory 212 cd (FilePath)% move to the local dir to save time in the operation dir. 213 dirpair=dir(star_string);% look for relevant files in the file directory 214 cd(wd) 215 nbpair=numel(dirpair); 216 ref_i_list=zeros(1,nbpair); 217 ref_j_list=zeros(1,nbpair); 218 if nbpair==0% no detected file 219 RootFile=''; 220 end 221 % scan the list of relevant files, extract the indices 222 for ifile=1:nbpair 223 rr=regexp(dirpair(ifile).name,detect_string,'names'); 224 if ~isempty(rr) 225 i1=str2num(rr.i1); 226 i2=str2num(regexprep(rr.i2,'^-','')); 227 j1=stra2num(regexprep(rr.j1,'^_','')); 228 j2=stra2num(regexprep(rr.j2,'^-','')); 229 ref_i=i1; 230 if isempty(i2_input) 231 if ~isempty(i2)% invalid file name if i2 does not exist in the input file 232 break 233 end 234 else 235 ref_i=floor((i1+i2)/2); 236 end 237 ref_j=1; 238 if isempty(j1_input) 239 if ~isempty(j1)% invalid file name if j1 does not exist in the input file 240 break 241 end 242 else %j1_input is not empty 243 if isempty(j1)% the detected name does not fit with the input 244 break 245 else 246 ref_j=j1; 247 if isempty(j2_input) 248 if ~isempty(j2)% invalid file name if j2 does not exist in the input file 249 break 250 end 251 else 252 ref_j=floor((j1+j2)/2); 253 end 254 end 255 end 256 % update the detected index series 257 if ~isempty(ref_i)&&~isempty(ref_j) 258 ref_i_list(ifile)=ref_i; 259 ref_j_list(ifile)=ref_j; 260 nb_pairs=0; 261 if ~isempty(i2_input)|| ~isempty(j2_input) %deals with pairs 262 if size(i1_series,1)>=ref_i+1 && size(i1_series,2)>=ref_j+1 263 nb_pairs=numel(find(i1_series(ref_i+1,ref_j+1,:)~=0)); 264 end 265 end 266 if i1==0 267 i1=-1;% set index 0 to -1 to distinguish from the absent index (set to 0) 268 end 269 if j1==0 270 j1=-1;% set index 0 to -1 to distinguish from the absent index (set to 0) 271 end 272 i1_series(ref_i+1,ref_j+1,nb_pairs+1)=i1; 273 if ~isempty(i2_input) 274 i2_series(ref_i+1,ref_j+1,nb_pairs+1)=i2; 275 end 276 if ~isempty(j1_input) 277 j1_series(ref_i+1,ref_j+1,nb_pairs+1)=j1; 278 end 279 if ~isempty(j2_input) 280 j1_series(ref_i+1,ref_j+1,nb_pairs+1)=j1; 281 j2_series(ref_i+1,ref_j+1,nb_pairs+1)=j2; 282 end 283 end 284 end 285 end 286 % look for the numerical string of the first files to update the NomType (take into account the 0 before the number) 287 max_j=max(ref_j_list); 288 if isempty(max_j) 289 ref_ij=ref_i_list; 190 290 else 191 ref_i=floor((i1+i2)/2); 192 end 193 ref_j=1; 194 if isempty(j1_input) 195 if ~isempty(j1)% invalid file name if j1 does not exist in the input file 196 break 197 end 198 else %j1_input is not empty 199 if isempty(j1)% the detected name does not fit with the input 200 break 201 else 202 ref_j=j1; 203 if isempty(j2_input) 204 if ~isempty(j2)% invalid file name if j2 does not exist in the input file 205 break 206 end 207 else 208 ref_j=floor((j1+j2)/2); 209 end 210 end 211 end 212 % update the detected index series 213 if ~isempty(ref_i)&&~isempty(ref_j) 214 ref_i_list(ifile)=ref_i; 215 ref_j_list(ifile)=ref_j; 216 nb_pairs=0; 217 if ~isempty(i2_input)|| ~isempty(j2_input) %deals with pairs 218 if size(i1_series,1)>=ref_i+1 && size(i1_series,2)>=ref_j+1 219 nb_pairs=numel(find(i1_series(ref_i+1,ref_j+1,:)~=0)); 220 end 221 end 222 if i1==0 223 i1=-1;% set index 0 to -1 to distinguish from the absent index (set to 0) 224 end 225 if j1==0 226 j1=-1;% set index 0 to -1 to distinguish from the absent index (set to 0) 227 end 228 i1_series(ref_i+1,ref_j+1,nb_pairs+1)=i1; 229 if ~isempty(i2_input) 230 i2_series(ref_i+1,ref_j+1,nb_pairs+1)=i2; 231 end 232 if ~isempty(j1_input) 233 j1_series(ref_i+1,ref_j+1,nb_pairs+1)=j1; 234 end 235 if ~isempty(j2_input) 236 j1_series(ref_i+1,ref_j+1,nb_pairs+1)=j1; 237 j2_series(ref_i+1,ref_j+1,nb_pairs+1)=j2; 238 end 239 end 240 end 241 end 242 % look for the numerical string of the first files to update the NomType (take into account the 0 before the number) 243 max_j=max(ref_j_list); 244 if isempty(max_j) 245 ref_ij=ref_i_list; 246 else 247 ref_ij=ref_i_list*max_j+ref_j_list; % ordered by index i, then by j for a given i. 248 end 249 ind_select=find(ref_ij>0); 250 251 if isempty(ind_select) 252 % RootFile=''; 253 % NomType=''; 254 else 255 [tild,ifile_min]=min(ref_ij(ind_select)); 256 [tild,tild,tild,tild,tild,tild,tild,tild,NomType]=fileparts_uvmat(dirpair(ind_select(ifile_min)).name);% update the representation of indices (number of 0 before the number) 257 NomType=regexprep(NomType,['^' NomTypePref],''); 258 %% update the file type if the input file does not exist (pb of 0001) 259 if isempty(FileInfo.FileType) 260 [FileInfo,MovieObject]=get_file_info(fullfile(FilePath,dirpair(ifile_min).name)); 261 end 262 end 263 end 291 ref_ij=ref_i_list*max_j+ref_j_list; % ordered by index i, then by j for a given i. 292 end 293 ind_select=find(ref_ij>0); 294 295 if ~isempty(ind_select) 296 [tild,ifile_min]=min(ref_ij(ind_select)); 297 [tild,tild,tild,tild,tild,tild,tild,tild,NomType]=fileparts_uvmat(dirpair(ind_select(ifile_min)).name);% update the representation of indices (number of 0 before the number) 298 NomType=regexprep(NomType,['^' NomTypePref],''); 299 %% update the file type if the input file does not exist (pb of 0001) 300 if isempty(FileInfo.FileType) 301 [FileInfo,MovieObject]=get_file_info(fullfile(FilePath,dirpair(ifile_min).name)); 302 end 303 end 304 end 305 end 264 306 265 307 %% set to empty array the irrelevant index series -
trunk/src/fullfile_uvmat.m
r924 r961 76 76 end 77 77 if isequal(i1,i2) 78 i2=[];% suppress the seco dnindex if equal to the first78 i2=[];% suppress the second index if equal to the first 79 79 end 80 80 if ~exist('i1','var') … … 93 93 94 94 %% look for NomType with pairs (separator '-' or terminasion ab or AB 95 if ~isempty(regexp(NomType,'^_\d')) 96 sep1='_'; 97 NomType(1)=[];%remove '_' from the beginning of NomType 98 end 99 r=regexp(NomType,'^(?<num1>\d+)','names');%look for a number at the beginning of NomType 100 if ~isempty(r) 101 i1_str=num2str(i1,['%0' num2str(length(r.num1)) 'd']); 102 NomType=regexprep(NomType,['^' r.num1],''); 103 r=regexp(NomType,'^-(?<num2>\d+)','names');%look for a pair i1-i2 104 if ~isempty(r) 105 if ~isempty(i2) 106 sep2='-'; 107 i2_str=num2str(i2,['%0' num2str(length(r.num2)) 'd']); 108 end 109 NomType=regexprep(NomType,['^-' r.num2],''); 110 end 111 if ~isempty(regexp(NomType,'^_')); 112 sep3='_'; 95 if strcmp(NomType,'level')% organisation with a sub-folder for the files of each index i 96 filename=fullfile(RootPath,SubDir,['level' num2str(j1)],[RootFile num2str(i1) FileExt]); 97 else 98 if ~isempty(regexp(NomType,'^_\d')) 99 sep1='_'; 113 100 NomType(1)=[];%remove '_' from the beginning of NomType 114 101 end 115 if ~isempty(regexp(NomType,'^[a|A]')); 116 j1_str=num2stra(j1,NomType); 117 if ~isempty(regexp(NomType,'[b|B]$'))&& ~isempty(j2); 118 j2_str=num2stra(j2,NomType); 102 r=regexp(NomType,'^(?<num1>\d+)','names');%look for a number at the beginning of NomType 103 if ~isempty(r) 104 i1_str=num2str(i1,['%0' num2str(length(r.num1)) 'd']); 105 NomType=regexprep(NomType,['^' r.num1],''); 106 r=regexp(NomType,'^-(?<num2>\d+)','names');%look for a pair i1-i2 107 if ~isempty(r) 108 if ~isempty(i2) 109 sep2='-'; 110 i2_str=num2str(i2,['%0' num2str(length(r.num2)) 'd']); 111 end 112 NomType=regexprep(NomType,['^-' r.num2],''); 119 113 end 120 else 121 r=regexp(NomType,'^(?<num3>\d+)','names'); 122 if ~isempty(r) 123 j1_str=num2str(j1,['%0' num2str(length(r.num3)) 'd']); 124 NomType=regexprep(NomType,['^' r.num3],''); 114 if ~isempty(regexp(NomType,'^_')); 115 sep3='_'; 116 NomType(1)=[];%remove '_' from the beginning of NomType 125 117 end 126 if ~isempty(j2) 127 r=regexp(NomType,'-(?<num4>\d+)','names'); 128 if ~isempty(r) 129 sep4='-'; 130 j2_str=num2str(j2,['%0' num2str(length(r.num4)) 'd']); 131 end 118 if ~isempty(regexp(NomType,'^[a|A]')); 119 j1_str=num2stra(j1,NomType); 120 if ~isempty(regexp(NomType,'[b|B]$'))&& ~isempty(j2); 121 j2_str=num2stra(j2,NomType); 122 end 123 else 124 r=regexp(NomType,'^(?<num3>\d+)','names'); 125 if ~isempty(r) 126 j1_str=num2str(j1,['%0' num2str(length(r.num3)) 'd']); 127 NomType=regexprep(NomType,['^' r.num3],''); 128 end 129 if ~isempty(j2) 130 r=regexp(NomType,'-(?<num4>\d+)','names'); 131 if ~isempty(r) 132 sep4='-'; 133 j2_str=num2str(j2,['%0' num2str(length(r.num4)) 'd']); 134 end 135 end 132 136 end 133 137 end 138 filename=fullfile(RootPath,SubDir,RootFile); 139 filename=[filename sep1 i1_str sep2 i2_str sep3 j1_str sep4 j2_str]; 140 filename=[regexprep(filename,'_$','') FileExt];%suppress possible '_' at the end of the string and add the extension 134 141 end 135 filename=fullfile(RootPath,SubDir,RootFile);136 filename=[filename sep1 i1_str sep2 i2_str sep3 j1_str sep4 j2_str];137 filename=[regexprep(filename,'_$','') FileExt];%suppress possible '_' at the end of the string and add the extension138 139 142 140 143 function test -
trunk/src/proj_field.m
r959 r961 1642 1642 % determine the boundaries of the projected field, 1643 1643 % first find the 8 summits of the initial volume in the 1644 Angle=ObjectData.Angle*pi/180; 1644 1645 % new coordinates 1645 1646 Coord{1}=FieldData.(FieldData.ListVarName{CellInfo{icell}.CoordIndex(1)});%initial z coordinates … … 1651 1652 summit(1:2,5:8)=summit(1:2,1:4); 1652 1653 summit(3,:)=[Coord{1}(1)*ones(1,4) Coord{1}(end)*ones(1,4)]; 1653 Mrot=rodrigues(PlaneAngle);1654 %Mrot_inv=rodrigues(-PlaneAngle); 1654 1655 newsummit=zeros(3,8);% initialize the rotated summit coordinates 1655 1656 ObjectData.Coord=ObjectData.Coord'; … … 1657 1658 ObjectData.Coord=[ObjectData.Coord; 0];%add z origin at z=0 by default 1658 1659 end 1660 M2=[cos(Angle(2)) sin(Angle(2)) 0;-sin(Angle(2)) cos(Angle(2)) 0;0 0 1]; 1661 M1=[1 0 0;0 cos(Angle(1)) sin(Angle(1));0 -sin(Angle(1)) cos(Angle(1))]; 1662 M=M1*M2; 1663 M_inv=inv(M); 1664 1659 1665 for isummit=1:8% TODO: introduce a function for rotation of n points (to use also for scattered data) 1660 newsummit(:,isummit)=M rot*(summit(:,isummit)-(ObjectData.Coord));1666 newsummit(:,isummit)=M*(summit(:,isummit)-(ObjectData.Coord)); 1661 1667 end 1662 1668 coord_x_proj=min(newsummit(1,:)):InterpMesh: max(newsummit(1,:));% set of coordinqtes in the projection plane 1663 1669 coord_y_proj=min(newsummit(2,:)):InterpMesh: max(newsummit(2,:)); 1664 1670 coord_z_proj=-width:width; 1665 Mrot_inverse=rodrigues(-PlaneAngle);% inverse rotation matrix1666 Origin=M rot_inverse*[coord_x_proj(1);coord_y_proj(1);coord_z_proj(1)]+ObjectData.Coord;1671 %Mrot=rodrigues(PlaneAngle);% inverse rotation matrix 1672 Origin=M_inv*[coord_x_proj(1);coord_y_proj(1);coord_z_proj(1)]+ObjectData.Coord; 1667 1673 npx=numel(coord_x_proj); 1668 1674 npy=numel(coord_y_proj); 1669 1675 npz=numel(coord_z_proj); 1670 ix=Mrot_inverse*[coord_x_proj(end)-coord_x_proj(1);0;0]/(npx-1);% unit vector along the new x coordinates 1671 iy=Mrot_inverse*[0;coord_y_proj(end)-coord_y_proj(1);0]/(npy-1);% unit vector y coordinates 1672 iz=Mrot_inverse*[0;0;coord_z_proj(end)-coord_z_proj(1)]/(npz-1);% x unit vector z coordinates 1676 1677 %modangle=sqrt(PlaneAngle(1)*PlaneAngle(1)+PlaneAngle(2)*PlaneAngle(2)); 1678 % cosphi=PlaneAngle(1)/modangle; 1679 % sinphi=PlaneAngle(2)/modangle; 1680 iX=[coord_x_proj(end)-coord_x_proj(1);0;0]/(npx-1); 1681 iY=[0;coord_y_proj(end)-coord_y_proj(1);0]/(npy-1); 1682 iZ=[0;0;coord_z_proj(end)-coord_z_proj(1)]/(npz-1); 1683 % iX(1:2)=[cosphi -sinphi;sinphi cosphi]*iX(1:2); 1684 % iY(1:2)=[-cosphi -sinphi;sinphi cosphi]*iY(1:2); 1685 1686 ix=M_inv*iX;% vector along the new x coordinates transformed into old coordinates 1687 iy=M_inv*iY;% vector along y coordinates 1688 iz=M_inv*iZ;% vector along z coordinates 1689 1673 1690 [Grid_x,Grid_y,Grid_z]=meshgrid(0:npx-1,0:npy-1,0:npz-1); 1674 1691 if ismatrix(Grid_x)% add a singleton in case of a single z value … … 1680 1697 YI=Origin(2)+ix(2)*Grid_x+iy(2)*Grid_y+iz(2)*Grid_z; 1681 1698 ZI=Origin(3)+ix(3)*Grid_x+iy(3)*Grid_y+iz(3)*Grid_z; 1682 [X,Y,Z]=meshgrid(Coord{3},Coord{2},Coord{1}); 1683 % X=permute(X,[3 1 2]); 1684 % Y=permute(Y,[3 1 2]); 1685 % Z=permute(Z,[3 1 2]); 1699 [X,Y,Z]=meshgrid(Coord{3},Coord{2},Coord{1});% mesh in the initial coordinates 1686 1700 for ivar=VarIndex 1687 1701 VarName=FieldData.ListVarName{ivar}; -
trunk/src/set_object.m
r955 r961 163 163 set(handles.num_Angle_1,'String',num2str(data.Angle(1))) 164 164 set(handles.num_Angle_2,'String',num2str(data.Angle(2))) 165 set(handles.num_Angle_3,'String',num2str(data.Angle(3)))165 % set(handles.num_Angle_3,'String',num2str(data.Angle(3))) 166 166 % end 167 167 end … … 288 288 set(handles.num_Angle_1,'Visible','off') 289 289 set(handles.num_Angle_2,'Visible','off') 290 set(handles.num_Angle_3,'Visible','off')290 %set(handles.num_Angle_3,'Visible','off') 291 291 set(handles.num_RangeX_1,'Visible','off') 292 292 set(handles.num_RangeX_2,'Visible','off') … … 329 329 set(handles.num_RangeY_2,'TooltipString',['num_RangeY_2: half width of the ' ObjectStyle]) 330 330 case {'plane','plane_z'} 331 set(handles.num_Angle_3,'Visible','on')331 % set(handles.num_Angle_3,'Visible','on') 332 332 set(handles.num_RangeX_1,'Visible','on') 333 333 set(handles.num_RangeX_2,'Visible','on') … … 338 338 set(handles.num_Angle_2,'Visible','on') 339 339 set(handles.num_Angle_1,'Visible','on') 340 set(handles.num_Angle_1,'String','90') 341 set(handles.Coord,'Data',[0 0 0]) 340 342 set(handles.num_RangeZ_2,'Visible','on') 341 343 end -
trunk/src/uvmat.m
r956 r961 991 991 data.RangeY=UvData.Field.CoordMesh; 992 992 case 'plane_z' 993 data.Angle=[ 00 0];994 data.DX= 10*UvData.Field.CoordMesh;995 data.DY= 10*UvData.Field.CoordMesh;993 data.Angle=[90 0]; 994 data.DX=UvData.Field.CoordMesh; 995 data.DY=UvData.Field.CoordMesh; 996 996 data.RangeZ=UvData.Field.CoordMesh; 997 997 otherwise … … 2355 2355 NomType=get(handles.NomType,'String'); 2356 2356 indices=get(handles.FileIndex,'String'); 2357 [tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(indices);% the indices for the second series taken from FileIndex 2358 switch index_rank 2359 case 1 2360 indices=fullfile_uvmat('','','','',NomType,stra2num(get(handles.i1,'String')),i2,j1,j2);2361 % set(handles.i1,'BackgroundColor',[0.7 0.7 0.7])% mark the edit box in grey, then RUN0 will mark it in white for confirmation 2362 case 22363 indices=fullfile_uvmat('','','','',NomType,i1,stra2num(get(handles.i2,'String')),j1,j2);2364 % set(handles.i2,'BackgroundColor',[0.7 0.7 0.7])% mark the edit box in grey, then RUN0 will mark it in white for confirmation 2365 case 32366 indices=fullfile_uvmat('','','','',NomType,i1,i2,stra2num(get(handles.j1,'String')),j2);2367 % set(handles.j1,'BackgroundColor',[0.7 0.7 0.7])% mark the edit box in grey, then RUN0 will mark it in white for confirmation 2368 case 42369 indices=fullfile_uvmat('','','','',NomType,i1,i2,j1,stra2num(get(handles.j2,'String')));2370 % set(handles.j2,'BackgroundColor',[0.7 0.7 0.7])% mark the edit box in grey, then RUN0 will mark it in white for confirmation 2357 if strcmp(NomType,'level') 2358 indices=get(handles.i1,'String'); 2359 else 2360 [tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(indices);% the indices for the second series taken from FileIndex 2361 switch index_rank 2362 case 1 2363 indices=fullfile_uvmat('','','','',NomType,stra2num(get(handles.i1,'String')),i2,j1,j2); 2364 case 2 2365 indices=fullfile_uvmat('','','','',NomType,i1,stra2num(get(handles.i2,'String')),j1,j2); 2366 case 3 2367 indices=fullfile_uvmat('','','','',NomType,i1,i2,stra2num(get(handles.j1,'String')),j2); 2368 case 4 2369 indices=fullfile_uvmat('','','','',NomType,i1,i2,j1,stra2num(get(handles.j2,'String'))); 2370 end 2371 2371 end 2372 2372 set(handles.FileIndex,'String',indices) 2373 %set(handles.FileIndex,'BackgroundColor',[0.7 0.7 0.7])% mark the edit box in grey, then RUN0 will mark it in white for confirmation 2373 2374 2374 % update the second index if relevant 2375 2375 if strcmp(get(handles.FileIndex_1,'Visible'),'on') … … 2944 2944 set(handles.j2,'String',num2stra(j2,NomType,2)); 2945 2945 end 2946 if strcmp(NomType,'level') 2947 indices=num2str(i1); 2948 else 2946 2949 indices=fullfile_uvmat('','','','',NomType,i1,i2,j1,j2); 2950 end 2947 2951 set(handles.FileIndex,'String',indices); 2948 2952 if ~isempty(filename_1) … … 3151 3155 if isempty(i2), set(handles.i2,'String',''); end % suppress the second i index display if not used 3152 3156 if isempty(j2), set(handles.j2,'String',''); end % suppress the second j index display if not used 3157 if strcmp(get(handles.NomType,'String'),'level') 3158 jindex=str2num(get(handles.j1,'String')); 3159 filename=[fullfile(RootPath,SubDir,['level' num2str(jindex)],RootFile) FileIndex FileExt];% build the input file name (first line) 3160 else 3153 3161 filename=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];% build the input file name (first line) 3162 end 3154 3163 filename_1='';%default second file name 3155 3164 FileIndex_1='';
Note: See TracChangeset
for help on using the changeset viewer.