- Timestamp:
- Jul 30, 2024, 6:44:35 PM (5 months ago)
- Location:
- trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/filter_tps_3D.m
r1164 r1165 38 38 %======================================================================= 39 39 40 function [SubRange,NbCentre,Coord_tps,U_tps,V_tps,W_tps,U_smooth,V_smooth,W_smooth,FF] =filter_tps_3D(Coord _x,Coord_y,Coord_z,U,V,W,SubDomainSize,FieldSmooth,Threshold)40 function [SubRange,NbCentre,Coord_tps,U_tps,V_tps,W_tps,U_smooth,V_smooth,W_smooth,FF] =filter_tps_3D(Coord,U,V,W,SubDomainSize,FieldSmooth,Threshold) 41 41 42 42 %% adjust subdomain decomposition 43 43 warning off 44 44 % [npz,npy,npx]=size(Coord_x); 45 Coord=[Coord_x Coord_y Coord_z];46 NbVec= numel(Coord_x);% nbre of vectors in the field to interpolate45 % Coord=[Coord_x Coord_y Coord_z]; 46 NbVec=size(Coord,1);% nbre of vectors in the field to interpolate 47 47 NbCoord=3;% space dimension,Coord(:,1)= x,Coord(:,2)= y , Coord(:,3)= z 48 48 MinCoord=min(Coord,[],1);%lower coordinate bounds 49 49 MaxCoord=max(Coord,[],1);%upper coordinate bounds 50 50 Range=MaxCoord-MinCoord;%along eacch coordiante x,y,z 51 Cellmesh=(10*prod(Range) /NbVec)^(1/3);51 Cellmesh=(10*prod(Range)*SubDomainSize/NbVec)^(1/3); 52 52 NbSubDomainX=ceil(Range(1)/Cellmesh); 53 53 NbSubDomainY=ceil(Range(2)/Cellmesh); -
trunk/src/geometry_calib.m
r1159 r1165 850 850 end 851 851 outputfile=[filebase '.xml']; 852 [~,RootFile]=fileparts(filebase); 853 [~,~,errormsg]=update_imadoc(RootPath,SubDir,'GeometryCalib',GeometryCalib,0); 854 if ~strcmp(errormsg,'') 855 msgbox_uvmat('ERROR',errormsg); 852 % [~,RootFile]=fileparts(filebase); 853 854 t=xmltree; 855 t=set(t,1,'name','ImaDoc'); 856 [t,uid_calib]=add(t,1,'element','GeometryCalib'); 857 % xmlfile=[filebase '.xml']; 858 t=struct2xml(GeometryCalib,t,uid_calib); 859 save(t) 860 try 861 save(t,outputfile); 862 catch ME 863 errormsg=['error in saving ' outputfile ': ' ME.message]; 864 msgbox_uvmat('ERROR',errormsg); 856 865 end 857 866 listfile=get(handles.ListCoordFiles,'string'); -
trunk/src/get_file_info.m
r1164 r1165 147 147 nbfield=numel(fieldnames(FileInfo)); 148 148 FileInfo=orderfields(FileInfo,[nbfield nbfield-1 nbfield-2 (1:nbfield-3)]); %reorder the fields of fileInfo for clarity 149 catch ME 150 FileInfo.error=ME.message 149 151 end 150 152 else … … 209 211 end 210 212 FileInfo.ListDimName=Data.ListDimName; 211 FileInfo.NumberOfFrames=Data.DimValue;213 % FileInfo.NumberOfFrames=Data.DimValue; 212 214 end 213 215 else -
trunk/src/series/civ_3D.m
r1164 r1165 299 299 par_civ1.ImageA=zeros(2*SearchRange_z+1,npy,npx);%image block initiation 300 300 par_civ1.ImageB=zeros(2*SearchRange_z+1,npy,npx); 301 Data.Coord_z= SearchRange_z+1:par_civ1.Dz:NbSlice-1;302 z_index=1;%first vertical block centered at image index z_index=SearchRange_z+1303 for iz=1: 2*SearchRange_z+1301 Data.Coord_z=(1:floor((NbSlice-SearchRange_z)/par_civ1.Dz))+SearchRange_z;%SearchRange_z+1:par_civ1.Dz:NbSlice-1; 302 z_index=1;%first vertical block centered at image index par_civ1.Dz (not SearchRange_z+1 303 for iz=1:par_civ1.Dz+SearchRange_z%2*SearchRange_z+1 304 304 j_image_index=j1_series_Civ1(iz,1)% j index of the current image 305 305 ImageName_A=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_series_Civ1(1,ifield),[],j_image_index);% … … 307 307 ImageName_B=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_series_Civ1(1,ifield),[],j_image_index); 308 308 B= read_image(ImageName_B,FileType_B); 309 par_civ1.ImageA(iz ,:,:) = A;310 par_civ1.ImageB(iz ,:,:) = B;309 par_civ1.ImageA(iz+SearchRange_z-par_civ1.Dz+1,:,:) = A; 310 par_civ1.ImageB(iz+SearchRange_z-par_civ1.Dz+1,:,:) = B; 311 311 end 312 312 … … 354 354 par_civ1.ImageB=circshift(par_civ1.ImageB,-par_civ1.Dz,1); 355 355 for iz=1:par_civ1.Dz %read the new images at the end of the image block 356 image_index=z_index*par_civ1.Dz+SearchRange_z-par_civ1.Dz+iz+1;357 if image_index<=size(j1_series_Civ1,1)358 j_image_index=j1_series_Civ1(z_index*par_civ1.Dz+SearchRange_z-par_civ1.Dz+iz+1,1)356 j_image_index=z_index*par_civ1.Dz+SearchRange_z-par_civ1.Dz+iz 357 if j_image_index<=size(j1_series_Civ1,1) 358 % j_image_index=j1_series_Civ1(image_index,1) 359 359 ImageName_A=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_series_Civ1(1,ifield),[],j_image_index);% 360 360 A= read_image(ImageName_A,FileType_A); … … 444 444 Data.VarAttribute{nbvar+2}.Role='vector_y'; 445 445 Data.VarAttribute{nbvar+5}.Role='vector_z'; 446 447 [Data.ListVarName,IA]=unique(Data.ListVarName);%suppress duplicate definition of variables (in cas of patch redone from previous file) 448 Data.VarDimName=Data.VarDimName(IA); 449 Data.VarAttribute=Data.VarAttribute(IA); 446 450 Data.Civ1_U_smooth=Data.Civ1_U; 447 451 Data.Civ1_V_smooth=Data.Civ1_V; … … 466 470 [Data.Civ1_SubRange,Data.Civ1_NbCentres,Data.Civ1_Coord_tps,Data.Civ1_U_tps,Data.Civ1_V_tps,Data.Civ1_W_tps,... 467 471 Data.Civ1_U_smooth(ind_good),Data.Civ1_V_smooth(ind_good),Data.Civ1_W_smooth(ind_good),FFres]=... 468 filter_tps_3D( Data.Civ1_X(ind_good),Data.Civ1_Y(ind_good),Civ1_Z(ind_good),Data.Civ1_U(ind_good),Data.Civ1_V(ind_good),Data.Civ1_W(ind_good),...472 filter_tps_3D([Data.Civ1_X(ind_good) Data.Civ1_Y(ind_good) Civ1_Z(ind_good)],Data.Civ1_U(ind_good),Data.Civ1_V(ind_good),Data.Civ1_W(ind_good),... 469 473 Data.Patch1_SubDomainSize,Data.Patch1_FieldSmooth,Data.Patch1_MaxDiff); 470 474 Data.Civ1_FF(ind_good)=uint8(4*FFres); … … 699 703 Data.VarDimName=[Data.VarDimName {'nb_vec_2','nb_vec_2',{'nb_coord','nb_bounds','nb_subdomain_2'},{'nb_subdomain_2'},... 700 704 {'nb_tps_2','nb_coord','nb_subdomain_2'},{'nb_tps_2','nb_subdomain_2'},{'nb_tps_2','nb_subdomain_2'}}]; 705 706 701 707 702 708 Data.VarAttribute{nbvar+1}.Role='vector_x'; -
trunk/src/series/civ_series.m
r1164 r1165 456 456 par_civ1.NbSlice_j=par_civ1.NbSlice; 457 457 end 458 e nd459 else460 maskname=Param.ActionInput.Civ1.Mask;461 end462 if strcmp(maskoldname,maskname)% mask exist, not already read in civ1463 par_civ1.Mask=mask; %use mask already opened464 else465 if ~isempty(regexp(maskname,'(^http://)|(^https://)', 'once'))|| exist(maskname,'file')466 try467 par_civ1.Mask=imread(maskname);%update the mask, an store it for future use468 catch ME469 if ~isempty(ME.message)470 errormsg=['error reading input image: ' ME.message];471 disp_uvmat('ERROR',errormsg,checkrun)472 return458 else 459 maskname=Param.ActionInput.Civ1.Mask; 460 end 461 if strcmp(maskoldname,maskname)% mask exist, not already read in civ1 462 par_civ1.Mask=mask; %use mask already opened 463 else 464 if ~isempty(regexp(maskname,'(^http://)|(^https://)', 'once'))|| exist(maskname,'file') 465 try 466 par_civ1.Mask=imread(maskname);%update the mask, an store it for future use 467 catch ME 468 if ~isempty(ME.message) 469 errormsg=['error reading input image: ' ME.message]; 470 disp_uvmat('ERROR',errormsg,checkrun) 471 return 472 end 473 473 end 474 end 475 else 476 par_civ1.Mask=[]; 477 end 478 mask=par_civ1.Mask; 479 maskoldname=maskname; 480 end 481 474 else 475 par_civ1.Mask=[]; 476 end 477 mask=par_civ1.Mask; 478 maskoldname=maskname; 479 end 480 end 482 481 483 482 % case of input grid … … 495 494 return 496 495 end 497 498 if exist('ncfile','var') 499 CivFile=ncfile; 500 % [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 505 [Data,tild,tild,errormsg]=nc2struct(CivFile);%read civ1 and fix1 data in the existing netcdf file 506 elseif isfield(Param,'Civ1_X') 507 Data.ListGlobalAttribute={}; 508 Data.ListVarName={}; 509 Data.VarDimName={}; 510 Data.Civ1_X=Param.Civ1_X; 511 Data.Civ1_Y=Param.Civ1_Y; 512 Data.Civ1_U=Param.Civ1_U; 513 Data.Civ1_V=Param.Civ1_V; 514 Data.Civ1_FF=Param.Civ1_FF; 515 end 496 % 497 % if exist('ncfile','var') 498 % CivFile=ncfile; 499 % % [Data,tild,tild,errormsg]=nc2struct(CivFile,'ListGlobalAttribute','absolut_time_T0'); %look for the constant 'absolut_time_T0' to detect old civx data format 500 % % if ~isempty(errormsg) 501 % % disp_uvmat('ERROR',errormsg,checkrun) 502 % % return 503 % % end 504 % [Data,tild,tild,errormsg]=nc2struct(CivFile);%read civ1 and fix1 data in the existing netcdf file 505 % if ~isempty(errormsg) 506 % disp(errormsg) 507 % return 508 % end 509 % elseif isfield(Param,'Civ1_X') 510 % Data.ListGlobalAttribute={}; 511 % Data.ListVarName={}; 512 % Data.VarDimName={}; 513 % Data.Civ1_X=Param.Civ1_X; 514 % Data.Civ1_Y=Param.Civ1_Y; 515 % Data.Civ1_U=Param.Civ1_U; 516 % Data.Civ1_V=Param.Civ1_V; 517 % Data.Civ1_FF=Param.Civ1_FF; 518 % end 516 519 end 517 520 -
trunk/src/series/filter_time.m
r1158 r1165 128 128 NbField_j=size(i1_series{1},1); %nb of fields for the j index (bursts or volume slices) 129 129 NbField_i=size(i1_series{1},2); %nb of fields for the i index 130 Nb Field=NbField_j*NbField_i; %total number of fields130 NbSeries=NbField_j*NbField_i; %total number of fields 131 131 132 132 %% define the output file (unique for the whole series) … … 146 146 disp('loop for filtering started') 147 147 148 for index=1:Nb Field148 for index=1:NbSeries 149 149 index 150 150 151 Field= read_field(filecell{1,index},'netcdf',Param.InputFields); 151 [Field,~,errormsg]= read_field(filecell{1,index},'netcdf',Param.InputFields); 152 153 152 154 153 155 %%%%%%%%%%% MAIN RUNNING OPERATIONS %%%%%%%%%%%% … … 181 183 % Vblock=circshift(Vblock,[-1 0 0 0]); %shift U by ishift along the first index 182 184 % Wblock=circshift(Wblock,[-1 0 0]); %shift U by ishift along the first index 183 TimeBlock(end)=Field.Time; 184 for ilist=1:NbField 185 UVblock(end,ilist,:,:)=Field.(ListFields{ilist}); 185 186 if isempty(errormsg) 187 TimeBlock(end)=Field.Time; 188 for ilist=1:NbField 189 UVblock(end,ilist,:,:)=Field.(ListFields{ilist}); 190 end 191 else 192 TimeBlock(end)=NaN; 193 for ilist=1:NbField 194 UVblock(end,ilist,:,:)=NaN; 195 end 186 196 end 187 197 % Vblock(end,:,:)=Field.V; 188 198 % Vblock(end,:,:)=Field.W; 189 199 sumindex=min(index,Param.ActionInput.WindowLength)-1; 190 DataOut.Timefilter=mean(TimeBlock(end-sumindex:end,:) );%mid time200 DataOut.Timefilter=mean(TimeBlock(end-sumindex:end,:),'omitnan');%mid time 191 201 for ilist=1:NbField 192 DataOut.(ListFilter{ilist})=squeeze(mean(UVblock(end-sumindex:end,ilist,:,:),1,'omitnan')); 202 DataOut.(ListFilter{ilist})=squeeze(mean(UVblock(end-sumindex:end,ilist,:,:),1,'omitnan'));% take average in the block, omitting NaN 193 203 end 194 204 % DataOut.Vfilter=squeeze(mean(Vblock(end-sumindex:end,:,:),1,'omitnan')); -
trunk/src/update_imadoc.m
r1152 r1165 82 82 t=set(t,1,'name','ImaDoc'); 83 83 [t,uid_calib]=add(t,1,'element',StructName); 84 xmlfile=fullfile(RootPath,[SubDir '.xml']); 84 85 end 85 86
Note: See TracChangeset
for help on using the changeset viewer.