Changeset 972 for trunk/src/phys_ima.m


Ignore:
Timestamp:
Nov 15, 2016, 5:22:14 PM (7 years ago)
Author:
sommeria
Message:

multitif updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/phys_ima.m

    r970 r972  
    6161        [Rangx]=phys_XYZ(Calib,Rangx,[0.5 0.5],ZIndex);%case of translations without rotation and quadratic deformation
    6262        [xx,Rangy]=phys_XYZ(Calib,[0.5 0.5],Rangy,ZIndex);
    63     else         
     63    else
    6464        % the image needs to be interpolated to the new coordinates
    6565        zphys=0; %default
    6666        if isfield(Calib,'SliceCoord') %.Z= index of plane
    67            SliceCoord=Calib.SliceCoord(ZIndex,:);
    68            zphys=SliceCoord(3); %to generalize for non-parallel planes
    69            
    70 %         if isfield(Calib,'SliceAngle')&&~isequal(Calib.SliceAngle,[0 0 0])
    71 %                     om=norm(Calib.SliceAngle);%norm of rotation angle in radians
    72 %                     OmAxis=Calib.SliceAngle/om; %unit vector marking the rotation axis
    73 %                     cos_om=cos(pi*om/180);
    74 %                     sin_om=sin(pi*om/180);
    75 %                     pos=[xy(1,1) xy(1,2) 0];
    76 %                     pos=cos_om*pos+sin_om*cross(OmAxis,pos)+(1-cos_om)*(OmAxis*pos')*OmAxis;
    77 %                 end
    78            
    79            
    80 %            if isfield(Calib,'InterfaceCoord') && isfield(Calib,'RefractionIndex')
     67            SliceCoord=Calib.SliceCoord(ZIndex,:);
     68            zphys=SliceCoord(3); %to generalize for non-parallel planes
     69            if isfield(Calib, 'SliceAngle') && ~isequal(Calib.SliceAngle,[0 0 0]) && ~isequal(Calib.SliceAngle(ZIndex,:),[0 0 0])
     70                testangle=1;
     71                om=norm(Calib.SliceAngle(ZIndex,:));%norm of rotation angle in radians
     72                OmAxis=Calib.SliceAngle(ZIndex,:)/om; %unit vector marking the rotation axis
     73                cos_om=cos(pi*om/180);
     74                sin_om=sin(pi*om/180);
     75                coeff=OmAxis(3)*(1-cos_om);
     76                norm_plane(1)=OmAxis(1)*coeff+OmAxis(2)*sin_om;
     77                norm_plane(2)=OmAxis(2)*coeff-OmAxis(1)*sin_om;
     78                norm_plane(3)=OmAxis(3)*coeff+cos_om;
     79                %Z0=norm_plane*Calib.SliceCoord(ZIndex,:)'/norm_plane(3);
     80                Z0=Calib.SliceCoord(ZIndex,3);
     81                zphys=Z0-(norm_plane(1)*X-norm_plane(2)*Y)/norm_plane(3);
     82            end
     83%             if isfield(Calib,'InterfaceCoord') && isfield(Calib,'RefractionIndex')
    8184%                 H=Calib.InterfaceCoord(3);
    8285%                 if H>zphys
    8386%                     zphys=H-(H-zphys)/Calib.RefractionIndex; %corrected z (virtual object)
    8487%                 end
    85 %            end
     88%             end
    8689        end
    8790        xima=0.5:npx(icell)-0.5;%image coordinates of corners
Note: See TracChangeset for help on using the changeset viewer.