Changeset 1164 for trunk/src/series/civ_series.m
- Timestamp:
- Jul 29, 2024, 9:43:17 AM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/civ_series.m
r1163 r1164 117 117 if Param.ActionInput.CheckCiv1 118 118 iview_A=1;% usual PIV, the image series is on the first line of the table 119 else if Param.ActionInput.CheckCiv2 % civ2 is performed without Civ1, a netcdf file series is needed in the first table line120 iview_A=2;% the second line is used for the input images of Civ2119 else % Civ1 has been already stored in a netcdf file input 120 iview_A=2;% the second line is used for the input images 121 121 end 122 122 if iview_A~=0 … … 274 274 tstart=tic; 275 275 time_civ1=0; 276 time_patch1=0;277 time_civ2=0;278 time_patch2=0;276 time_patch1=0; 277 time_civ2=0; 278 time_patch2=0; 279 279 if ~isempty(RUNHandle)% update the waitbar in interactive mode with GUI series (checkrun=1) 280 280 update_waitbar(WaitbarHandle,ifield/NbField) … … 335 335 %% Civ1 336 336 % if Civ1 computation is requested 337 if isfield (Param.ActionInput,'Civ1')337 if Param.ActionInput.CheckCiv1 338 338 if CheckInputFile 339 339 disp('civ1 started') … … 377 377 end 378 378 ImageName_B=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_series_Civ1(ifield),[],j2_series_Civ1(ifield)); 379 380 381 382 383 384 385 386 387 379 if isempty(FileType_B)% determine the image type for the first field 380 [FileInfo_B,VideoObject_B]=get_file_info(ImageName_B); 381 FileType_B=FileInfo_B.FileType; 382 end 383 if isempty(regexp(ImageName_B,'(^http://)|(^https://)', 'once')) && ~exist(ImageName_B,'file') 384 disp([ImageName_B ' missing']) 385 continue 386 end 387 [par_civ1.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B_Civ1(ifield)); 388 388 catch ME % display errors in reading input images 389 389 if ~isempty(ME.message) … … 392 392 end 393 393 end 394 394 395 % par_civ1.ImageWidth=size(par_civ1.ImageA,2); 395 396 % par_civ1.ImageHeight=size(par_civ1.ImageA,1); … … 425 426 end 426 427 Data.ListGlobalAttribute=[ListGlobalAttribute Civ1_param]; 428 427 429 Data.CivStage=1; 428 430 else … … 438 440 Data.VarAttribute{5}.Role='ancillary'; 439 441 Data.VarAttribute{6}.Role='errorflag'; 440 442 441 443 % case of mask 442 444 if par_civ1.CheckMask&&~isempty(par_civ1.Mask) … … 451 453 i1_mask=mod(i1-1,par_civ1.NbSlice)+1; 452 454 maskname=fullfile_uvmat(RootPath_mask,SubDir_mask,RootFile_mask,Ext_mask,'_1',i1_mask); 453 else 454 maskname=Param.ActionInput.Civ1.Mask; 455 end 456 if strcmp(maskoldname,maskname)% mask exist, not already read in civ1 457 par_civ1.Mask=mask; %use mask already opened 458 else 459 if ~isempty(regexp(maskname,'(^http://)|(^https://)', 'once'))|| exist(maskname,'file') 460 try 461 par_civ1.Mask=imread(maskname);%update the mask, an store it for future use 462 catch ME 463 if ~isempty(ME.message) 464 errormsg=['error reading input image: ' ME.message]; 465 disp_uvmat('ERROR',errormsg,checkrun) 466 return 467 end 455 if strcmp(Param.ActionInput.PairIndices.ListPairMode,'series(Di)')% case of volume, mask index refers to j index 456 par_civ1.NbSlice_j=par_civ1.NbSlice; 457 end 458 end 459 else 460 maskname=Param.ActionInput.Civ1.Mask; 461 end 462 if strcmp(maskoldname,maskname)% mask exist, not already read in civ1 463 par_civ1.Mask=mask; %use mask already opened 464 else 465 if ~isempty(regexp(maskname,'(^http://)|(^https://)', 'once'))|| exist(maskname,'file') 466 try 467 par_civ1.Mask=imread(maskname);%update the mask, an store it for future use 468 catch ME 469 if ~isempty(ME.message) 470 errormsg=['error reading input image: ' ME.message]; 471 disp_uvmat('ERROR',errormsg,checkrun) 472 return 468 473 end 469 else 470 par_civ1.Mask=[]; 471 end 472 mask=par_civ1.Mask; 473 maskoldname=maskname; 474 end 475 end 476 474 end 475 else 476 par_civ1.Mask=[]; 477 end 478 mask=par_civ1.Mask; 479 maskoldname=maskname; 480 end 481 482 477 483 % case of input grid 478 484 if par_civ1.CheckGrid &&~isempty(par_civ1.Grid) … … 481 487 par_civ1.CorrBoxSize=GridData.CorrBox; 482 488 end 483 484 % caluclate velocity data 489 490 % caluclate velocity data 485 491 tstart_civ1=tic; 486 492 [Data.Civ1_X,Data.Civ1_Y,Data.Civ1_U,Data.Civ1_V,Data.Civ1_C,Data.Civ1_FF, result_conv, errormsg] = civ (par_civ1); … … 489 495 return 490 496 end 491 492 else% we use existing Civ1 data 497 493 498 if exist('ncfile','var') 494 499 CivFile=ncfile; 495 [Data,tild,tild,errormsg]=nc2struct(CivFile,'ListGlobalAttribute','absolut_time_T0'); %look for the constant 'absolut_time_T0' to detect old civx data format496 if ~isempty(errormsg)497 disp_uvmat('ERROR',errormsg,checkrun)498 return499 end500 % [Data,tild,tild,errormsg]=nc2struct(CivFile,'ListGlobalAttribute','absolut_time_T0'); %look for the constant 'absolut_time_T0' to detect old civx data format 501 % if ~isempty(errormsg) 502 % disp_uvmat('ERROR',errormsg,checkrun) 503 % return 504 % end 500 505 [Data,tild,tild,errormsg]=nc2struct(CivFile);%read civ1 and fix1 data in the existing netcdf file 501 506 elseif isfield(Param,'Civ1_X') … … 510 515 end 511 516 end 517 512 518 513 519 %% Fix1 … … 717 723 i1_mask=mod(i1-1,par_civ2.NbSlice)+1; 718 724 maskname=fullfile_uvmat(RootPath_mask,SubDir_mask,RootFile_mask,Ext_mask,'_1',i1_mask); 725 if strcmp(Param.ActionInput.PairIndices.ListPairMode,'series(Di)')% case of volume, mask index refers to j index 726 par_civ2.NbSlice_j=par_civ2.NbSlice; 727 end 719 728 else 720 729 maskname=Param.ActionInput.Civ2.Mask; … … 876 885 if isempty(errormsg) 877 886 disp([ncfile_out ' written']) 878 %[success,msg] = fileattrib(ncfile_out ,'+w','g');% done in struct2nc879 887 else 880 888 disp(errormsg)
Note: See TracChangeset
for help on using the changeset viewer.