Changeset 1122
- Timestamp:
- Apr 21, 2023, 11:01:06 AM (18 months ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/fill_GUI.m
r1107 r1122 103 103 input_string=num2str(input_data(ibox),4); 104 104 end 105 else 105 elseif ischar(input_data) 106 106 input_string=input_data; 107 107 end -
trunk/src/get_file_info.m
r1120 r1122 58 58 FileInfo.FileType='';% input file does not exist 59 59 FileInfo.FieldType=''; %default output 60 if ~ischar(fileinput) 61 return 62 end 60 63 % check the existence (not possible for OpenDAP data) 61 64 if ~isempty(regexp(fileinput,'^http://'))|| exist(fileinput,'file') -
trunk/src/read_image.m
r1107 r1122 35 35 %----------------------------------------------------------------------- 36 36 if ~exist('FileType','var') 37 FileType='image'; 38 end 39 if isempty(FileType) 37 40 FileType='image'; 38 41 end -
trunk/src/series/civ_input.m
r1107 r1122 114 114 end 115 115 NomTypeNc=NomTypeInput; 116 ind_opening= FileInfo.CivStage;116 ind_opening=SeriesData.FileInfo{1}.CivStage; 117 117 if isempty(regexp(NomTypeInput,'[ab|AB|-]', 'once')) 118 118 set(handles.ListCompareMode,'Value',2) %mode displacement advised if the nomencalture does not involve index pairs … … 120 120 set(handles.ListCompareMode,'Value',1) 121 121 end 122 [Data,tild,tild,errormsg]=nc2struct( FileInfo.FileName,[]);122 [Data,tild,tild,errormsg]=nc2struct(SeriesData.FileInfo{1}.FileName,[]); 123 123 if ~isempty(errormsg) 124 124 msgbox_uvmat('ERROR',['error in netcdf input file: ' errormsg]) -
trunk/src/series/civ_series.m
r1115 r1122 377 377 end 378 378 end 379 ImageName_A='';ImageName_B='';%default 380 VideoObject_A=[];VideoObject_B=[]; 379 381 %% Civ1 380 382 % if Civ1 computation is requested … … 650 652 par_civ2.ImageB=[]; 651 653 if strcmp(Param.ActionInput.ListCompareMode,'displacement') 652 653 654 ImageName_A_Civ2=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_civ2,[],j1_civ2);654 ImageName_A_Civ2=Param.ActionInput.RefFile; 655 else 656 ImageName_A_Civ2=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_civ2,[],j1_civ2); 655 657 end 656 658 if strcmp(ImageName_A_Civ2,ImageName_A) && isequal(FrameIndex_A_Civ1(ifield),FrameIndex_A_Civ2(ifield)) … … 665 667 [par_civ2.ImageB,VideoObject_B] = read_image(ImageName_B_Civ2,FileType_B,VideoObject_B,FrameIndex_B_Civ2(ifield)); 666 668 end 669 [FileInfo_A,VideoObject_A]=get_file_info(ImageName_A_Civ2); 667 670 par_civ2.ImageWidth=FileInfo_A.Width; 668 671 par_civ2.ImageHeight=FileInfo_A.Height; -
trunk/src/series/merge_proj_volume.m
r1121 r1122 200 200 DataVol.Time=0; %TO UPDATE 201 201 DataVol.ListVarName={'coord_x','coord_y','coord_z','A'}; 202 DataVol.VarDimName={'coord_x','coord_y','coord_z',{'coord_ z','coord_y','coord_x'}};202 DataVol.VarDimName={'coord_x','coord_y','coord_z',{'coord_y','coord_x','coord_z'}}; 203 203 DataVol.VarAttribute{1}.Role='coord_x'; 204 204 DataVol.VarAttribute{2}.Role='coord_y'; … … 257 257 258 258 for index_i=1:NbField_i 259 AMerge=zeros(NbField_j,numel(DataVol.coord_y),numel(DataVol.coord_x));259 260 260 for index_j=1:NbField_j 261 261 index_j … … 268 268 269 269 %%%%%%%%%%%%%%%% loop on views (input lines) %%%%%%%%%%%%%%%% 270 Data=cell(1,NbView);%initiate the set Data270 271 271 timeread=zeros(1,NbView); 272 for iview=1:NbView272 % for iview=1:NbView 273 273 %% reading input file(s) 274 [Data {iview},tild,errormsg] = read_field(filecell{iview,index_j},FileType{iview},ParamIn{iview},frame_index{iview}(index_j));274 [Data,tild,errormsg] = read_field(filecell{1,index_j},FileType{1},ParamIn{1},frame_index{1}(index_j)); 275 275 if ~isempty(errormsg) 276 276 disp_uvmat('ERROR',['ERROR in merge_proj/read_field/' errormsg],checkrun) 277 277 return 278 278 end 279 ListVar=Data{iview}.ListVarName; 279 Data.A=Data.A(1:4:end,1:4:end);% reduce the mage size 280 ListVar=Data.ListVarName; 281 %reduce the image size 280 282 for ilist=1:numel(ListVar) 281 Data {iview}.(ListVar{ilist})=double(Data{iview}.(ListVar{ilist}));% transform all fields in double before all operations283 Data.(ListVar{ilist})=double(Data.(ListVar{ilist}));% transform all fields in double before all operations 282 284 end 283 285 % get the time defined in the current file if not already defined from the xml file 284 if ~isempty(time) && isfield(Data {iview},'Time')285 timeread(iview)=Data {iview}.Time;286 if ~isempty(time) && isfield(Data,'Time') 287 timeread(iview)=Data.Time; 286 288 end 287 Data{iview}.ZIndex=index_j; 288 [X,Y]=meshgrid(DataVol.coord_x,DataVol.coord_y);%grid in physical coordinates 289 Data{iview}=proj_plane(Data{iview},XmlData{iview},X,Y); %project on the common x,y plane 289 Data.ZIndex=index_j; 290 [X,Y,Z]=meshgrid(DataVol.coord_x,DataVol.coord_y,DataVol.coord_z);%grid in physical coordinates 291 %Data{iview}=proj_plane(Data{iview},XmlData{iview},X,Y); %project on the common x,y plane 292 293 if index_j==1 294 AMerge=zeros(size(Data.A,1),size(Data.A,2),NbField_j); 290 295 end 291 % merge the NbView fields only to merge views from several cameras) 292 293 % [MergeData,errormsg]=merge_field(ProjData); 294 % if ~isempty(errormsg) 295 % disp_uvmat('ERROR',errormsg,checkrun); 296 % return 297 % end 298 AMerge(index_j,:,:)=Data{iview}.A; 296 AMerge(:,:,index_j)=Data.A; 299 297 300 298 %%%%%%%%%%%%%%%% END LOOP FOR VOLUME SCAN %%%%%%%%%%%%%%%% 301 299 end 302 300 %interpolate on the vertical grid 303 Z=zeros(1,NbField_j); 304 for j_index=1:numel(DataVol.coord_y) 305 for i_index=1:numel(DataVol.coord_x) 306 for ZIndex=1:NbField_j 307 Z(ZIndex)=Zpos(XmlData{iview},ZIndex,X(j_index,i_index),Y(j_index,i_index)); 308 end 309 DataVol.A(:,j_index,i_index) = interp1(Z,AMerge(:,j_index,i_index),DataVol.coord_z); 310 end 311 end 301 DataVol.A=proj_volume(AMerge,XmlData{1},X,Y,Z); 302 % Z=zeros(1,NbField_j); 303 % for j_index=1:numel(DataVol.coord_y) 304 % for i_index=1:numel(DataVol.coord_x) 305 % for ZIndex=1:NbField_j 306 % Z(ZIndex)=Zpos(XmlData{iview},ZIndex,X(j_index,i_index),Y(j_index,i_index)); 307 % end 308 % DataVol.A(:,j_index,i_index) = interp1(Z,AMerge(:,j_index,i_index),DataVol.coord_z); 309 % end 310 % end 312 311 error=struct2nc(OutputFile,DataVol)%save result file 313 312 314 315 % if index==1316 % TimeData.ListGlobalAttribute={'Conventions','Project','CoordUnit','TimeUnit','ZPos','Time'};317 % TimeData.Conventions='uvmat';318 % TimeData.Project='2016_Circumpolar';319 % TimeData.CoordUnit='cm';320 % TimeData.TimeUnit='s';321 % % TimeData.ZPos=ZPos;322 % TimeData.ListVarName={'radius','azimuth','U','V','curl','div'};323 % TimeData.VarDimName={'radius','azimuth',{'radius','azimuth'},{'radius','azimuth'}...324 % {'radius','azimuth'},{'radius','azimuth'}};325 % TimeData.VarAttribute{1}.Role='';326 % TimeData.VarAttribute{2}.Role='';327 % TimeData.VarAttribute{3}.Role='vector_x';328 % TimeData.VarAttribute{4}.Role='vector_y';329 % TimeData.VarAttribute{5}.Role='scalar';330 % TimeData.VarAttribute{6}.Role='scalar';331 %332 % end333 %334 % %% append data to the netcdf file for next iterations335 %336 %337 % error=struct2nc(OutputFile,TimeData);%save result file338 % if isempty(error)339 % disp(['output file ' OutputFile ' written'])340 % else341 % disp(error)342 % end343 % ellapsed_time=toc(tstart);344 % disp(['ellapsed time since start ' num2str(ellapsed_time/60,2) ' minutes'])345 313 end 346 314 … … 426 394 end 427 395 396 397 function ZIndex=XYZtoIndex(XmlData,X,Y,Z)% Z positions corresponding to X,Y positions 398 Zp=Z-XmlData.Slice.SliceCoord(1,3); 399 DZ=XmlData.Slice.SliceCoord(end,3)-XmlData.Slice.SliceCoord(1,3)/(size(XmlData.Slice.SliceCoord,1)-1); 400 if DZ~=0 401 ZIndex=(Z-XmlData.Slice.SliceCoord(1,3))/DZ+1;% Z=XmlData.SliceCoord(1,3)+(ZIndex-1)*DZ 402 end 403 % effect of angular deviation 404 SliceAngleMax=XmlData.Slice.SliceAngle(end,:)-XmlData.Slice.SliceAngle(1,:); 405 normAxe=norm(SliceAngleMax); 406 if normAxe>0 % case of angle scan 407 a=-SliceAngleMax(2)/normAxe; 408 b=-SliceAngleMax(1)/normAxe; 409 c=-a*XmlData.Slice.SliceCoord(1,1)+b*XmlData.Slice.SliceCoord(1,2);%equation of the axis ax+by+c=0 410 DNormal=norm(a*X+b*Y+c); 411 Ang=atand(Zp./DNormal); 412 ZIndex=ZIndex+Ang-norm(XmlData.Slice.SliceAngle(1,:))+1; 413 end 414 415 %------------------------------------------------------------ 416 % proj_volume: poject each image on a common grid given by coord_x and coord_y 417 function A=proj_volume(AMerge,XmlData,X,Y,Z) 418 419 A=[]; %default output 420 421 %% initial image coordinates 422 [npy,npx,npz]=size(AMerge); 423 xima=0.5:npx-0.5;%image coordinates of corners 424 %yima=npy-0.5:-1:0.5; 425 yima=0.5:npy-0.5; 426 zima=0.5:npz-0.5; 427 [XIMA_init,YIMA_init,ZIMA_init]=meshgrid(xima,yima,zima);%grid of initial image in px coordinates 428 429 %% projected coordinates 430 ZIndex=XYZtoIndex(XmlData,X,Y,Z);% Z positions correspoonding to X,Y positions 431 432 %% interpolation on the new grid 433 [XIMA,YIMA]=px_XYZ(XmlData.GeometryCalib,XmlData.Slice,X,Y,Z);% image coordinates for each point in the real 434 A=interp3(XIMA_init,YIMA_init,ZIMA_init,AMerge,XIMA,YIMA,ZIndex); 435 436 437 428 438 % proj_plane: poject each image on a common grid given by coord_x and coord_y 429 439 function DataOut=proj_plane(DataIn,XmlData,X,Y) -
trunk/src/series/sliding_average.m
r1119 r1122 1 %' turb_correlation_time': calculate the time correlation function at each point1 %'sliding_average_natalya' 2 2 %------------------------------------------------------------------------ 3 % function ParamOut= turb_correlation_time(Param)3 % function ParamOut=sliding_average(Param) 4 4 % 5 5 %%%%%%%%%%% GENERAL TO ALL SERIES ACTION FCTS %%%%%%%%%%%%%%%%%%%%%%%%%%% -
trunk/src/tps_coeff_field.m
r1107 r1122 1 1 %'tps_coeff_field': calculate the thin plate spline (tps) coefficients within subdomains for a field structure 2 2 %--------------------------------------------------------------------- 3 % DataOut=tps_coeff_field(DataIn,checkall )3 % DataOut=tps_coeff_field(DataIn,checkall,Smoothing) 4 4 % 5 5 % OUTPUT: … … 13 13 % checkall:=1 if tps is needed for all fields (a projection mode interp_tps has been chosen), 14 14 % =0 otherwise (tps only needed to get spatial derivatives of scattered data) 15 % 15 % Smoothing parameter: =0 (no smoothing) by default 16 16 17 % called functions: 17 18 % 'find_field_cells': analyse the input field structure, grouping the variables into 'fields' with common coordinates … … 37 38 %======================================================================= 38 39 39 function [DataOut,errormsg]=tps_coeff_field(DataIn,checkall )40 function [DataOut,errormsg]=tps_coeff_field(DataIn,checkall,Smoothing) 40 41 DataOut=DataIn;%default 42 if ~exist('Smoothing','var') 43 Smoothing=0; 44 end 41 45 SubDomainNbPoint=1000; %default, estimated nbre of data source points in a subdomain used for tps 42 46 if isfield(DataIn,'SubDomain') … … 53 57 nbtps=0;% indicate the number of tps coordinate sets in the field structure (in general =1) 54 58 55 for icell=1:numel(CellInfo) ;59 for icell=1:numel(CellInfo) 56 60 if NbDimArray(icell)>=2 && strcmp(CellInfo{icell}.CoordType,'scattered') %if the coordinates are scattered 57 61 NbCoord=NbDimArray(icell);% dimension of space … … 129 133 for isub=1:size(SubRange,3) 130 134 ind_sel=IndSelSubDomain(1:NbCentre(isub),isub);% array indices selected for the subdomain 131 [tild,Var_tps(1:NbCentre(isub)+NbCoord+1,isub)]=tps_coeff([X(ind_sel) Y(ind_sel)],DataIn.(ListVarInterp{ilist})(ind_sel), 0);%calculate the tps coeff in the subdomain135 [tild,Var_tps(1:NbCentre(isub)+NbCoord+1,isub)]=tps_coeff([X(ind_sel) Y(ind_sel)],DataIn.(ListVarInterp{ilist})(ind_sel),Smoothing);%calculate the tps coeff in the subdomain 132 136 end 133 137 DataOut.(ListNewVar{ilist+3})=Var_tps; -
trunk/src/transform_field/ima_filter.m
r1119 r1122 1 % 'ima_filter': example of image transform with input parameters: low-pass filter of an image 1 % 'ima_filter': low-pass filter of an image or other 2D fields defined on a regular grid 2 % the size of the filtering window in x and y is interactivement defined 2 3 3 4 %------------------------------------------------------------------------ 4 5 %%%% Use the general syntax for transform fields with a single input and parameters %%%% 5 % OUTPUT: 6 % DataOut: output field structure 6 % OUTPUT: 7 % DataOut: output field structure 7 8 % 8 9 %INPUT: 9 10 % DataIn: input field structure 11 % 10 12 % Param: matlab structure whose field Param.TransformInput contains the filter parameters 13 % DataIn_1: variables possibly introduced as a second input field 11 14 %----------------------------------- 12 15 … … 78 81 if exist('DataIn_1','var') 79 82 [CellInfo,NbDim,errormsg]=find_field_cells(DataIn_1); 80 for icell=1:numel(CellInfo) 81 if isfield(CellInfo{icell},'CoordType')&& strcmp(CellInfo{icell}.CoordType,'grid') 82 for ivar=1:numel(CellInfo{icell}.VarIndex) 83 VarName=DataIn_1.ListVarName{CellInfo{icell}.VarIndex(ivar)}; 84 Atype=class(DataIn_1.(VarName));% detect integer 8 or 16 bits 85 if numel(size(DataIn_1.(VarName)))==3 86 DataOut.(VarName)=filter2(Mfiltre,sum(DataIn_1.(VarName),3));%filter the input image, after summation on the color component (for color images) 87 DataOut.(VarName)=uint16(DataOut.(VarName)); %transform to 16 bit images 88 else 89 DataOut.(VarName)=filter2(Mfiltre,DataIn_1.(VarName)); 90 DataOut.(VarName)=feval(Atype,DataOut.(VarName));%transform to the initial image format 83 for icell=1:numel(CellInfo) 84 if isfield(CellInfo{icell},'CoordType')&& strcmp(CellInfo{icell}.CoordType,'grid') 85 for ivar=1:numel(CellInfo{icell}.VarIndex) 86 VarName=DataIn_1.ListVarName{CellInfo{icell}.VarIndex(ivar)}; 87 Atype=class(DataIn_1.(VarName));% detect integer 8 or 16 bits 88 if numel(size(DataIn_1.(VarName)))==3 89 DataOut.(VarName)=filter2(Mfiltre,sum(DataIn_1.(VarName),3));%filter the input image, after summation on the color component (for color images) 90 DataOut.(VarName)=uint16(DataOut.(VarName)); %transform to 16 bit images 91 else 92 DataOut.(VarName)=filter2(Mfiltre,DataIn_1.(VarName)); 93 DataOut.(VarName)=feval(Atype,DataOut.(VarName));%transform to the initial image format 94 end 91 95 end 92 96 end 93 97 end 94 98 end 95 end96 99 97 100
Note: See TracChangeset
for help on using the changeset viewer.