Changeset 1161 for trunk/src/series/civ_3D.m
- Timestamp:
- Jul 19, 2024, 5:57:46 AM (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/civ_3D.m
r1160 r1161 314 314 return 315 315 end 316 %for z_index=2:floor((NbSlice-1)/par_civ1.Dz)% loop on slices316 % loop on slices 317 317 for z_index=2:floor((NbSlice-SearchRange_z)/par_civ1.Dz)% loop on slices 318 par_civ1.ImageA=circshift(par_civ1.ImageA,-par_civ1.Dz );%shift the indices in the image block upward by par_civ1.Dz319 par_civ1.ImageB=circshift(par_civ1.Image A,-par_civ1.Dz);318 par_civ1.ImageA=circshift(par_civ1.ImageA,-par_civ1.Dz,1);%shift the indices in the image block upward by par_civ1.Dz 319 par_civ1.ImageB=circshift(par_civ1.ImageB,-par_civ1.Dz,1); 320 320 for iz=1:par_civ1.Dz %read the new images at the end of the image block 321 j_image_index=j1_series_Civ1(z_index*par_civ1.Dz+SearchRange_z-par_civ1.Dz+iz ,1)321 j_image_index=j1_series_Civ1(z_index*par_civ1.Dz+SearchRange_z-par_civ1.Dz+iz+1,1) 322 322 ImageName_A=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_series_Civ1(1,ifield),[],j_image_index);% 323 323 A= read_image(ImageName_A,FileType_A); … … 330 330 [Data.Civ1_X(z_index,:,:),Data.Civ1_Y(z_index,:,:), Data.Civ1_U(z_index,:,:), Data.Civ1_V(z_index,:,:),Data.Civ1_W(z_index,:,:),... 331 331 Data.Civ1_C(z_index,:,:), Data.Civ1_FF(z_index,:,:), result_conv, errormsg] = civ3D (par_civ1); 332 333 332 if ~isempty(errormsg) 334 333 disp_uvmat('ERROR',errormsg,checkrun) … … 523 522 Data.CivStage=4; 524 523 end 525 % else 526 % SubRange= par_civ2.Civ1_SubRange; 527 % NbCentres=par_civ2.Civ1_NbCentres; 528 % Coord_tps=par_civ2.Civ1_Coord_tps; 529 % U_tps=par_civ2.Civ1_U_tps; 530 % V_tps=par_civ2.Civ1_V_tps; 531 % Civ1_Dt=par_civ2.Civ1_Dt; 532 % Civ2_Dt=par_civ2.Civ1_Dt; 533 % Data.ListVarName={}; 534 % Data.VarDimName={}; 535 % end 524 536 525 Shiftx=zeros(size(par_civ2.Grid,1),1);% shift expected from civ1 data 537 526 Shifty=zeros(size(par_civ2.Grid,1),1); 538 527 nbval=zeros(size(par_civ2.Grid,1),1);% nbre of interpolated values at each grid point (from the different patch subdomains) 539 if par_civ2.CheckDeformation 540 DUDX=zeros(size(par_civ2.Grid,1),1); 541 DUDY=zeros(size(par_civ2.Grid,1),1); 542 DVDX=zeros(size(par_civ2.Grid,1),1); 543 DVDY=zeros(size(par_civ2.Grid,1),1); 544 end 528 545 529 NbSubDomain=size(SubRange,3); 546 530 for isub=1:NbSubDomain% for each sub-domain of Patch1 … … 555 539 Shiftx(ind_sel)=Shiftx(ind_sel)+EM*U_tps(1:nbvec_sub+3,isub);%velocity shift estimated by tps from civ1 556 540 Shifty(ind_sel)=Shifty(ind_sel)+EM*V_tps(1:nbvec_sub+3,isub); 557 if par_civ2.CheckDeformation558 [EMDX,EMDY] = tps_eval_dxy(epoints,ctrs);%2D matrix of distances between extrapolation points epoints and spline centres (=site points) ctrs559 DUDX(ind_sel)=DUDX(ind_sel)+EMDX*U_tps(1:nbvec_sub+3,isub);560 DUDY(ind_sel)=DUDY(ind_sel)+EMDY*U_tps(1:nbvec_sub+3,isub);561 DVDX(ind_sel)=DVDX(ind_sel)+EMDX*V_tps(1:nbvec_sub+3,isub);562 DVDY(ind_sel)=DVDY(ind_sel)+EMDY*V_tps(1:nbvec_sub+3,isub);563 end564 541 end 565 542 end … … 924 901 correl_xy=conv2(subima2,flip(flip(subima1,2),1),'valid'); 925 902 result_conv(kz,:,:)=correl_xy; 926 max_xy(kz)=max(max(correl_xy)); 927 [yk(kz),xk(kz)]=find(correl_xy >=0.999*max_xy(kz),1);%find the indices of the maximum, use 0.999 to avoid rounding errors903 max_xy(kz)=max(max(correl_xy)); 904 [yk(kz),xk(kz)]=find(correl_xy==max_xy(kz),1);%find the indices of the maximum, use 0.999 to avoid rounding errors 928 905 end 929 906 [corrmax,dz]=max(max_xy); … … 990 967 FF=false; 991 968 peakz=z;peaky=y;peakx=x; 992 %if z < npz && z > 1 && y < npy && y > 1 && x < npx && x > 1993 %f0 = log(result_conv(z,y,x));994 %f1 = log(result_conv(z-1,y,x));995 %f2 = log(result_conv(z+1,y,x));996 %peakz = peakz+ (f1-f2)/(2*f1-4*f0+2*f2);997 % 998 %f1 = log(result_conv(z,y-1,x));999 %f2 = log(result_conv(z,y+1,x));1000 %peaky = peaky+ (f1-f2)/(2*f1-4*f0+2*f2);1001 % 1002 %f1 = log(result_conv(z,y,x-1));1003 %f2 = log(result_conv(z,y,x+1));1004 %peakx = peakx+ (f1-f2)/(2*f1-4*f0+2*f2);1005 %else1006 %FF=true;1007 %end969 if z < npz && z > 1 && y < npy && y > 1 && x < npx && x > 1 970 f0 = log(result_conv(z,y,x)); 971 f1 = log(result_conv(z-1,y,x)); 972 f2 = log(result_conv(z+1,y,x)); 973 peakz = peakz+ (f1-f2)/(2*f1-4*f0+2*f2); 974 975 f1 = log(result_conv(z,y-1,x)); 976 f2 = log(result_conv(z,y+1,x)); 977 peaky = peaky+ (f1-f2)/(2*f1-4*f0+2*f2); 978 979 f1 = log(result_conv(z,y,x-1)); 980 f2 = log(result_conv(z,y,x+1)); 981 peakx = peakx+ (f1-f2)/(2*f1-4*f0+2*f2); 982 else 983 FF=true; 984 end 1008 985 1009 986 vector=[peakx-floor(npx/2)-1 peaky-floor(npy/2)-1 peakz-floor(npz/2)-1];
Note: See TracChangeset
for help on using the changeset viewer.