- Timestamp:
- Mar 14, 2011, 4:50:31 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/merge_proj.m
r169 r222 1 1 2 %'merge_proj': project and concatene fields, used with series.fig 2 3 %------------------------------------------------------------------------ … … 39 40 40 41 41 42 %projection object 42 %% projection object 43 43 test_object=get(hseries.GetObject,'Value'); 44 44 if test_object … … 49 49 return 50 50 end 51 if ~isequal(ProjObject.Style,'plane') 52 msgbox_uvmat('ERROR','The projection object must be a plane ')51 if ~isequal(ProjObject.Style,'plane')|| isequal(ProjObject.ProjMode,'projection') 52 msgbox_uvmat('ERROR','The projection object must be a plane with projection mode interp or filter') 53 53 return 54 54 end 55 %answeryes=questdlg({['field series projected on ' Series.ProjObject.Style]});56 55 answeryes=msgbox_uvmat('INPUT_Y-N',['field series projected on ' ProjObject.Style]); 57 56 if ~isequal(answeryes,'Yes') … … 60 59 end 61 60 62 % numbers of view fields (nbre of inputs in RootPath)61 %% numbers of view fields (nbre of inputs in RootPath) 63 62 testcell=iscell(Series.RootFile); 64 63 if ~testcell … … 75 74 nbview=length(Series.RootFile);%number of views (file series to merge) 76 75 nbfield=size(num_i1{1},1)*size(num_i1{1},2);%number of fields in the time series 77 % transform=Series.CoordType; % field transform function78 76 hhh=which('mmreader'); 79 77 for iview=1:nbview … … 87 85 end 88 86 89 %Calibration data and timing: read the ImaDoc files 90 % mode=''; %default 87 %% Calibration data and timing: read the ImaDoc files 91 88 timecell={}; 92 89 itime=0; … … 131 128 end 132 129 133 % check coincidence in time130 %% check coincidence in time 134 131 multitime=0; 135 132 if isempty(timecell) … … 161 158 end 162 159 163 % coordinate transform or other user defined transform160 %% coordinate transform or other user defined transform 164 161 transform_fct=[];%default 165 162 if isfield(Series,'transform_fct') … … 167 164 end 168 165 169 % Field and velocity type (the same for all views)166 %% Field and velocity type (the same for all views) 170 167 FieldName=''; 171 168 if strcmp(get(hseries.FieldMenu,'Visible'),'on') … … 212 209 end 213 210 214 %name of output files and directory: 215 % res_subdir=fullfile(Series.RootPath{1},[Series.SubDir{1} '_STAT']); 211 %% name of output files and directory: 216 212 ProjectDir=fileparts(fileparts(Series.RootPath{1}));% preoject directory (GERK) 217 213 prompt={['result directory (in' ProjectDir ')']}; … … 263 259 filebase_merge=fullfile(res_subdir,'merged');%root name for the merged files 264 260 265 %MAIN LOOP261 %% MAIN LOOP 266 262 for ifile=1:nbfield 267 263 stopstate=get(hseries.RUN,'BusyAction'); 268 264 if isequal(stopstate,'queue')% enable STOP command from the 'series' interface 269 265 update_waitbar(hseries.waitbar,WaitbarPos,ifile/nbfield) 270 % Amerge=0;271 266 272 %----------LOOP ON VIEWS----------------------267 %% ----------LOOP ON VIEWS---------------------- 273 268 nbtime=0; 274 269 for iview=1:nbview 275 270 %name of the current file 276 271 filename=name_generator(filebase{iview},num_i1{iview}(ifile),num_j1{iview}(ifile),Series.FileExt{iview},Series.NomType{iview},1,num_i2{iview}(ifile),num_j2{iview}(ifile),SubDir{iview}); 277 272 if ~exist(filename,'file') … … 279 274 break 280 275 end 281 282 %reading the current file 276 %reading the current file 283 277 if testima 284 278 if test_movie(iview) … … 311 305 end 312 306 end 313 % coord transform314 % z index315 316 307 if ~isempty(NbSlice_calib) 317 308 Field{iview}.ZIndex=mod(num_i1{iview}(ifile)-1,NbSlice_calib{1})+1; 318 309 end 319 % Field{iview}.ZIndex=1; 310 %transform the input field (e.g; phys) if requested 320 311 if ~isempty(transform_fct) 321 312 Field{iview}=transform_fct(Field{iview},XmlData{iview}); %transform to phys if requested … … 324 315 Field{iview}=calc_field(FieldName,Field{iview}); 325 316 end 326 327 %projection on object (gridded plane) 317 %projection on object (gridded plane) 328 318 if test_object 329 319 Field{iview}=proj_field(Field{iview},ProjObject); 330 320 end 331 321 end 332 322 %----------END LOOP ON VIEWS---------------------- 333 323 334 % merge the nbview fields324 %% merge the nbview fields 335 325 MergeData=merge_field(Field); 336 326 if isfield(MergeData,'Txt') 337 327 msgbox_uvmat('ERROR',MergeData.Txt) 338 328 return 339 end 340 341 % generating the name of the merged field 329 end 330 % generating the name of the merged field 342 331 mergename=name_generator(filebase_merge,num_i1{iview}(ifile),num_j1{iview}(ifile),Series.FileExt{iview},Series.NomType{iview},1,num_i2{iview}(ifile),num_j2{iview}(ifile)); 343 332 344 % time:333 % time of the merged field: 345 334 time_i=0;%default 346 335 if isempty(time)% time from ImaDoc prevails … … 350 339 end 351 340 352 341 % recording the merged field 353 342 if testima %in case of input images an image is produced 354 343 if isa(MergeData.A,'uint8') … … 402 391 MergeData.dt=dt; 403 392 end 404 %MergeData.dt=1;405 393 MergeData.Time=time_i; 406 394 error=struct2nc(mergename,MergeData);%save result file … … 414 402 end 415 403 416 %-------------------------------------------------------------------------- 404 %'merge_field': concatene fields 405 %------------------------------------------------------------------------ 417 406 function MergeData=merge_field(Data) 418 % initiate Matlab structure for physical field407 %% default output 419 408 if isempty(Data)||~iscell(Data) 420 409 MergeData=[]; … … 427 416 return 428 417 end 429 % for iview=1:nbview 430 % if ~isequal(MergeData.ListDimName,Data{iview}.ListDimName) 431 % error=1; 432 % end 433 % if ~isequal(MergeData.ListVarName,Data{iview}.ListVarName) 434 % error=1; 435 % end 436 % end 437 % if error 438 % MergeData.Txt='ERROR: attempt at merging fields of incompatible type'; 439 % return 440 % end 441 % 442 %group the variables (fields of 'FieldData') in cells of variables with the same dimensions 418 419 %% group the variables (fields of 'FieldData') in cells of variables with the same dimensions 443 420 [CellVarIndex,NbDim,VarTypeCell]=find_field_indices(Data{1}); 444 421 %LOOP ON GROUPS OF VARIABLES SHARING THE SAME DIMENSIONS … … 500 477 end 501 478 end 479 502 480
Note: See TracChangeset
for help on using the changeset viewer.