- Timestamp:
- Jun 11, 2012, 9:35:38 AM (13 years ago)
- Location:
- trunk/src/series
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/aver_stat.m
r442 r447 3 3 % function GUI_input=aver_stat(Param) 4 4 % 5 %%%%%%%%%%% GENERAL TO ALL SERIES ACTION FCTS %%%%%%%%%%%%%%%%%%%%%%%%%%% 5 6 %OUTPUT 6 7 % GUI_input=list of options in the GUI series.fig needed for the function 7 8 % 8 9 %INPUT: 9 % Param: structure containing all the parameters read on the GUI series 10 % or name of the xml file containing these parameters (BATCH case) 10 % In run mode, the input parameters are given as a Matlab structure Param copied from the GUI series. 11 % In batch mode, Param is the name of the corresponding xml file containing the same information 12 % In the absence of input (as activated when the current Action is selected 13 % in series), the function ouput GUI_input set the activation of the needed GUI elements 11 14 % 15 % Param contains the elements:(use the menu bar command 'export/GUI config' in series to see the current structure Param) 16 % .InputTable: cell of input file names, (several lines for multiple input) 17 % each line decomposed as {RootPath,SubDir,Rootfile,NomType,Extension} 18 % .OutputSubDir: name of the subdirectory for data outputs 19 % .OutputDir: directory for data outputs, including path 20 % .Action: .ActionName: name of the current activated function 21 % .ActionPath: path of the current activated function 22 % .IndexRange: set the file or frame indices on which the action must be performed 23 % .FieldTransform: .TransformName: name of the selected transform function 24 % .TransformPath: path of the selected transform function 25 % .TransformHandle: corresponding function handle 26 % .InputFields: sub structure describing the input fields withfields 27 % .FieldName: name of the field 28 % .VelType: velocity type 29 % .FieldName_1: name of the second field in case of two input series 30 % .VelType_1: velocity type of the second field in case of two input series 31 % .ProjObject: %sub structure describing a projection object (read from ancillary GUI set_object) 32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 33 12 34 function GUI_input=aver_stat(Param) 13 %---------------------------------------------------------------------- 14 % --- make average on a series of files 15 %---------------------------------------------------------------------- 16 %INPUT: 17 %i1_series: series of first indices i (given from the series interface as first_i:incr_i:last_i, mode and list_pair_civ) 18 %num_i2: series of second indices i (given from the series interface as first_i:incr_i:last_i, mode and list_pair_civ) 19 %j1_series: series of first indices j (given from the series interface as first_j:incr_j:last_j, mode and list_pair_civ ) 20 %num_j2: series of second indices j (given from the series interface as first_j:incr_j:last_j, mode and list_pair_civ) 21 %OTHER INPUTS given by the structure Series 22 % Series.Time: 23 % Series.GeometryCalib:%requests for the visibility of input windows in the GUI series (activated directly by the selection in the menu ACTION) 24 if ~exist('Param','var') 25 GUI_input={'RootPath';'two';...%nbre of possible input series (options 'on'/'two'/'many', default:'one') 26 'SubDir';'on';... % subdirectory of derived files (PIV fields), ('on' by default) 27 'RootFile';'on';... %root input file name ('on' by default) 28 'FileExt';'on';... %input file extension ('on' by default) 29 'NomType';'on';...%type of file indexing ('on' by default) 35 36 %% set the input elements needed on the GUI series when the action is selected in the menu ActionName 37 if ~exist('Param','var') % case with no input parameter 38 GUI_input={'NbViewMax';2;...% max nbre of input file series (default='' , no limitation) 39 'AllowInputSort';'off';...% allow alphabetic sorting of the list of input files (options 'off'/'on', 'off' by default) 30 40 'NbSlice';'on'; ...%nbre of slices ('off' by default) 31 'VelType Menu';'two';...% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default)32 'Field Menu';'two';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)33 ' CoordType'; 'on';...%can use a transform function34 ' GetObject';'on';...%can use projection object(option 'off'/'one'/'two',35 %'GetMask';'on'...%can use mask option36 %'PARAMETER'; %options: name of the user defined parameter',repeat a line for each parameter41 'VelType';'two';...% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) 42 'FieldName';'two';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 43 'FieldTransform'; 'on';...%can use a transform function 44 'ProjObject';'on';...%can use projection object(option 'off'/'on', 45 'Mask';'off';...%can use mask option (option 'off'/'on', 'off' by default) 46 'OutputDirExt';'.stat';...%set the output dir extension 37 47 ''}; 38 48 return 39 49 end 40 50 41 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 42 43 %% input parameters 44 % read the xml file for batch case 51 %%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%% 52 %% get input parameters, file names and indices 53 % BATCH case: read the xml file for batch case 45 54 if ischar(Param) && ~isempty(find(regexp('Param','.xml$'))) 46 55 Param=xml2struct(Param); 47 56 checkrun=0; 48 else % RUN case: parameters introduced as the input structure Param 57 % RUN case: parameters introduced as the input structure Param 58 else 49 59 hseries=guidata(Param.hseries);%handles of the GUI series 50 WaitbarPos=get(hseries.waitbar_frame,'Position'); 51 checkrun=1; 52 end 60 WaitbarPos=get(hseries.waitbar_frame,'Position');%position of the waitbar on the GUI series 61 checkrun=1; % indicate the RUN option is used 62 end 63 % get the set of input file names (cell array filecell), and the lists of 64 % input file or frame indices i1_series,i2_series,j1_series,j2_series 53 65 [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param); 54 55 %% projection object 56 test_object=get(hseries.GetObject,'Value'); 57 if test_object%isfield(Series,'sethandles') 58 hset_object=findobj(allchild(0),'tag','set_object'); 59 ProjObject=read_GUI(hset_object); 60 answeryes=msgbox_uvmat('INPUT_Y-N',['field series projected on ' ProjObject.Type ' before averaging']); 61 if ~isequal(answeryes,'Yes') 62 return 63 end 64 end 65 66 %% root input file and type 67 RootPath=Param.InputTable(:,1); 68 RootFile=Param.InputTable(:,3); 69 SubDir=Param.InputTable(:,2); 70 NomType=Param.InputTable(:,4); 71 FileExt=Param.InputTable(:,5); 72 ext=FileExt{1}; 73 form=imformats(ext([2:end]));%test valid Matlab image formats 74 testima=0; 75 if ~isempty(form)||isequal(lower(ext),'.avi')||isequal(lower(ext),'.vol') 76 testima(1)=1; 77 end 78 if length(FileExt)>=2 79 ext_1=FileExt{2}; 80 form=imformats(ext_1([2:end]));%test valid Matlab image formats 81 if ~isempty(form)||isequal(lower(ext_1),'.avi')||isequal(lower(ext_1),'.vol') 82 testima(2)=1; 83 end 84 if testima(2)~=testima(1) 85 msgbox_uvmat('ERROR','images and netcdf files cannot be compared') 86 return 87 end 88 end 89 90 91 %% Number of input series: this function accepts two input file series at most (then it operates on the difference of fields) 92 nbview=length(RootPath); 93 if nbview>2 94 RootPath=RootPath(1:2); 95 set(hseries.RootPath,'String',RootPath) 96 SubDir=SubDir(1:2); 97 set(hseries.SubDir,'String',SubDir) 98 RootFile=RootFile(1:2); 99 set(hseries.RootFile,'String',RootFile) 100 NomType=NomType(1:2); 101 FileExt=FileExt(1:2); 102 set(hseries.FileExt,'String',FileExt) 103 nbview=2; 104 end 105 106 %% determine image type 107 hhh=which('mmreader'); 66 % filecell{iview,fileindex}: cell array representing the list of file names 67 % iview: line in the table corresponding to a given file series 68 % fileindex: file index within the file series, 69 % i1_series(iview,ref_j,ref_i)... are the corresponding arrays of indices i1,i2,j1,j2, depending on the input line iview and the two reference indices ref_i,ref_j 70 % i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices 71 % set of frame indices used for movie or multimage input 72 if ~isempty(j1_series) 73 frame_index=j1_series; 74 else 75 frame_index=i1_series; 76 end 77 78 %% root input file(s) and type 79 RootPath=Param.InputTable(:,1); 80 RootFile=Param.InputTable(:,3); 81 SubDir=Param.InputTable(:,2); 82 NomType=Param.InputTable(:,4); 83 FileExt=Param.InputTable(:,5); 84 85 % numbers of slices and file indices 86 NbSlice=1;%default 87 if isfield(Param.IndexRange,'NbSlice') 88 NbSlice=Param.IndexRange.NbSlice; 89 end 90 nbview=size(i1_series,1);%number of input file series (lines in InputTable) 91 nbfield_j=size(i1_series,2); %nb of consecutive fields at each level(burst 92 nbfield=nbfield_j*size(i1_series,3); %total number of files or frames 93 nbfield_i=floor(nbfield/NbSlice);%total number of i indexes (adjusted to an integer number of slices) 94 nbfield=nbfield_i*nbfield_j; %total number of fields after adjustement 95 96 %determine the file type on each line from the first input file 97 ImageTypeOptions={'image','multimage','mmreader','video'}; 98 NcTypeOptions={'netcdf','civx','civdata'}; 108 99 for iview=1:nbview 109 if isequal(FileExt{iview},'.nc')||isequal(FileExt{iview},'.cdf') 110 FileType{iview}='netcdf'; 111 elseif isequal(lower(FileExt{iview}),'.avi') 112 if ~isequal(hhh,'')&& mmreader.isPlatformSupported() 113 MovieObject{iview}=mmreader(fullfile(RootPath{iview},[RootFile{iview} FileExt{iview}])); 114 FileType{iview}='movie'; 115 else 116 FileType{iview}='avi'; 117 end 118 elseif isequal(lower(FileExt{iview}),'.vol') 119 FileType{iview}='vol'; 120 else 121 form=imformats(FileExt{iview}(2:end)); 122 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab 123 if isequal(NomType{iview},'*'); 124 FileType{iview}='multimage'; 125 else 126 FileType{iview}='image'; 127 end 128 end 129 end 130 end 131 132 %% number of slices 133 NbSlice=Param.IndexRange.NbSlice; 134 135 %% Field and velocity type (the same for the two views) 136 Field_str=get(hseries.FieldMenu,'String'); 137 FieldName=[]; %default 138 testfield=get(hseries.FieldMenu,'Visible'); 139 if isequal(testfield,'on') 140 val=get(hseries.FieldMenu,'Value'); 141 FieldName=Field_str(val);%the same set of fields for all views 142 if isequal(FieldName,{'get_field...'}) 143 hget_field=findobj(allchild(0),'name','get_field');%find the get_field... GUI 144 if length(hget_field)>1 145 delete(hget_field(2:end)) 146 elseif isempty(hget_field) 147 filename=... 148 name_generator(fullfile(RootPath{1},RootFile{1}),i1_series{1}(1),j1_series{1}(1),FileExt{1},NomType{1},1,i2_series{1}(1),num_j2{1}(1),SubDir{1}); 149 get_field(filename); 150 return 151 end 152 SubField=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI 153 end 154 end 155 156 %% get the velocity type 157 testcivx=0; 158 if ~isequal(FieldName,{'get_field...'}) 159 testcivx=isequal(FileType{1},'netcdf'); 160 end 161 if testcivx 162 VelType_str=get(hseries.VelTypeMenu,'String'); 163 VelType_val=get(hseries.VelTypeMenu,'Value'); 164 VelType{1}=VelType_str{VelType_val}; 165 if nbview==2 166 VelType_str=get(hseries.VelTypeMenu_1,'String'); 167 VelType_val=get(hseries.VelTypeMenu_1,'Value'); 168 VelType{2}=VelType_str{VelType_val}; 169 end 100 [FileType{iview},FileInfo{iview},Object{iview}]=get_file_type(filecell{iview,1}); 101 CheckImage{iview}=~isempty(find(strcmp(FileType{iview},ImageTypeOptions)));% =1 for images 102 CheckNc{iview}=~isempty(find(strcmp(FileType{iview},NcTypeOptions)));% =1 for netcdf files 170 103 end 171 104 … … 237 170 diff_time=max(max(diff(time))); 238 171 if diff_time>0 239 msgbox_uvmat('WARNING',['times of series differ by more than' num2str(diff_time)])172 msgbox_uvmat('WARNING',['times of series differ by (max) ' num2str(diff_time)]) 240 173 end 241 174 end 242 if size(time,2) < i2_series {1}(end) || size(time,3) < num_j2{1}(end)% time array absent or too short in ImaDoc xml file'175 if size(time,2) < i2_series(1,end) || size(time,3) < j2_series(1,end)% time array absent or too short in ImaDoc xml file' 243 176 time=[]; 244 end245 246 %% Name(s) of output file(s)247 filebase_out=filebase{1};% the result file has the same root name as the input file series (and the first one is chosen in case of two input series)248 %file extension of the result249 if testima %case of images250 ext_out='.png';251 else252 ext_out='.nc';253 end254 subdir_result=[SubDir{1} '.stat'];%subdirectory for the results255 pathdir=RootPath{1};% full subdirectory name, including path256 checkdetect=1;257 while checkdetect %create a new subdir if the netcdf files already exist258 checkdetect=exist(fullfile(pathdir,subdir_result));259 if checkdetect% if a nesult dir already exists260 r=regexp(subdir_result,'(?<root>.*\D)(?<num1>\d+)$','names');%detect whether name ends by a number261 if isempty(r)262 r(1).root=[subdir_result '_'];263 r(1).num1='0';264 end265 subdir_result=[r(1).root num2str(str2num(r(1).num1)+1)];%increment the index by 1 or put 1266 end267 end268 NomTypeOut='_1-2';269 fileresult{1}=fullfile_uvmat(RootPath{1},subdir_result,RootFile{1},ext_out,NomTypeOut,i1_series{1}(1),i1_series{1}(end),[],[]);270 271 % A REPRNDRE CAS MULTI-NIVEAU:272 % pathdir=fullfile(RootPath{1},subdir_result);% full subdirectory name, including path273 % if NbSlice==1% keep track of the first and lsat indices of the input files274 % %NomTypeOut=nomtype2pair(Param.InputTable{1,4},i2_series{end}(end)-i1_series{1}(1),j2_series{end}(end)-j1_series{1}(1));275 % NomTypeOut='_1-2';276 % fileresult{1}=fullfile_uvmat(RootPath{1},subdir_result,RootFile{1},ext_out,NomTypeOut,i1_series{1}(1),i1_series{1}(end),[],[]);277 % testexist=exist(fileresult{1},'file');278 % else % simplified indexing with i_slice for multiple slices279 % testexist=0;280 % for i_slice=1:NbSlice281 % fileresult{1}=fullfile_uvmat(RootPath{1},subdir_result,RootFile{1},ext_out,NomTypeOut,i_slice,[],[],[]);282 % if exist(fileresult{i_slice},'file')283 % testexist=1;284 % break285 % end286 % end287 % end288 % if testexist289 % subdir_result=[subdir_result '.0'];290 % end291 % end292 % create result directory if needed293 if ~exist(fullfile(RootPath{1},subdir_result),'dir')294 [m1,m2,m3]=mkdir(fullfile(RootPath{1},subdir_result));295 if ~isequal(m2,'')296 msgbox_uvmat('CONFIRMATION',m2);%error message for directory creation297 end298 end299 [xx,msg2] = fileattrib(fullfile(RootPath{1},subdir_result),'+w','g'); %yield writing access (+w) to user group (g)300 if ~strcmp(msg2,'')301 msgbox_uvmat('ERROR',['pb of permission for ' fullfile(RootPath{1},subdir_result) ': ' msg2])%error message for writting access302 return303 177 end 304 178 305 179 %% coordinate transform or other user defined transform 306 180 transform_fct='';%default 307 if isfield(Param,'FieldTransform')&&isfield(Param.FieldTransform,'fct_handle') 308 transform_fct=Param.FieldTransform.fct_handle; 309 end 310 311 %% main loop 312 siz=size(i1_series{1}); 313 nbfield2=siz(1); %nb of consecutive fields at each level(burst 314 nbfield=siz(1)*siz(2); 315 nbfield=floor(nbfield/(nbfield2*NbSlice));%total number of i indexes (adjusted to an integer number of slices) 316 317 % loop on slices 181 if isfield(Param,'FieldTransform')&&isfield(Param.FieldTransform,'TransformHandle') 182 transform_fct=Param.FieldTransform.TransformHandle; 183 end 184 %%%%%%%%%%%% END STANDARD PART %%%%%%%%%%%% 185 % EDIT FROM HERE 186 187 %% check the validity of input file types 188 if CheckImage{1} 189 FileExtOut='.png'; % write result as .png images for image inputs 190 elseif CheckNc{1} 191 FileExtOut='.nc';% write result as .nc files for netcdf inputs 192 else 193 msgbox_uvmat('ERROR',['invalid file type input ' FileType{1}]) 194 return 195 end 196 if nbview==2 && ~isequal(CheckImage{1},CheckImage{2}) 197 msgbox_uvmat('ERROR','input must be two image series or two netcdf file series') 198 return 199 end 200 NomTypeOut='_1-2_1';% output file index will indicate the first and last ref index in the series 201 if NbSlice~=nbfield_j 202 answer=msgbox_uvmat('INPUT_Y-N',['will not average slice by slice: for so cancel and set NbSlice= ' num2str(nbfield_j)]); 203 if ~strcmp(answer,'Yes') 204 return 205 end 206 end 207 208 %% Set field names and velocity types 209 InputFields{1}=[];%default (case of images) 210 if isfield(Param,'InputFields') 211 InputFields{1}=Param.InputFields; 212 end 213 if nbview==2 214 InputFields{2}=[];%default (case of images) 215 if isfield(Param,'InputFields') 216 InputFields{2}=Param.InputFields{1};%default 217 if isfield(Param.InputFields,'FieldName_1') 218 InputFields{2}.FieldName=Param.InputFields.FieldName_1; 219 if isfield(Param.InputFields,'VelType_1') 220 InputFields{2}.VelType=Param.InputFields.VelType_1; 221 end 222 end 223 end 224 end 225 226 %% Initiate output fields 227 %initiate the output structure as a copy of the first input one (reproduce fields) 228 [DataOut,ParamOut,errormsg] = read_field(filecell{1,1},FileType{1},InputFields{1},1); 229 if ~isempty(errormsg) 230 msgbox_uvmat('ERROR',['error reading ' filecell{1,1} ': ' errormsg]) 231 return 232 end 233 time_1=[]; 234 if isfield(DataOut,'Time') 235 time_1=DataOut.Time(1); 236 end 237 if CheckNc{iview} 238 if isempty(strcmp('Conventions',DataOut.ListGlobalAttribute)) 239 DataOut.ListGlobalAttribute=['Conventions' DataOut.ListGlobalAttribute]; 240 end 241 DataOut.Conventions='uvmat'; 242 DataOut.ListGlobalAttribute=[DataOut.ListGlobalAttribute {Param.Action}]; 243 ActionKey='Action'; 244 while isfield(DataOut,ActionKey) 245 ActionKey=[ActionKey '_1']; 246 end 247 DataOut.(ActionKey)=Param.Action; 248 DataOut.ListGlobalAttribute=[DataOut.ListGlobalAttribute {ActionKey}]; 249 if isfield(DataOut,'Time') 250 DataOut.ListGlobalAttribute=[DataOut.ListGlobalAttribute {'Time','Time_end'}]; 251 end 252 end 253 254 %% MAIN LOOP ON SLICES 255 %%%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%% 318 256 for i_slice=1:NbSlice 319 for ifield=1:nbfield 320 indselect(:,ifield)=((ifield-1)*NbSlice+(i_slice-1))*nbfield2+[1:nbfield2]';%selected indices on the list of files of a slice 321 end 322 S=0; %initiate the image sum S 257 index_slice=i_slice:NbSlice:nbfield;% select file indices of the slice 323 258 nbfiles=0; 324 259 nbmissing=0; 325 % averaging loop 326 for index=1:nbfield*nbfield2 327 % stopstate=get(hseries.RUN,'BusyAction'); 328 % if isequal(stopstate,'queue') % enable STOP command 329 % update_waitbar(hseries.waitbar,WaitbarPos,index/(nbfield*nbfield2)) 330 if checkrun 331 update_waitbar(hseries.waitbar_frame,WaitbarPos,index/(nbfield*nbfield2)) 332 stopstate=get(hseries.RUN,'BusyAction'); 333 else 334 stopstate='queue'; 335 end 336 ifile=indselect(index); 260 261 %initiate result fields 262 for ivar=1:length(DataOut.ListVarName) 263 DataOut.(DataOut.ListVarName{ivar})=0; % initialise all fields to zero 264 end 265 266 %%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%% 267 for index=index_slice 268 if checkrun 269 update_waitbar(hseries.waitbar_frame,WaitbarPos,index/(nbfield)) 270 stopstate=get(hseries.RUN,'BusyAction'); 271 else 272 stopstate='queue'; 273 end 274 275 %%%%%%%%%%%%%%%% loop on views (input lines) %%%%%%%%%%%%%%%% 276 for iview=1:nbview 337 277 % reading input file(s) 338 for iview=1:nbview 339 filename=filecell{iview,index}; 340 if ~isequal(FileType{iview},'netcdf') 341 Data{iview}.ListVarName={'A'}; 342 Data{iview}.AName='image'; 343 switch FileType{iview} 344 case 'movie' 345 A=read(MovieObject{iview},i1_series{iview}(ifile)); 346 case 'avi' 347 mov=aviread(filename,i1_series{iview}(ifile)); 348 A=frame2im(mov(1)); 349 case 'vol' 350 A=imread(filename); 351 case 'multimage' 352 A=imread(filename,i1_series{iview}(ifile)); 353 case 'image' 354 A=imread(filename); 355 end 356 Data{iview}.ListVarName={'AY','AX','A'}; % 357 Atype{iview}=class(A); 358 npy=size(A,1); 359 npx=size(A,2); 360 nbcolor=size(A,3); 361 if nbcolor==3 362 Data{iview}.VarDimName={'AY','AX',{'AY','AX','rgb'}}; 363 else 364 Data{iview}.VarDimName={'AY','AX',{'AY','AX'}}; 365 end 366 Data{iview}.AY=[npy-0.5 0.5]; 367 Data{iview}.AX=[0.5 npx-0.5]; 368 Data{iview}.A=double(A); 369 Data{iview}.CoordUnit='pixel'; 370 elseif testcivx 371 [Data{iview},VelTypeOut,errormsg]=read_civxdata(filename,FieldName,VelType); 372 if ~isempty(errormsg) 373 msgbox_uvmat('ERROR',['error of input reading: ' errormsg]) 374 return 375 end 376 else 377 [Data{iview},var_detect]=nc2struct(filename,SubField.ListVarName); %read the corresponding input data 378 Data{iview}.VarAttribute=SubField.VarAttribute; 379 end 380 if isfield(Data{iview},'Txt') 381 msgbox_uvmat('ERROR',['error of input reading: ' Data{iview}.Txt]) 382 return 383 end 384 end 385 278 [Data{iview},ParamOut,errormsg] = read_field(filecell{iview,index},FileType{iview},InputFields{iview},frame_index(iview,index)); 279 if ~isempty(errormsg) 280 errormsg=['error of input reading: ' errormsg]; 281 break 282 end 283 if ~isempty(NbSlice_calib) 284 Data{iview}.ZIndex=mod(i1_series(iview,index)-1,NbSlice_calib{1})+1;%Zindex for phys transform 285 end 286 end 287 Field=[]; % initiate the current input field structure 288 %%%%%%%%%%%%%%%% end loop on views (input lines) %%%%%%%%%%%%%%%% 289 %%%%%%%%%%%% END STANDARD PART %%%%%%%%%%%% 290 % EDIT FROM HERE 291 292 if isempty(errormsg) 386 293 % coordinate transform (or other user defined transform) 387 294 if ~isempty(transform_fct) 388 if ~isempty(NbSlice_calib)389 Data{iview}.ZIndex=mod(i1_series{iview}(ifile)-1,NbSlice_calib{1})+1;%Zindex for phys transform390 end391 295 if nbview==2 392 296 [Data{1},Data{2}]=transform_fct(Data{1},XmlData{1},Data{2},XmlData{2}); … … 400 304 401 305 % field calculation (vort, div...) 402 if testcivx403 Data{ iview}=calc_field(FieldName,Data{iview});%calculate field (vort..)306 if strcmp(FileType{1},'civx')||strcmp(FileType{1},'civ') 307 Data{1}=calc_field(InputFields{1}.FieldName,Data{1});%calculate field (vort..) 404 308 end 405 309 406 310 % field substration (for two input file series) 407 311 if length(Data)==2 312 if strcmp(FileType{2},'civx')||strcmp(FileType{2},'civ') 313 Data{2}=calc_field(InputFields{2}.FieldName,Data{2});%calculate field (vort..) 314 end 408 315 [Field,errormsg]=sub_field(Data{1},Data{2}); %substract the two fields 409 316 if ~isempty(errormsg) … … 414 321 Field=Data{1}; 415 322 end 416 if test_object323 if Param.CheckObject 417 324 [Field,errormsg]=proj_field(Field,ProjObject); 418 325 if ~isempty(errormsg) … … 422 329 end 423 330 nbfiles=nbfiles+1; 424 if nbfiles==1 %first field 425 time_1=[]; 426 if isfield(Field,'Time') 427 time_1=Field.Time(1); 331 332 %%%%%%%%%%%% MAIN RUNNING OPERATIONS %%%%%%%%%%%% 333 %update sum 334 for ivar=1:length(Field.ListVarName) 335 VarName=Field.ListVarName{ivar}; 336 sizmean=size(DataOut.(VarName)); 337 siz=size(Field.(VarName)); 338 if ~isequal(DataOut.(VarName),0)&& ~isequal(siz,sizmean) 339 msgbox_uvmat('ERROR',['unequal size of input field ' VarName ', need to project on a grid']) 340 return 341 else 342 DataOut.(VarName)=DataOut.(VarName)+ double(Field.(VarName)); % update the sum 428 343 end 429 DataMean=Field;%default 430 else 431 for ivar=1:length(Field.ListVarName) 432 VarName=Field.ListVarName{ivar}; 433 eval(['sizmean=size(DataMean.' VarName ');']); 434 eval(['siz=size(Field.' VarName ');']); 435 if ~isequal(siz,sizmean) 436 msgbox_uvmat('ERROR',['unequal size of input field ' VarName ', need to project on a grid']) 437 return 438 else 439 eval(['DataMean.' VarName '=DataMean.' VarName '+ Field.' VarName ';']); % update the sum 440 end 441 end 442 end 443 % end 444 end 445 %end averaging loop 344 end 345 %%%%%%%%%%%% END MAIN RUNNING OPERATIONS %%%%%%%%%%%% 346 else 347 display(errormsg) 348 end 349 end 350 %%%%%%%%%%%%%%%% end loop on field indices %%%%%%%%%%%%%%%% 351 446 352 for ivar=1:length(Field.ListVarName) 447 353 VarName=Field.ListVarName{ivar}; 448 eval(['DataMean.' VarName '=DataMean.' VarName '/nbfiles;']); % normalize the mean354 DataOut.(VarName)=DataOut.(VarName)/nbfiles; % normalize the mean 449 355 end 450 356 if nbmissing~=0 … … 455 361 time_end=Field.Time(1);%last time read 456 362 if ~isempty(time_1) 457 Data Mean.Time=time_1;458 Data Mean.Time_end=time_end;363 DataOut.Time=time_1; 364 DataOut.Time_end=time_end; 459 365 end 460 366 end 461 367 else % time from ImaDoc prevails 462 Data Mean.Time=time(1,i1_series{1}(1),j1_series{1}(1));463 Data Mean.Time_end=time(end,i1_series{end}(end),j1_series{end}(end));368 DataOut.Time=time(1,i1_series(1,1),j1_series(1,1)); 369 DataOut.Time_end=time(end,i1_series(end,end),j1_series(end,end)); 464 370 end 465 371 466 372 %writing the result file 467 if testima %case of images 468 if isequal(Atype{1},'uint16') 469 imwrite(uint16(DataMean.A),fileresult{i_slice},'BitDepth',16); % case of 16 bit images 373 OutputFile=fullfile_uvmat(RootPath{1},Param.OutputSubDir,RootFile{1},FileExtOut,NomTypeOut,i1_series(1,1),i1_series(1,end),i_slice,[]); 374 if CheckImage{1} %case of images 375 if isequal(FileInfo{1}.BitDepth,16)||(numel(FileInfo)==2 &&isequal(FileInfo{2}.BitDepth,16)) 376 DataOut.A=uint16(DataOut.A); 377 imwrite(DataOut.A,OutputFile,'BitDepth',16); % case of 16 bit images 470 378 else 471 imwrite(uint8(DataMean.A),fileresult{i_slice},'BitDepth',8); % case of 8 bit images 472 end 473 display([fileresult{i_slice} ' written']); 379 DataOut.A=uint8(DataOut.A); 380 imwrite(DataOut.A,OutputFile,'BitDepth',8); % case of 16 bit images 381 end 382 display([OutputFile ' written']); 474 383 else %case of netcdf input file , determine global attributes 475 if isempty(strcmp('Conventions',DataMean.ListGlobalAttribute)) 476 DataMean.ListGlobalAttribute=['Conventions' DataMean.ListGlobalAttribute]; 477 end 478 DataMean.Conventions='uvmat'; 479 DataMean.ListGlobalAttribute=[DataMean.ListGlobalAttribute {Param.Action}]; 480 ActionKey='Action'; 481 while isfield(DataMean,ActionKey) 482 ActionKey=[ActionKey '_1']; 483 end 484 DataMean.(ActionKey)=Param.Action; 485 DataMean.ListGlobalAttribute=[DataMean.ListGlobalAttribute {ActionKey}]; 486 if isfield(DataMean,'Time') 487 DataMean.ListGlobalAttribute=[DataMean.ListGlobalAttribute {'Time','Time_end'}]; 488 end 489 errormsg=struct2nc(fileresult{i_slice},DataMean); %save result file 384 errormsg=struct2nc(OutputFile,DataOut); %save result file 490 385 if isempty(errormsg) 491 display([ fileresult{i_slice}' written']);386 display([OutputFile ' written']); 492 387 else 493 388 msgbox_uvmat('ERROR',['error in writting result file: ' errormsg]) … … 495 390 end 496 391 end % end averaging loop 497 end % end loop on slices 392 end 393 %%%%%%%%%%%%%%%% end loop on slices %%%%%%%%%%%%%%%% 498 394 499 395 %% reproduce ImaDoc/GeometryCalib for image series 500 if isfield(XmlData{1},'GeometryCalib') && ~isempty(XmlData{1}.GeometryCalib)501 [tild,RootFile]=fileparts(filebase_out);502 outputxml=fullfile(pathdir,[RootFile '.xml']);503 errormsg=update_imadoc(XmlData{1}.GeometryCalib,outputxml);% introduce the calibration data in the xml file504 if strcmp(errormsg,'')505 display(['GeometryCalib transferred to ' outputxml])506 else507 msgbox_uvmat('ERROR',errormsg);508 end509 end396 % if isfield(XmlData{1},'GeometryCalib') && ~isempty(XmlData{1}.GeometryCalib) 397 % [tild,RootFile]=fileparts(filebase_out); 398 % outputxml=fullfile(pathdir,[RootFile '.xml']); 399 % errormsg=update_imadoc(XmlData{1}.GeometryCalib,outputxml);% introduce the calibration data in the xml file 400 % if strcmp(errormsg,'') 401 % display(['GeometryCalib transferred to ' outputxml]) 402 % else 403 % msgbox_uvmat('ERROR',errormsg); 404 % end 405 % end 510 406 511 407 %% open the result file with uvmat 512 408 hget_field=findobj(allchild(0),'name','get_field');%find the get_field... GUI 513 409 delete(hget_field) 514 uvmat( fileresult{end})410 uvmat(OutputFile)% open the last result file with uvmat -
trunk/src/series/check_data_files.m
r427 r447 1 % 'check_files': check the existence and status of the files selected by series.fig1 %%'check_files': check the existence, type and status of the files selected by series.fig 2 2 %------------------------------------------------------------------------ 3 % function GUI_input=check_data_files( num_i1,num_i2,num_j1,num_j2,Series)3 % function GUI_input=check_data_files(Param) 4 4 % 5 %%%%%%%%%%% GENERAL TO ALL SERIES ACTION FCTS %%%%%%%%%%%%%%%%%%%%%%%%%%% 5 6 %OUTPUT 6 7 % GUI_input=list of options in the GUI series.fig needed for the function 7 8 % 8 9 %INPUT: 9 %num_i1: series of first indices i (given from the series interface as first_i:incr_i:last_i, mode and list_pair_civ) 10 %num_i2: series of second indices i (given from the series interface as first_i:incr_i:last_i, mode and list_pair_civ) 11 %num_j1: series of first indices j (given from the series interface as first_j:incr_j:last_j, mode and list_pair_civ ) 12 %num_j2: series of second indices j (given from the series interface as first_j:incr_j:last_j, mode and list_pair_civ) 13 %Series: Matlab structure containing information set by the series interface 10 % In run mode, the input parameters are given as a Matlab structure Param copied from the GUI series. 11 % In batch mode, Param is the name of the corresponding xml file containing the same information 12 % In the absence of input (as activated when the current Action is selected 13 % in series), the function ouput GUI_input set the activation of the needed GUI elements 14 14 % 15 function GUI_input=check_data_files(Param) %(filecell,filecell_1,num_i,num_j,vel_type,field,param); 16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 %detect the chosen series of files and check their date of modification: 18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 19 %INPUT: 20 %num_i1: series of first indices i (given from the series interface as first_i:incr_i:last_i, mode and list_pair_civ) 21 %num_i2: series of second indices i (given from the series interface as first_i:incr_i:last_i, mode and list_pair_civ) 22 %num_j1: series of first indices j (given from the series interface as first_j:incr_j:last_j, mode and list_pair_civ ) 23 %num_j2: series of second indices j (given from the series interface as first_j:incr_j:last_j, mode and list_pair_civ) 24 %OTHER INPUTS given by the structure Series 15 % Param contains the elements:(use the menu bar command 'export/GUI config' in series to see the current structure Param) 16 % .InputTable: cell of input file names, (several lines for multiple input) 17 % each line decomposed as {RootPath,SubDir,Rootfile,NomType,Extension} 18 % .OutputSubDir: name of the subdirectory for data outputs 19 % .OutputDir: directory for data outputs, including path 20 % .Action: .ActionName: name of the current activated function 21 % .ActionPath: path of the current activated function 22 % .IndexRange: set the file or frame indices on which the action must be performed 23 % .FieldTransform: .TransformName: name of the selected transform function 24 % .TransformPath: path of the selected transform function 25 % .TransformHandle: corresponding function handle 26 % .InputFields: sub structure describing the input fields withfields 27 % .FieldName: name of the field 28 % .VelType: velocity type 29 % .FieldName_1: name of the second field in case of two input series 30 % .VelType_1: velocity type of the second field in case of two input series 31 % .ProjObject: %sub structure describing a projection object (read from ancillary GUI set_object) 32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 25 33 26 %requests for the visibility of input windows in the GUI series (activated directly by the selection in the menu ACTION) 27 if ~exist('Param','var') 28 GUI_input={'RootPath';'many';...%nbre of possible input series (options 'on'/'two'/'many', default:'one') 29 'SubDir';'on';... % subdirectory of derived files (PIV fields), ('on' by default) 30 'RootFile';'on';... %root input file name ('on' by default) 31 'FileExt';'on';... %input file extension ('on' by default) 32 'NomType';'on';...%type of file indexing ('on' by default) 34 function GUI_input=check_data_files(Param) 35 36 %% set the input elements needed on the GUI series when the action is selected in the menu ActionName 37 if ~exist('Param','var') % case with no input parameter 38 GUI_input={'NbViewMax';'';...% max nbre of input file series (default='' , no limitation) 39 'AllowInputSort';'off';...% allow alphabetic sorting of the list of input files (options 'off'/'on', 'off' by default) 33 40 'NbSlice';'on'; ...%nbre of slices ('off' by default) 34 %'VelTypeMenu';'on';...% menu for selecting the velocity type (civ1,..)'off' by default)35 %'FieldMenu';'on';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)36 %'CoordType';'on'...%can use a transform function 'off' by default37 %'GetObject';'on'...%can use projection object ,'off' by default38 %'GetMask';'on'...%can use mask option ,'off' by default39 %'PARAMETER'; options: name of the user defined parameter',repeat a line for each parameter41 'VelType';'off';...% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) 42 'FieldName';'off';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 43 'FieldTransform'; 'off';...%can use a transform function 44 'ProjObject';'off';...%can use projection object(option 'off'/'on', 45 'Mask';'off';...%can use mask option (option 'off'/'on', 'off' by default) 46 'OutputDirExt';'';...%set the output dir extension 40 47 ''}; 41 return %exit the function48 return 42 49 end 43 50 44 %% input parameters45 % read the xml file for batch case51 %% get input parameters, file names and indices 52 % BATCH case: read the xml file for batch case 46 53 if ischar(Param) && ~isempty(find(regexp('Param','.xml$'))) 47 54 Param=xml2struct(Param); 48 else % RUN case: parameters introduced as the input structure Param 55 checkrun=0; 56 % RUN case: parameters introduced as the input structure Param 57 else 49 58 hseries=guidata(Param.hseries);%handles of the GUI series 50 WaitbarPos=get(hseries.waitbar_frame,'Position'); 59 WaitbarPos=get(hseries.waitbar_frame,'Position');%position of the waitbar on the GUI series 60 checkrun=1; % indicate the RUN option is used 51 61 end 62 % get the set of input file names (cell array filecell), and the lists of 63 % input file or frame indices i1_series,i2_series,j1_series,j2_series 52 64 [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param); 65 % filecell{iview,fileindex}: cell array representing the list of file names 66 % iview: line in the table corresponding to a given file series 67 % fileindex: file index within the file series, 68 % i1_series(iview,ref_j,ref_i)... are the corresponding arrays of indices i1,i2,j1,j2, depending on the input line iview and the two reference indices ref_i,ref_j 69 % i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices 70 % set of frame indices used for movie or multimage input 71 if ~isempty(j1_series) 72 frame_index=j1_series; 73 else 74 frame_index=i1_series; 75 end 53 76 77 %% root input file(s) and type 78 RootPath=Param.InputTable(:,1); 79 RootFile=Param.InputTable(:,3); 80 SubDir=Param.InputTable(:,2); 81 NomType=Param.InputTable(:,4); 82 FileExt=Param.InputTable(:,5); 54 83 55 %%%%%%%%%%%%%%%%%%%%%%%% 84 % numbers of slices and file indices 85 NbSlice=1;%default 86 if isfield(Param.IndexRange,'NbSlice') 87 NbSlice=Param.IndexRange.NbSlice; 88 end 89 nbview=size(i1_series,1);%number of input file series (lines in InputTable) 90 nbfield_j=size(i1_series,2); %nb of consecutive fields at each level(burst 91 nbfield=nbfield_j*size(i1_series,3); %total number of files or frames 92 nbfield_i=floor(nbfield/NbSlice);%total number of i indexes (adjusted to an integer number of slices) 93 nbfield=nbfield_i*nbfield_j; %total number of fields after adjustement 56 94 57 % number of slices 58 NbSlice=Param.NbSlice; 59 if isempty(NbSlice),NbSlice=1; end; %default 95 %determine the file type on each line from the first input file 96 ImageTypeOptions={'image','multimage','mmreader','video'}; 97 NcTypeOptions={'netcdf','civx','civdata'}; 98 for iview=1:nbview 99 [FileType{iview},FileInfo{iview},Object{iview}]=get_file_type(filecell{iview,1}); 100 CheckImage{iview}=~isempty(find(strcmp(FileType{iview},ImageTypeOptions)));% =1 for images 101 CheckNc{iview}=~isempty(find(strcmp(FileType{iview},NcTypeOptions)));% =1 for netcdf files 102 end 60 103 61 %% root input file and type 62 RootPath=Param.InputTable(:,1); 63 RootFile=Param.InputTable(:,3); 64 SubDir=Param.InputTable(:,2); 65 NomType=Param.InputTable(:,4); 66 FileExt=Param.InputTable(:,5); 67 % number of views 68 count=0; 69 nbview=numel(RootFile); 70 104 %% MAIN LOOP ON VIEWS (INPUT LINES) 71 105 for iview=1:nbview 72 filebase=fullfile(RootPath{iview},RootFile{iview});%root file name 73 % if testcell 74 % num_i1=num_i1_cell{iview}; num_i2=num_i2_cell{iview}; num_j1=num_j1_cell{iview}; num_j2=num_j2_cell{iview}; 75 % else 76 % num_i1=num_i1_cell; num_i2=num_i2_cell; num_j1=num_j1_cell; num_j2=num_j2_cell; 77 % end 78 % siz=size(num_i1); 79 nbfield=size(i1_series{iview},1); 80 nbfield2=size(i1_series{iview},2); %nb of consecutive fields at each level(burst 81 nbfield=numel(i1_series{iview}); 82 nbfield=floor(nbfield/(nbfield2*NbSlice));%total number of i indexes (adjusted to an integer number of slices) 83 if isequal(lower(FileExt{iview}),'.avi') 84 info=aviinfo([filebase FileExt{iview}]); 106 if isequal(FileType{iview},'mmreader')||isequal(FileType{iview},'video') 107 info=aviinfo(filecell{iview,1}); 85 108 message{1}=info.Filename; 86 109 message{2}=info.FileModDate; … … 95 118 %LOOP ON SLICES 96 119 for i_slice=1:NbSlice 97 for ifield=1:nbfield 98 indselect(:,ifield)=((ifield-1)*NbSlice+(i_slice-1))*nbfield2+[1:nbfield2]';%selected indices on the list of files of a slice 99 end 120 index_slice=i_slice:NbSlice:nbfield; 100 121 filefound={}; 101 for index=1:nbfield*nbfield2 122 for ifile=1:nbfield_i 123 % index(ifile)=index_slice(ifile); 102 124 stopstate=get(hseries.RUN,'BusyAction'); 103 125 if isequal(stopstate,'queue')% enable STOP command 104 update_waitbar(hseries.waitbar_frame,WaitbarPos,index/(nbfield*nbfield2)) 105 ifile=indselect(index); 106 % file=... 107 % name_generator(filebase,num_i1(ifile),num_j1(ifile),FileExt{iview},NomType{iview},1,num_i2(ifile),num_j2(ifile),SubDir{iview}); 108 file=filecell{iview,ifile}; 126 update_waitbar(hseries.waitbar_frame,WaitbarPos,ifile/nbfield_i) 127 file=filecell{iview,index_slice(ifile)}; 109 128 [Path,Name,ext]=fileparts(file); 110 129 detect=exist(file,'file'); % check the existence of the file … … 129 148 end 130 149 Tabchar(1,i_slice)={['slice #' num2str(i_slice)]}; 131 Tabchar(i ndex+1,i_slice)={[file '...' lastfield]};150 Tabchar(ifile+1,i_slice)={[file '...' lastfield]}; 132 151 end 133 152 end … … 148 167 end 149 168 if ~isempty(Tabchar) 150 Tabchar=reshape(Tabchar,NbSlice*(nbfield *nbfield2+1),1);169 Tabchar=reshape(Tabchar,NbSlice*(nbfield_i+1),1); 151 170 end 152 171 end -
trunk/src/series/ima_levels.m
r442 r447 16 16 %requests for the visibility of input windows in the GUI series (activated directly by the selection in the menu ACTION) 17 17 if ~exist('Param','var') 18 GUI_input={ };18 GUI_input={'OutputDirExt';'.lev'}; 19 19 return %exit the function 20 20 end … … 90 90 case {'video','mmreader'} 91 91 A=read(MovieObject,i1_series{1}(jfile,ifile)); 92 if strcmp(NomType,'*') 93 A=read(MovieObject,i1_series{1}(jfile,ifile)); 94 NomType_out='_1'; 95 else 96 A=imread(filename,j1_series{1}(jfile,ifile)); 97 NomType_out='_1_1'; 98 end 92 99 case {'vol','image'} 93 100 A=imread(filename); 101 NomType_out='_1'; 94 102 case 'multimage' 95 A=imread(filename,i1_series{1}(jfile,ifile)); 103 if strcmp(NomType,'*') 104 A=imread(filename,i1_series{1}(jfile,ifile)); 105 NomType_out='_1'; 106 else 107 A=imread(filename,j1_series{1}(jfile,ifile)); 108 NomType_out='_1_1'; 109 end 96 110 end 97 111 C=levels(A); 98 filename_new=fullfile_uvmat(RootPath,SubdirResult,RootFile,'.png',NomType ,i1_series{1}(jfile,ifile),[],j1_series{1}(jfile,ifile));112 filename_new=fullfile_uvmat(RootPath,SubdirResult,RootFile,'.png',NomType_out,i1_series{1}(jfile,ifile),[],j1_series{1}(jfile,ifile)); 99 113 imwrite(C,filename_new) 100 114 display([filename_new ' written']) -
trunk/src/series/merge_proj.m
r427 r447 29 29 'CoordType';'on';...%can use a transform function 'off' by default 30 30 'GetObject';'on';...%can use projection object ,'off' by default 31 'OutputDirExt';'.proj';... 31 32 %'GetMask';'on'...%can use mask option ,'off' by default 32 33 %'PARAMETER'; options: name of the user defined parameter',repeat a line for each parameter -
trunk/src/series/sub_background.m
r442 r447 43 43 'NomType';'on';...%type of file indexing ('on' by default) 44 44 'NbSlice';'on'; ...%nbre of slices ('off' by default) 45 'OutputDirExt';'.sbk';... 45 46 %'VelTypeMenu';'on';...% menu for selecting the velocity type (civ1,..)('off' by default) 46 47 %'FieldMenu';'on';...% menu for selecting the velocity field (s) in the input file ('off' by default) … … 70 71 dir_images=Param.InputTable{1,1}; 71 72 NomType=Param.InputTable{1,4}; 73 SubDir=Param.InputTable{1,2}; 72 74 FileExt=Param.InputTable{1,5}; 73 [filecell,i1_series,tild,j1_series]=get_file_series(Param);%generates the set 74 of input file names 75 [filecell,i1_series,tild,j1_series]=get_file_series(Param);%generates the set of input file names 75 76 if size(filecell,1)>1 76 77 msgbox_uvmat('WARNING','This function uses only the first input image series') … … 211 212 %% update the xml file 212 213 SubDirBase=regexprep(Param.InputTable{1,2},'\..*','');%take the root part of SubDir, before the first dot '.' 213 filexml=ful fille(Param.InputTable{1,1},[SubDirBase '.xml']);214 filexml=fullfile(Param.InputTable{1,1},[SubDirBase '.xml']); 214 215 if ~exist(filexml,'file') && exist([filebase '.xml'],'file')% xml inside the image directory 215 216 copyfile([filebase '.xml'],filexml);% copy the .xml file 216 217 end 217 218 if exist(filexml,'file') 218 t=xmltree( [filexml '.xml']);219 t=xmltree(filexml); 219 220 %update information on the first image name in the series 220 221 uid_Heading=find(t,'ImaDoc/Heading'); … … 306 307 if checkrun 307 308 stopstate=get(hseries.RUN,'BusyAction'); 308 update_waitbar(hseries.waitbar,WaitbarPos,(ifield+(islice-1)*nbfield_slice)/(nbfield_slice*nbslice_i)) 309 display((ifield+(islice-1)*nbfield_slice)/(nbfield_slice*nbslice_i)) 309 update_waitbar(hseries.waitbar_frame,WaitbarPos,(ifield+(islice-1)*nbfield_slice)/(nbfield_slice*nbslice_i)) 310 310 else 311 311 stopstate='queue'; … … 316 316 for iburst=1:step 317 317 ifile=indselect(ifield+step*floor(nbaver/2)+iburst-1); 318 filename=fullfile_uvmat(Param.InputTable{1,1},Sub dir,Param.InputTable{1,3},FileExt,NomType,num_i1(ifile),[],num_j1(ifile));318 filename=fullfile_uvmat(Param.InputTable{1,1},SubDir,Param.InputTable{1,3},FileExt,NomType,i1_series{1}(ifile),[],j1_series{1}(ifile)); 319 319 %filename=name_generator(filebase,num_i1(ifile),num_j1(ifile),FileExt,NomType); 320 Aread=read_image(filename,FileType, num_i1(ifile),MovieObject);320 Aread=read_image(filename,FileType,i1_series{1}(ifile),MovieObject); 321 321 Ak(:,:,nbaver_ima-step+iburst)=Aread; 322 322 end -
trunk/src/series/time_series.m
r442 r447 27 27 'CoordType';'on';...%can use a transform function 'off' by default 28 28 'GetObject';'on';...%can use projection object ,'off' by default 29 'OutputDirExt';'.series'... 29 30 %'GetMask';'on'...%can use mask option ,'off' by default 30 31 %'PARAMETER'; options: name of the user defined parameter',repeat a line for each parameter … … 462 463 %remove time for global attributes if exists 463 464 Time_index=find(strcmp('Time',RecordData.ListGlobalAttribute)); 464 if ~isempty(Time_ search)465 if ~isempty(Time_index) 465 466 RecordData.ListGlobalAttribute(Time_index)=[]; 466 467 end 467 468 RecordData.Conventions='uvmat'; 468 % for iattr=1:numel(RecordData.ListGlobalAttribute)469 % if strcmp(RecordData.ListGlobalAttribute{iattr},'Time')470 % RecordData.ListGlobalAttribute(iattr)=[];471 % break472 % end473 % end474 469 for ivar=1:numel(RecordData.ListVarName) 475 470 VarName=RecordData.ListVarName{ivar};
Note: See TracChangeset
for help on using the changeset viewer.