Changeset 1112 for trunk/src/transform_field/phys_polar.m
- Timestamp:
- Jan 26, 2022, 7:37:21 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/transform_field/phys_polar.m
r1107 r1112 78 78 Data=DataIn; %default output 79 79 if isfield(Data,'CoordUnit') 80 Data=rmfield(Data,'CoordUnit');80 Data=rmfield(Data,'CoordUnit'); 81 81 end 82 82 Data.ListVarName = {}; … … 85 85 DataCell{1}=DataIn; 86 86 Calib{1}=[]; 87 Slice{1}=[]; 87 88 DataCell{2}=[];%default 88 89 checkpixel(1)=0; 89 if isfield(DataCell{1},'CoordUnit')&& strcmp(DataCell{1}.CoordUnit,'pixel') 90 if isfield(DataCell{1},'CoordUnit')&& strcmp(DataCell{1}.CoordUnit,'pixel') 90 91 checkpixel(1)=1; 91 92 end … … 94 95 Calib{1}=XmlData.GeometryCalib; 95 96 end 97 Slice{1}=Calib{1}; 98 if isfield(XmlData,'Slice') 99 Slice{1}=XmlData.Slice; 100 end 96 101 Calib{2}=Calib{1}; 102 Slice{2}=Slice{1}; 97 103 else 98 104 Data.Txt='wrong input: need two or four structures'; … … 101 107 if nargin==4% case of two input fields 102 108 checkpixel(2)=0; 103 if isfield(DataCell{2},'CoordUnit')&& strcmp(DataCell{2}.CoordUnit,'pixel') 104 checkpixel(2)=1;105 end109 if isfield(DataCell{2},'CoordUnit')&& strcmp(DataCell{2}.CoordUnit,'pixel') 110 checkpixel(2)=1; 111 end 106 112 DataCell{2}=DataIn_1;%default 107 113 if isfield(XmlData_1,'GeometryCalib')&& ~isempty(XmlData_1.GeometryCalib) && checkpixel(2) 108 114 Calib{2}=XmlData_1.GeometryCalib; 115 end 116 if isfield(XmlData_1,'Slice') 117 Slice{2}=XmlData_1.Slice; 109 118 end 110 119 nbinput=2; … … 218 227 if ~isempty(Calib{ifield}) 219 228 [X,Y,Z,DataCell{ifield}.(UName),DataCell{ifield}.(VName)]=... 220 phys_XYUV(DataCell{ifield},Calib{ifield}, ZIndex);229 phys_XYUV(DataCell{ifield},Calib{ifield},Slice{ifield},ZIndex); 221 230 end 222 231 end … … 304 313 ZInd(nbgrid)=ZIndex; 305 314 Calib_new{nbgrid}=Calib{ifield}; 315 Slice_new{nbgrid}=Slice{ifield}; 306 316 end 307 317 if isfield(CellInfo{icell},'VarIndex_vector_x')&& isfield(CellInfo{icell},'VarIndex_vector_y') … … 325 335 Calib_new{nbgrid+1}=Calib{ifield}; 326 336 Calib_new{nbgrid+2}=Calib{ifield}; 337 Slice_new{nbgrid+1}=Calib{ifield}; 338 Slice_new{nbgrid+2}=Calib{ifield}; 327 339 nbgrid=nbgrid+2; 328 340 nbvar=nbvar+2; … … 335 347 %% tranform cartesian to polar coordinates for gridded data 336 348 if nbgrid~=0 337 [A,Data.radius,Data.theta]=phys_Ima_polar(A,coord_x,coord_y,Calib_new, ZInd,origin_xy,radius_offset,angle_offset,angle_scale);349 [A,Data.radius,Data.theta]=phys_Ima_polar(A,coord_x,coord_y,Calib_new,Slice_new,ZInd,origin_xy,radius_offset,angle_offset,angle_scale); 338 350 for icell=1:numel(A) 339 351 if icell<=numel(A)-1 && check_vector(icell)==1 && check_vector(icell+1)==1 %transform u,v into polar coordinates … … 373 385 %------------------------------------------------ 374 386 %--- transform a single field into phys coordiantes 375 function [X,Y,Z,U,V]=phys_XYUV(Data,Calib, ZIndex)387 function [X,Y,Z,U,V]=phys_XYUV(Data,Calib,Slice,ZIndex) 376 388 %------------------------------------------------ 377 389 %% set default output … … 385 397 %% transform X,Y coordinates for velocity fields (transform of an image or scalar done in phys_ima) 386 398 if isfield(Data,'X') &&isfield(Data,'Y')&&~isempty(Data.X) && ~isempty(Data.Y) 387 [X,Y,Z]=phys_XYZ(Calib, Data.X,Data.Y,ZIndex);399 [X,Y,Z]=phys_XYZ(Calib,Slice,Data.X,Data.Y,ZIndex); 388 400 Dt=1; %default 389 401 if isfield(Data,'dt')&&~isempty(Data.dt) … … 394 406 end 395 407 if isfield(Data,'U')&&isfield(Data,'V')&&~isempty(Data.U) && ~isempty(Data.V) 396 [XOut_1,YOut_1]=phys_XYZ(Calib, Data.X-Data.U/2,Data.Y-Data.V/2,ZIndex);397 [XOut_2,YOut_2]=phys_XYZ(Calib, Data.X+Data.U/2,Data.Y+Data.V/2,ZIndex);408 [XOut_1,YOut_1]=phys_XYZ(Calib,Slice,Data.X-Data.U/2,Data.Y-Data.V/2,ZIndex); 409 [XOut_2,YOut_2]=phys_XYZ(Calib,Slice,Data.X+Data.U/2,Data.Y+Data.V/2,ZIndex); 398 410 U=(XOut_2-XOut_1)/Dt; 399 411 V=(YOut_2-YOut_1)/Dt; … … 404 416 % tranform gridded field into polar coordiantes on a regular polar grid, 405 417 % transform to phys coordiantes if requested by calibration input 406 function [A_out,radius,theta]=phys_Ima_polar(A,coord_x,coord_y,CalibIn, ZIndex,origin_xy,radius_offset,angle_offset,angle_scale)418 function [A_out,radius,theta]=phys_Ima_polar(A,coord_x,coord_y,CalibIn,SliceIn,ZIndex,origin_xy,radius_offset,angle_offset,angle_scale) 407 419 rcorner=[]; 408 420 thetacorner=[]; … … 420 432 % transform edges into phys coordinates if requested 421 433 if ~isempty(CalibIn{icell}) 422 [x_edge,y_edge]=phys_XYZ(CalibIn{icell}, x_edge,y_edge,ZIndex(icell));% physical coordinates of the image edge434 [x_edge,y_edge]=phys_XYZ(CalibIn{icell},SliceIn{icell},x_edge,y_edge,ZIndex(icell));% physical coordinates of the image edge 423 435 end 424 436
Note: See TracChangeset
for help on using the changeset viewer.