Changeset 507 for trunk/src/transform_field
- Timestamp:
- Jul 29, 2012, 11:18:31 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/transform_field/phys.m
r494 r507 16 16 % Data_1, CalibData_1: same as Data, CalibData for the second field. 17 17 18 function [DataOut,DataOut_1]=phys( varargin)18 function [DataOut,DataOut_1]=phys(DataIn,XmlData,DataIn_1,XmlData_1) 19 19 % A FAIRE: 1- verifier si DataIn est une 'field structure'(.ListVarName'): 20 20 % chercher ListVarAttribute, for each field (cell of variables): … … 25 25 % 'D_i' if '.Role='vector_x,...', 26 26 % 'scalar', else (thenno change except scale factor) 27 %% set GUI config 28 DataOut=[]; 29 DataOut_1=[]; %default second output field 30 if strcmp(DataIn,'*') 31 if isfield(XmlData,'GeometryCalib')&& isfield(XmlData.GeometryCalib,'CoordUnit') 32 DataOut.CoordUnit=XmlData.GeometryCalib.CoordUnit; 33 end 34 return 35 end 36 27 37 %% analyse input and set default output 28 DataOut=varargin{1};%default first output field 29 DataOut_1=[]; %default second output field 38 DataOut=DataIn;%default first output field 30 39 if nargin>=2 % nargin =nbre of input variables 31 if isfield( varargin{2},'GeometryCalib')32 Calib{1}= varargin{2}.GeometryCalib;40 if isfield(XmlData,'GeometryCalib') 41 Calib{1}=XmlData.GeometryCalib; 33 42 else 34 43 Calib{1}=[]; 35 44 end 36 45 if nargin>=3 %two input fields 37 DataOut_1= varargin{3};%default second output field38 if nargin>=4 && isfield( varargin{4},'GeometryCalib')39 Calib{2}= varargin{4}.GeometryCalib;46 DataOut_1=DataIn_1;%default second output field 47 if nargin>=4 && isfield(XmlData_1,'GeometryCalib') 48 Calib{2}=XmlData_1.GeometryCalib; 40 49 else 41 50 Calib{2}=Calib{1}; … … 45 54 46 55 %% get the z index defining the section plane 47 if isfield( varargin{1},'ZIndex')&&~isempty(varargin{1}.ZIndex)&&~isnan(varargin{1}.ZIndex)48 ZIndex= varargin{1}.ZIndex;56 if isfield(DataIn,'ZIndex')&&~isempty(DataIn.ZIndex)&&~isnan(DataIn.ZIndex) 57 ZIndex=DataIn.ZIndex; 49 58 else 50 59 ZIndex=1; … … 57 66 return %bad calib parameter input 58 67 end 59 if ~(isfield( varargin{1},'CoordUnit')&& strcmp(varargin{1}.CoordUnit,'pixel'))68 if ~(isfield(DataIn,'CoordUnit')&& strcmp(DataIn.CoordUnit,'pixel')) 60 69 return % transform only fields in pixel coordinates 61 70 end 62 DataOut=phys_1( varargin{1},Calib{1},ZIndex);% transform coordiantes and velocity components71 DataOut=phys_1(DataIn,Calib{1},ZIndex);% transform coordiantes and velocity components 63 72 %case of images or scalar: in case of two input fields, we need to project the transform on the same regular grid 64 if isfield( varargin{1},'A') && isfield(varargin{1},'AX') && ~isempty(varargin{1}.AX) && isfield(varargin{1},'AY')&&...65 ~isempty( varargin{1}.AY) && length(varargin{1}.A)>173 if isfield(DataIn,'A') && isfield(DataIn,'AX') && ~isempty(DataIn.AX) && isfield(DataIn,'AY')&&... 74 ~isempty(DataIn.AY) && length(DataIn.A)>1 66 75 iscalar=1; 67 A{1}= varargin{1}.A;76 A{1}=DataIn.A; 68 77 end 69 78 end … … 83 92 %% transform second field if relevant 84 93 if ~isempty(DataOut_1) 85 if isfield( varargin{3},'ZIndex') && ~isequal(varargin{3}.ZIndex,ZIndex)94 if isfield(DataIn_1,'ZIndex') && ~isequal(DataIn_1.ZIndex,ZIndex) 86 95 DataOut_1.Txt='different plane indices for the two input fields'; 87 96 return … … 90 99 return %bad calib parameter input 91 100 end 92 if ~(isfield( varargin{3},'CoordUnit')&& strcmp(varargin{3}.CoordUnit,'pixel'))101 if ~(isfield(DataIn_1,'CoordUnit')&& strcmp(DataIn_1.CoordUnit,'pixel')) 93 102 return % transform only fields in pixel coordinates 94 103 end … … 108 117 end 109 118 end 110 if isfield( varargin{3},'A')&&isfield(varargin{3},'AX')&&~isempty(varargin{3}.AX) && isfield(varargin{3},'AY')&&...111 ~isempty( varargin{3}.AY)&&length(varargin{3}.A)>1119 if isfield(DataIn_1,'A')&&isfield(DataIn_1,'AX')&&~isempty(DataIn_1.AX) && isfield(DataIn_1,'AY')&&... 120 ~isempty(DataIn_1.AY)&&length(DataIn_1.A)>1 112 121 iscalar=iscalar+1; 113 122 Calib{iscalar}=Calib{2}; 114 A{iscalar}= varargin{3}.A;123 A{iscalar}=DataIn_1.A; 115 124 end 116 125 end
Note: See TracChangeset
for help on using the changeset viewer.