geocorr

 

is an independent program for the generation of spatial correction tables X-geocorr.cbf, Y-geocorr.cbf used for analysis of electron diffraction patterns by XDS or nXDS. The program simulates the effect of anisotropic magnification as elliptical distorsions of the detector response from the ideal metric in the detector plane.
The tables are saved like detector image files in CBF format, a byte-offset variant of the CBFlib format. The correction tables can be specified in XDS.INP or nXDS.INP, like
JOB=XYCORR
X-GEO_CORR=X-geocorr.cbf
Y-GEO_CORR=Y-geocorr.cbf
DETECTOR=PILATUS

The elliptical distortions at each pixel are specified in units of 1/100 of the width of a pixel along X and Y directions, respectively. GEOCORR expects input from file GEOCORR.INP residing in the current directory where geocorr is called. These parameters specify the values of the distortion parameters and of the format of the correction images.


Example input file GEOCORR.INP

! -- Parameters of the elliptical distortions
EPS=0.6    ! elliptical parameter (no correction: EPS=1.0)
PHI=10.0   ! distorsion angle of the ellipse axes (degrees)
! -- Parameters of the format of the correction images
NX=2463    ! NX=number of fast pixels (along X) of a correction image 
NY=2527    ! NY=number of slow pixels (along Y) of a correction image
QX=0.172   ! QX=length of a fast X-pixel (mm)
QY=0.172   ! QY=length of a slow Y-pixel (mm)
XORG=1232  ! X-center of image,  0.5+NX/2
YORG=1264  ! X-center of image,  0.5+NY/2

The elliptical distorsions (parameters EPS, PHI) describe an anisotropic magnification of the electron diffraction pattern by the transformation below (JP Abrahams, 2016, personal communication). The Fortran code snippet shows details of the computations.

R=PHI/57.29578;CPHI=COS(R);SPHI=SIN(R)
U(1,1)=CPHI**2+EPS*SPHI**2
U(2,1)=SPHI*CPHI-EPS*SPHI*CPHI
U(1,2)=CPHI*SPHI-EPS*SPHI*CPHI
U(2,2)=SPHI**2+EPS*CPHI**2

IADR=0
DO IY=1,NY
   X(2)=QY*(IY-YORG)         ! undistorted Euklidean Y coordinate (mm)
   DO IX=1,NX
      X(1)=QX*(IX-XORG)      ! undistorted Euklidean X coordinate (mm)
      XP=MATMUL(X,U)          ! distorted by 2 X 2 matrix U
      XP(1)=XORG+XP(1)/QX     ! pixel X-coordinate of detector response
      XP(2)=YORG+XP(2)/QY     ! pixel Y-coordinate of detector response
      IADR=IADR+1
      IGEO(IADR,1)=NINT(100.0*(XP(1)-IX)) ! units of 1/100 of a X-pixel
      IGEO(IADR,2)=NINT(100.0*(XP(2)-IY)) ! units of 1/100 of a Y-pixel
   ENDDO
ENDDO

© 2024, MPI for Medical Research, Heidelberg Imprint Datenschutzhinweis.
Wolfgang.Kabsch@mpimf-heidelberg.mpg.de
page last updated: Apr 30, 2024