Changeset 379 for trunk/src/proj_field.m
- Timestamp:
- Jan 27, 2012, 1:59:18 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/proj_field.m
r372 r379 17 17 %INPUT 18 18 % ObjectData: structure characterizing the projection object 19 % . Style : style of projection object20 % .ProjMode= type of projection ;21 % .Coord Type: 'px' or 'phys' type of coordinates defining the object position19 % .Type : type of projection object 20 % .ProjMode=mode of projection ; 21 % .CoordUnit: 'px', 'cm' units for the coordinates defining the object 22 22 % .Phi angle of rotation (=0 by default) 23 23 % .ProjAngle=angle of projection; … … 88 88 end 89 89 90 %% in the absence of object Style or projection mode, or object coordinaes, the input field is just tranfered without change91 if ~isfield(ObjectData,' Style')||~isfield(ObjectData,'ProjMode')90 %% in the absence of object Type or projection mode, or object coordinaes, the input field is just tranfered without change 91 if ~isfield(ObjectData,'Type')||~isfield(ObjectData,'ProjMode') 92 92 ProjData=FieldData; 93 93 return 94 94 end 95 95 if ~isfield(ObjectData,'Coord') 96 if strcmp(ObjectData. Style,'plane')96 if strcmp(ObjectData.Type,'plane') 97 97 ObjectData.Coord=[0 0 0];%default 98 98 else … … 124 124 125 125 %% apply projection depending on the object style 126 switch ObjectData. Style126 switch ObjectData.Type 127 127 case 'points' 128 128 [ProjData,errormsg]=proj_points(FieldData,ObjectData); … … 480 480 %select the indices in the range of action 481 481 testin=[];%default 482 if isequal(ObjectData. Style,'rectangle')482 if isequal(ObjectData.Type,'rectangle') 483 483 % if ~isfield(ObjectData,'RangeX')|~isfield(ObjectData,'RangeY') 484 484 % errormsg='rectangle half sides RangeX and RangeY needed' … … 494 494 testin=distX<widthx & distY<widthy; 495 495 end 496 elseif isequal(ObjectData. Style,'polygon')496 elseif isequal(ObjectData.Type,'polygon') 497 497 if testX 498 498 testin=inpolygon(coord_x,coord_y,ObjectData.Coord(:,1),ObjectData.Coord(:,2)); … … 502 502 testin=[]; %A REVOIR 503 503 end 504 elseif isequal(ObjectData. Style,'ellipse')504 elseif isequal(ObjectData.Type,'ellipse') 505 505 X2Max=widthx*widthx; 506 506 Y2Max=(widthy)*(widthy); … … 567 567 ProjMode='projection';%direct projection on the line by default 568 568 if isfield(ObjectData,'ProjMode'),ProjMode=ObjectData.ProjMode; end; 569 ProjAngle=90; %90 degrees projection by default570 if isfield(FieldData,'ProjAngle'),ProjAngle=ObjectData.ProjAngle; end;569 % ProjAngle=90; %90 degrees projection by default 570 % if isfield(FieldData,'ProjAngle'),ProjAngle=ObjectData.ProjAngle; end; 571 571 width=0;%default width of the projection band 572 if isfield(ObjectData,'Range')& size(ObjectData.Range,2)>=2572 if isfield(ObjectData,'Range')&&size(ObjectData.Range,2)>=2 573 573 width=abs(ObjectData.Range(1,2)); 574 574 end … … 777 777 %case of structured coordinates 778 778 elseif numel(VarType.coord)>=2 & VarType.coord(1:2) > 0; 779 if ~isequal(ObjectData. Style,'line')% exclude polyline780 errormsg=['no projection available on ' ObjectData. Style 'for structured coordinates']; %779 if ~isequal(ObjectData.Type,'line')% exclude polyline 780 errormsg=['no projection available on ' ObjectData.Type 'for structured coordinates']; % 781 781 else 782 782 test_Amat=1;%image or 2D matrix … … 949 949 testangle=~isequal(PlaneAngle,[0 0 0]);% && ~test90y && ~test90x;%=1 for slanted plane 950 950 951 % Phi=0;%default952 % Theta=0;953 % Psi=0;954 % if isfield(ObjectData,'Phi')&& ~isempty(ObjectData.Phi)955 % Phi=(pi/180)*ObjectData.Phi;%first Euler angle in radian956 % end957 % if isfield(ObjectData,'Theta')&& ~isempty(ObjectData.Theta)958 % Theta=(pi/180)*ObjectData.Theta;%second Euler angle in radian959 % end960 % if isfield(ObjectData,'Psi')&& ~isempty(ObjectData.Psi)961 % Psi=(pi/180)*ObjectData.Psi;%third Euler angle in radian962 % end963 964 %components of the unity vector normal to the projection plane965 % NormVec_X=-sin(Phi)*sin(Theta);966 % NormVec_Y=cos(Phi)*sin(Theta);967 % NormVec_Z=cos(Theta);968 969 951 %mesh sizes DX and DY 970 952 DX=0; 971 953 DY=0; %default 972 if isfield(ObjectData,'DX') &~isempty(ObjectData.DX)954 if isfield(ObjectData,'DX') && ~isempty(ObjectData.DX) 973 955 DX=abs(ObjectData.DX);%mesh of interpolation points 974 956 end 975 if isfield(ObjectData,'DY') &~isempty(ObjectData.DY)957 if isfield(ObjectData,'DY') && ~isempty(ObjectData.DY) 976 958 DY=abs(ObjectData.DY);%mesh of interpolation points 977 959 end … … 2187 2169 %% transfer coordinate unit 2188 2170 if isfield(FieldData,'CoordUnit') 2189 if isfield(ObjectData,'CoordUnit') &~isequal(FieldData.CoordUnit,ObjectData.CoordUnit)2190 errormsg=[ObjectData. Style ' in ' ObjectData.CoordUnit ' coordinates, while field in ' FieldData.CoordUnit ];2171 if isfield(ObjectData,'CoordUnit') && ~strcmp(FieldData.CoordUnit,ObjectData.CoordUnit) 2172 errormsg=[ObjectData.Type ' in ' ObjectData.CoordUnit ' coordinates, while field in ' FieldData.CoordUnit ]; 2191 2173 return 2192 2174 else … … 2196 2178 2197 2179 %% store the properties of the projection object 2198 ListObject={' Style','ProjMode','RangeX','RangeY','RangeZ','Phi','Theta','Psi','Coord'};2180 ListObject={'Type','ProjMode','RangeX','RangeY','RangeZ','Phi','Theta','Psi','Coord'}; 2199 2181 for ilist=1:length(ListObject) 2200 2182 if isfield(ObjectData,ListObject{ilist})
Note: See TracChangeset
for help on using the changeset viewer.