Changeset 1200 for trunk/src/series/civ_series.m
- Timestamp:
- Mar 20, 2026, 4:42:36 PM (22 hours ago)
- File:
-
- 1 edited
-
trunk/src/series/civ_series.m (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/civ_series.m
r1199 r1200 392 392 [par_civ1.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B); 393 393 394 % catch ME % display errors in reading input images395 % if ~isempty(ME.message)396 % disp_uvmat('ERROR', ['error reading input image: ' ME.message],checkrun)397 % continue398 % end399 % end400 394 401 395 % case of background image to subtract 402 396 if par_civ1.CheckBackground &&~isempty(par_civ1.Background) 403 397 [RootPath_background,SubDir_background,RootFile_background,~,~,~,~,Ext_background]=fileparts_uvmat(Param.ActionInput.Civ1.Background); 404 if ~isempty(i2_series_Civ1)% case of volume,backgrounds act on different j levels398 if strcmp(NomTypeNc,'_1-2_1')% case of volume,backgrounds act on different j levels 405 399 backgroundname=fullfile_uvmat(RootPath_background,SubDir_background,RootFile_background,Ext_background,'_1',j1_series_Civ1(ifield)); 406 elseif isfield(par_civ1,'NbSlice') 400 elseif isfield(par_civ1,'NbSlice')&& ~isequal(par_civ1.NbSlice,1) 407 401 i1_background=mod(i1-1,par_civ1.NbSlice)+1; 408 402 backgroundname=fullfile_uvmat(RootPath_background,SubDir_background,RootFile_background,Ext_background,'_1',i1_background); … … 418 412 if ~isempty(regexp(backgroundname,'(^http://)|(^https://)', 'once'))|| exist(backgroundname,'file') 419 413 try 420 par_civ1.Background= imread(backgroundname);%update the background, an store it for future use414 par_civ1.Background=uint16(imread(backgroundname));%update the background, an store it for future use 421 415 catch ME 422 416 if ~isempty(ME.message) … … 432 426 backgroundoldname=backgroundname; 433 427 end 434 par_civ1.ImageA= par_civ1.ImageA-par_civ1.Background;435 par_civ1.ImageB= par_civ1.ImageB-par_civ1.Background;428 par_civ1.ImageA=uint16(par_civ1.ImageA)-par_civ1.Background; 429 par_civ1.ImageB=uint16(par_civ1.ImageB)-par_civ1.Background; 436 430 end 437 431 … … 496 490 if ~isempty(i2_series_Civ1)&& ~isequal(i1_series_Civ1,i2_series_Civ1)% case of volume,masks act on different j levels 497 491 maskname=fullfile_uvmat(RootPath_mask,SubDir_mask,RootFile_mask,Ext_mask,'_1',j1); 498 elseif isfield(par_civ1,'NbSlice') 492 elseif isfield(par_civ1,'NbSlice')&& ~isequal(par_civ1.NbSlice,1) 499 493 i1_mask=mod(i1-1,par_civ1.NbSlice)+1; 500 494 maskname=fullfile_uvmat(RootPath_mask,SubDir_mask,RootFile_mask,Ext_mask,'_1',i1_mask); … … 638 632 if strcmp(ImageName_A_Civ2,ImageName_A) && isequal(FrameIndex_A,FrameIndex_A_2) 639 633 par_civ2.ImageA=par_civ1.ImageA; 634 CheckDuplicate_1to2A=true; 640 635 else 641 636 [par_civ2.ImageA,VideoObject_A] = read_image(ImageName_A_Civ2,FileType_A,VideoObject_A,FrameIndex_A_2); 637 CheckDuplicate_1to2A=false; 642 638 end 643 639 if CheckRelabel … … 650 646 if strcmp(ImageName_B_Civ2,ImageName_B) && isequal(FrameIndex_B_2,FrameIndex_B) 651 647 par_civ2.ImageB=par_civ1.ImageB; 648 CheckDuplicate_1to2B=true; 652 649 else 653 650 [par_civ2.ImageB,VideoObject_B] = read_image(ImageName_B_Civ2,FileType_B,VideoObject_B,FrameIndex_B_2); 651 CheckDuplicate_1to2B=false; 654 652 end 655 653 % [FileInfo_A,VideoObject_A]=get_file_info(ImageName_A_Civ2); … … 673 671 end 674 672 675 % %% user defined image transform 676 % if ~isempty(transform_fct) 677 % par_civ2 =transform_fct(par_civ2,Param); 678 % end 673 %% case of background image to subtract, if images civ2 different from civ1 674 if (~CheckDuplicate_1to2A || ~CheckDuplicate_1to2B) && par_civ2.CheckBackground &&~isempty(par_civ2.Background) 675 [RootPath_background,SubDir_background,RootFile_background,~,~,~,~,Ext_background]=fileparts_uvmat(Param.ActionInput.Civ2.Background); 676 j1=1; 677 if ~isempty(j1_series_Civ2) 678 j1=j1_series_Civ2(ifield); 679 end 680 if ~isempty(i2_series_Civ2)% case of volume,backgrounds act on different j levels 681 backgroundname=fullfile_uvmat(RootPath_background,SubDir_background,RootFile_background,Ext_background,'_1',j1); 682 elseif isfield(par_civ2,'NbSlice') && ~isequal(par_civ2.NbSlice,1) 683 i1_background=mod(i1-1,par_civ2.NbSlice)+1; 684 backgroundname=fullfile_uvmat(RootPath_background,SubDir_background,RootFile_background,Ext_background,'_1',i1_background); 685 if strcmp(Param.ActionInput.PairIndices.ListPairMode,'series(Di)')% case of volume, background index refers to j index 686 par_civ2.NbSlice_j=par_civ2.NbSlice; 687 end 688 else 689 backgroundname=Param.ActionInput.Civ2.Background; 690 end 691 if strcmp(backgroundoldname,backgroundname)% background exist, not already read in civ2 692 par_civ2.Background=background; %use background already opened 693 else 694 if ~isempty(regexp(backgroundname,'(^http://)|(^https://)', 'once'))|| exist(backgroundname,'file') 695 try 696 par_civ2.Background=uint16(imread(backgroundname));%update the background, an store it for future use 697 catch ME 698 if ~isempty(ME.message) 699 errormsg=['error reading input image: ' ME.message]; 700 disp_uvmat('ERROR',errormsg,checkrun) 701 return 702 end 703 end 704 else 705 par_civ2.Background=[]; 706 end 707 background=par_civ2.Background; 708 backgroundoldname=backgroundname; 709 end 710 if ~CheckDuplicate_1to2A 711 par_civ2.ImageA=uint16(par_civ2.ImageA)-par_civ2.Background; 712 end 713 if ~CheckDuplicate_1to2B 714 par_civ2.ImageB=uint16(par_civ2.ImageB)-par_civ2.Background; 715 end 716 end 717 679 718 %% case of image luminosity rescaling 680 if par_civ2.CheckRescale &&~isempty(par_civ2.Maxtanh) 681 par_civ2.ImageA =par_civ2.Maxtanh*tanh(double(par_civ2.ImageA)/par_civ2.Maxtanh); 682 par_civ2.ImageB=par_civ2.Maxtanh*tanh(double(par_civ2.ImageB)/par_civ2.Maxtanh); 719 if par_civ2.CheckRescale && ~isempty(par_civ2.Maxtanh) 720 if ~CheckDuplicate_1to2A %if the image A is different from civ1 721 par_civ2.ImageA =par_civ2.Maxtanh*tanh(double(par_civ2.ImageA)/par_civ2.Maxtanh); 722 end 723 if ~CheckDuplicate_1to2B % if the image B is different from civ1 724 par_civ2.ImageB=par_civ2.Maxtanh*tanh(double(par_civ2.ImageB)/par_civ2.Maxtanh); 725 end 683 726 end 684 727 … … 761 804 end 762 805 maskname=fullfile_uvmat(RootPath_mask,SubDir_mask,RootFile_mask,Ext_mask,'_1',j1); 763 elseif isfield(par_civ2,'NbSlice') 806 elseif isfield(par_civ2,'NbSlice')&& ~isequal(par_civ2.NbSlice,1) 764 807 i1=i1_series_Civ2(ifield); 765 808 i1_mask=mod(i1-1,par_civ2.NbSlice)+1; … … 794 837 end 795 838 796 % case of background image to subtract 797 if par_civ2.CheckBackground &&~isempty(par_civ2.Background) 798 [RootPath_background,SubDir_background,RootFile_background,~,~,~,~,Ext_background]=fileparts_uvmat(Param.ActionInput.Civ1.Background); 799 j1=1; 800 if ~isempty(j1_series_Civ1) 801 j1=j1_series_Civ1(ifield); 802 end 803 if ~isempty(i2_series_Civ1)% case of volume,backgrounds act on different j levels 804 backgroundname=fullfile_uvmat(RootPath_background,SubDir_background,RootFile_background,Ext_background,'_1',j1); 805 elseif isfield(par_civ2,'NbSlice') 806 i1_background=mod(i1-1,par_civ2.NbSlice)+1; 807 backgroundname=fullfile_uvmat(RootPath_background,SubDir_background,RootFile_background,Ext_background,'_1',i1_background); 808 if strcmp(Param.ActionInput.PairIndices.ListPairMode,'series(Di)')% case of volume, background index refers to j index 809 par_civ2.NbSlice_j=par_civ2.NbSlice; 810 end 811 else 812 backgroundname=Param.ActionInput.Civ1.Background; 813 end 814 if strcmp(backgroundoldname,backgroundname)% background exist, not already read in civ2 815 par_civ2.Background=background; %use background already opened 816 else 817 if ~isempty(regexp(backgroundname,'(^http://)|(^https://)', 'once'))|| exist(backgroundname,'file') 818 try 819 par_civ2.Background=imread(backgroundname);%update the background, an store it for future use 820 catch ME 821 if ~isempty(ME.message) 822 errormsg=['error reading input image: ' ME.message]; 823 disp_uvmat('ERROR',errormsg,checkrun) 824 return 825 end 826 end 827 else 828 par_civ2.Background=[]; 829 end 830 background=par_civ2.Background; 831 backgroundoldname=backgroundname; 832 end 833 par_civ2.ImageA=par_civ2.ImageA-par_civ2.Background; 834 par_civ2.ImageB=par_civ2.ImageB-par_civ2.Background; 835 end 836 839 %% get civ2 correlation parameters 837 840 if strcmp(Param.ActionInput.ListCompareMode,'displacement') 838 841 Civ1_Dt=1; … … 852 855 end 853 856 854 % calculate velocity data (y and v in image indices, reverse to y component) 855 857 % calculate velocity data 856 858 [Civ_X,Civ_Y,Civ_U,Civ_V,Civ_C,Civ_FF,~, errormsg] = civ (par_civ2); 857 859 Civ_X_shifted=Civ_X-0.5+Civ_U/2;% get the exact positions … … 878 880 Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ2_param]; 879 881 880 % nbvar=numel(Data.ListVarName);881 % define the Civ2 variable (if Civ2 data are not replaced from previous calculation)882 % if isempty(find(strcmp('Civ2_X',Data.ListVarName),1))883 % Data.ListVarName=[Data.ListVarName {'Civ2_X','Civ2_Y','Civ2_U','Civ2_V','Civ2_C','Civ2_FF'}];% cell array containing the names of the fields to record884 % Data.VarDimName=[Data.VarDimName {'nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2'}];885 % Data.VarAttribute{nbvar+1}.Role='coord_x';886 % Data.VarAttribute{nbvar+2}.Role='coord_y';887 % Data.VarAttribute{nbvar+3}.Role='vector_x';888 % Data.VarAttribute{nbvar+4}.Role='vector_y';889 % Data.VarAttribute{nbvar+5}.Role='ancillary';890 % Data.VarAttribute{nbvar+6}.Role='errorflag';891 % end892 882 disp('civ2 performed') 893 883 time_civ2=toc(tstart_civ2); … … 930 920 end 931 921 Data.ListGlobalAttribute=[Data.ListGlobalAttribute Patch2_param]; 932 933 % nbvar=length(Data.ListVarName);934 % Data.ListVarName=[Data.ListVarName {'Civ2_U_smooth','Civ2_V_smooth','Civ2_SubRange','Civ2_NbCentres','Civ2_Coord_tps','Civ2_U_tps','Civ2_V_tps'}];935 % Data.VarDimName=[Data.VarDimName {'nb_vec_2','nb_vec_2',{'nb_coord','nb_bounds','nb_subdomain_2'},{'nb_subdomain_2'},...936 % {'nb_tps_2','nb_coord','nb_subdomain_2'},{'nb_tps_2','nb_subdomain_2'},{'nb_tps_2','nb_subdomain_2'}}];937 938 % Data.VarAttribute{nbvar+1}.Role='vector_x';939 % Data.VarAttribute{nbvar+2}.Role='vector_y';940 % Data.VarAttribute{nbvar+5}.Role='coord_tps';941 % Data.VarAttribute{nbvar+6}.Role='vector_x';942 % Data.VarAttribute{nbvar+7}.Role='vector_y';943 922 944 923 if isempty(Civ_FF)
Note: See TracChangeset
for help on using the changeset viewer.
