Changeset 1033 for trunk/src/transform_field
- Timestamp:
- Apr 30, 2018, 8:01:35 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/transform_field/phys.m
r1027 r1033 79 79 %% transform first field 80 80 iscalar=0;% counter of scalar fields 81 checktransform=0; 81 82 if ~isempty(Calib{1}) 82 if ~isfield(Calib{1},'CalibrationType')||~isfield(Calib{1},'CoordUnit') 83 return %bad calib parameter input 84 end 85 if ~(isfield(DataIn,'CoordUnit')&& strcmp(DataIn.CoordUnit,'pixel')) 86 return % transform only fields in pixel coordinates 87 end 88 DataOut=phys_1(DataIn,Calib{1},ZIndex);% transform coordinates and velocity components 89 %case of images or scalar: in case of two input fields, we need to project the transform on the same regular grid 90 if isfield(DataIn,'A') && isfield(DataIn,'Coord_x') && ~isempty(DataIn.Coord_x) && isfield(DataIn,'Coord_y')&&... 91 ~isempty(DataIn.Coord_y) && length(DataIn.A)>1 92 iscalar=1; 93 A{1}=DataIn.A; 83 if isfield(Calib{1},'CalibrationType')&& isfield(Calib{1},'CoordUnit') && isfield(DataIn,'CoordUnit')&& strcmp(DataIn.CoordUnit,'pixel') 84 DataOut=phys_1(DataIn,Calib{1},ZIndex);% transform coordinates and velocity components 85 %case of images or scalar: in case of two input fields, we need to project the transform on the same regular grid 86 if isfield(DataIn,'A') && isfield(DataIn,'Coord_x') && ~isempty(DataIn.Coord_x) && isfield(DataIn,'Coord_y')&&... 87 ~isempty(DataIn.Coord_y) && length(DataIn.A)>1 88 iscalar=1; 89 A{1}=DataIn.A; 90 end 91 checktransform=1; 94 92 end 95 93 end 96 94 97 95 %% document the selected plane position and angle if relevant 98 if isfield(Calib{1},'SliceCoord')&&size(Calib{1}.SliceCoord,1)>=ZIndex96 if checktransform && isfield(Calib{1},'SliceCoord')&&size(Calib{1}.SliceCoord,1)>=ZIndex 99 97 DataOut.PlaneCoord=Calib{1}.SliceCoord(ZIndex,:);% transfer the slice position corresponding to index ZIndex 100 98 if isfield(Calib{1},'SliceAngle') % transfer the slice rotation angles … … 108 106 109 107 %% transform second field if relevant 108 checktransform_1=0; 110 109 if ~isempty(DataOut_1) 111 110 if isfield(DataIn_1,'ZIndex') && ~isequal(DataIn_1.ZIndex,ZIndex) … … 113 112 return 114 113 end 115 if ~isfield(Calib{2},'CalibrationType')||~isfield(Calib{2},'CoordUnit') 116 return %bad calib parameter input 117 end 118 if (isfield(DataIn_1,'CoordUnit')&& strcmp(DataIn_1.CoordUnit,'pixel')) 114 if isfield(Calib{2},'CalibrationType')&&isfield(Calib{2},'CoordUnit') && isfield(DataIn_1,'CoordUnit')&& strcmp(DataIn_1.CoordUnit,'pixel') 119 115 DataOut_1=phys_1(DataOut_1,Calib{2},ZIndex); 120 end 121 if isfield(Calib{1},'SliceCoord') 122 if ~(isfield(Calib{2},'SliceCoord') && isequal(Calib{2}.SliceCoord,Calib{1}.SliceCoord)) 123 DataOut_1.Txt='different plane positions for the two input fields'; 124 return 125 end 126 DataOut_1.PlaneCoord=DataOut.PlaneCoord;% same plane position for the two input fields 127 if isfield(Calib{1},'SliceAngle') 128 if ~(isfield(Calib{2},'SliceAngle') && isequal(Calib{2}.SliceAngle,Calib{1}.SliceAngle)) 129 DataOut_1.Txt='different plane angles for the two input fields'; 116 if isfield(Calib{1},'SliceCoord') 117 if ~(isfield(Calib{2},'SliceCoord') && isequal(Calib{2}.SliceCoord,Calib{1}.SliceCoord)) 118 DataOut_1.Txt='different plane positions for the two input fields'; 130 119 return 131 120 end 132 DataOut_1.PlaneAngle=DataOut.PlaneAngle; % same plane angle for the two input fields 133 end 134 end 135 if isfield(DataIn_1,'A')&&isfield(DataIn_1,'Coord_x')&&~isempty(DataIn_1.Coord_x) && isfield(DataIn_1,'Coord_y')&&... 136 ~isempty(DataIn_1.Coord_y)&&length(DataIn_1.A)>1 137 iscalar=iscalar+1; 138 Calib{iscalar}=Calib{2}; 139 A{iscalar}=DataIn_1.A; 121 DataOut_1.PlaneCoord=DataOut.PlaneCoord;% same plane position for the two input fields 122 if isfield(Calib{1},'SliceAngle') 123 if ~(isfield(Calib{2},'SliceAngle') && isequal(Calib{2}.SliceAngle,Calib{1}.SliceAngle)) 124 DataOut_1.Txt='different plane angles for the two input fields'; 125 return 126 end 127 DataOut_1.PlaneAngle=DataOut.PlaneAngle; % same plane angle for the two input fields 128 end 129 end 130 if isfield(DataIn_1,'A')&&isfield(DataIn_1,'Coord_x')&&~isempty(DataIn_1.Coord_x) && isfield(DataIn_1,'Coord_y')&&... 131 ~isempty(DataIn_1.Coord_y)&&length(DataIn_1.A)>1 132 iscalar=iscalar+1; 133 Calib{iscalar}=Calib{2}; 134 A{iscalar}=DataIn_1.A; 135 end 136 checktransform_1=1; 140 137 end 141 138 end 142 139 143 140 %% transform the scalar(s) or image(s) 144 if iscalar~=0141 if checktransform && iscalar~=0 145 142 [A,Coord_x,Coord_y]=phys_ima(A,XmlData,ZIndex);%TODO : introduire interp2_uvmat ds phys_ima 146 143 if iscalar==1 && ~isempty(DataOut_1) % case for which only the second field is a scalar
Note: See TracChangeset
for help on using the changeset viewer.