这是indexloc提供的服务,不要输入任何密码
Skip to content

Software package collecting scripts for the data collection and evaluation of phase shifting holography image stacks with Digital Micrograph Scripting and Tem Scripting for electron microscopy.

Notifications You must be signed in to change notification settings

SrcJonasLindner/phase-shifting-holography

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Phase-shifting-holography software package

Software package including scripts for the data collection and evaluation of phase shifting holography image stacks with Digital Micrograph Scripting and TitanScripting for electron microscopy.

Note: The workflow and the trainingsdata have not been published (yet). If you are interested please contanct me or the corresponding author of the publication directly.

Phase Shifting Paper


Paper abstract

Phase-shifting electron holography is an excellent method to reveal electron wave phase information with very high phase sensitivity over a large range of spatial frequencies. It circumvents the limiting trade-off between fringe spacing and visibility of standard off-axis holography. Previous implementations have been limited by the independent drift of biprism and sample. We demonstrate here an advanced drift correction scheme for the hologram series that allow to obtain reliable phase information at the 1 Å information limit of the used Titan 80-300 kV environmental transmission electron microscope using a single biprism at moderate voltage of 250 V. The obtained phase and amplitude information is validated at a thin Pt sample by use of multislice image simulation with the frozen lattice approximation and shows excellent agreement. The presented method drastically reduces the hardware requirements and thus allows to achieve high resolution in off-axis holography in various instruments including those for in-situ applications. A software implementation for the acquisition, calibration and reconstruction is provided.


Table of contents:

  1. Requirements
  2. Data Collection
    1. Tilt Series UI
    2. Calibrating the tilt
  3. Data Evaluation
    1. Specimen drift correction
    2. Phase shifting series reconstruction
      1. Measure the carrier frequency phase
      2. Reconstruction Matrix
      3. Reconstruction Image
  4. Example Data and Workflow
  5. Copyright and Diclaimer

Requirements

Digital Micrograph 3.5X+ with Python support installed

Install the latest version Digital Micrograph. Install the FAUX camera libary.

Software Microscope control to lenses (optional, but strongly recommended)

The phase shifting measurement procedure involes a routine to use the GunTilt lens of the Titan to tilt the beam off from the optical axis to create phase shifts in the holograms, that are the heart of this method. In our implementation is a default option using the Digital Micrograph Microscope interface, but with our Microscope (Thrmofisher Titan) this procedure was way too slow and needed approx 1-2 seconds to create one of the beam tilts. Since a phase shifting holo series covers around several tens of images, the specimen driftin the dead time is a serious problem. But maybe the delay is shorter on other instruments. The relevant portion of the script could be replaced with low efford.

Tem scripting interface or the ability to precompile microscope commands as executable files, that then are included in the measurement script.


Data collection

The acquisition of the phase shifting holo image series requires a calibration of the magnitude and direction of the beam tilt. Both, calibration and the image series recording are implemented in the TiltSeriesUI.s Digital Micrograph script. An phase shifting holo tilt series should at least cover the phaseshifts in the intervall $[0,2\pi]$. Generally choose short exposure time (e.g. one second) to be able to correct the specimen drift via post processing. Aim for 50 holograms in the tilt series to increase the fitting accuracy of the reconstruction and high fringe visibility. Internally the script multiplies the input in [DAC]-units by $10^{-5}$. An input of 1000 in the amplitude field will result in an effectively $10^{-2}$ [DAC] that are passed to the microscope and correspond to a tilt of $174~\mu rad$

The functionality of the precompiled functions to manipulate the electron beam can be tested with the Digital Micrograp script getBeamTilt.s. All API-functions to manipulate the electron beam are located in BeamTilt_API.


Tilt Series UI

Acquire

Start: Starts the recording of the image tilt series. Looping over the amplitude and angle ranges given under
    Amplitude and Angle.
Stop: Cancels the measurement thread.
Ref: Saves the current image shift position to jump there to take the vacuum reference after the specimen tilt
   series.
Wobble: Starts a Wobbler-calibration measurement. Using Amplitude, Angle and Samples
Samples: Defines the number of sample-points within the wobbler amplitude ramp. See details

Angle [deg]

Start: Inital tilt angle. 90 degree corresponds to the tem holder axis in the FEI Titan.
Stop: Final tilt angle.
Stepsize: Used stepsize if ramping the angle. Set to zeroi for fixed angle measurements.

Amplitude [DAC]

Start: Initial tilt amplitude in units to the digital to analog converter.
Stop/Its.: Final tilt magnitude. For typical biprism voltages from 200-300 V [0,40] is a good first wobbbling
     guess.
Stepsize: If stepsize=0: using the stop value as number of measurements to be done. If stepsize>=0 use it to
     determine the steps between Startand Stop.

Options

Calibrate: User input of constant factors to scale the tilt magnitudes in x- and y directions
     respectively. Optional after calibration to rescale the used tilt magnitude.

[✓] Gun: If checked the gun tilt lens is used via TEM scripting compiled executable.
    If unchecked the EM Commands are used. Note that the later may have a long delay.
[✓] Pairs: If checked an image is recorded at the zero reference tilt angle after each image in the tilt series. This
    feature can be used for π-phase shifting electron holography
[✓] Vacuum reference: If checked a vacuum reference tilt series is acquired parallel at the image shift position
            defined by Ref. The same angle and amplitude parameters are used for the vacuum
            series. Trades specimen drift vs. biprsim drift compared to sequenctial recording of two
            seperate stacks.

Evaluate

Drift: Uses the phase correlation function to roughly calculate the specimen drift of the
     frontwindow
    image stack.
Measure stack: Measures the hologram phase of the carrier frequency from the FFT of each hologram inside the frontmost stack. The output is an image. In the current version a horizontal line profile about the third line is the phase. Detials are found in the image info tag. Once the result is provided as line profile, that is used as input for the reconstruction.
Correct: Corrects the tilt series image stack by the drift determined by Drift.
Refine: Beta feature that measures the phase of the holograms by non-linear cosine fitting via python.
     Not recommended, use Measure stack insted.

Drift x: Linear x-drift interpolation according to Drift.
Drift y: Linear y-drift interpolation according to Drift.


Calibrating the tilt

For a given biprism voltage and a certain beam tilt angle the magnitude $\phi$ of the beam tilt in DAC-units has to be calibrated. To minimize the influence of mechanical vibration the biprism should be oriented perpendicular to the holder axis. In the Titan the coordinate system of the beam deflection the y-direction is parallel to the holder axis. The wobbling calibration procedure takes a series of images. The exposure time of each image is synchronized with a tilt-ramp during this exposure. The number of points within the ramp $n$ (samples) has to be chosen beforehand. Each image is acquired with a different maximum tilt $\phi_{max}$. The intensity of the acquired wobbling-image can be described as:

$$ I_{wobbler}(\phi_{max},n)=\sum_{i=1}^{n} a(x,y) + b(x,y) \cos \left[ \frac{2\pi x}{Tx} + \frac{2\pi y}{Ty} + \frac{\phi_{max}}{(n-i)} \right] $$

If the standard derivation of each image is plotted against the $\phi_{max}$ or tilt [DAC] the tilt magnitude needed to create a phase shift of $2\pi n$ can be measured by the distance of maxima of the standard derivative. The standard derivative is maximized if each step corresponds to $\phi_{max}/((n-i))=2\pi m$. This procedure allows a fast way of calibrating the needed tilt for arbitrary biprism orientations and angles and is included in the UI-script.

The subroutine to do a Wobbler-Calibration is found in the Tilt_Calibration folder.

Wobbler-Calibration Input Example (250V biprsim)

    Wobbler-Calibration Input Example (250V biprsim): 
    Acquire:
        Samples=4.0
    Angle [deg]: 
        Start=90 # choose fix angle along holder axis
         Stop=0  # do not vary the angle during wobbling
         Step=0  # do not vary the angle during wobbling
    Amplitude [DAC]:
        Start=0.0
         Stop=25.0
         Step=1.0
 press Wobble Button
Wobbler Calibration Output Example
Standard derivative of wobbler calibration image intensities for number of samples n=[2,3,4] plotted vs maximum tilt magnitude $phi_{max}$. The distance of the maxima scales with n∙2π, therefore the beam tilt amplitude for an arbitrary phase shift can be measured by the distance in the wobbling curve.

Data Evaluation

Specimen drift correction

The main tool for the specimen drift correction is the digital micrograph script DriftCorrUI.s.

Its purpose is to create a custom mask in reciprocal space. This custom mask can constist of combinations of spot- and radial masks to focus the drift correction onto the relevant spatial frequencies. After the mask is constructed with the user interface, it can be applied to the image stack and the drift calculated via cross correaltion or phase correlation function. The drift vector is returned in form of an image, that can be applied to stacks.

The specimen drift correction scheme is proposed in the publication and an example workflow is given below. We have decided to not fully automize the drift correction, since the output of each step should be checked carefully. The quality of the drift correction can be very sensitive to the chosen filter conditions. As a first attempt always try to use a Gaussian line Filter for the Fresnel frequencies and a top head centerband aperture. For some data stacks this may enough to reliably find the specimen drift vector. This circumvents the effort necessary do undergo the full drift correction scheme.

Input

Assign: Assigns the frontwindow image stack to the Userinterface.
Hanning: Apllies a realspace hanning window with radius=0.5* image width/height to the stack center.

Aperture

Load: Assigns frontmost image as working aperture.
Save: Saves current working aperture as image.

Radial masks

Top-head: Applies an top-head mask to working aperture. The radius is given in pixel by Radius
B`worth: Applies a Buttherworth to working aperture. The radius is given in pixel by Radius and its order is defined
     by an user dialog.
Radius: . Radius in pixel used for Top-head and B`worth
Positive: Adds a positive spot mask at the most intense pixel inside the current ROI. The radius is given via user
     dialog.
Negative: Adds a suppresses FFT signal inside the spot mask at the most intense pixel inside the current ROI.
     The radius is given via user dialog.
Blur: Adds Gausssian blur to the edge of an exsiting Top-head The blur width is given in pixel as user dialog input.
Undo: Reverts the last action affecting the working apertue.

Holography

Sideband: Removes the most intense bragg peaks inside the sideband. The number of peaks to remove is user input
    dialog.
Fresnel: Not fully implemented yet. Should use a gausssian line filter to mask the fresel streak.

Measure

XCF: Use the Cross correlation function (XCF) to calculate the drift for the active reciprocal mask image and the
   acitve image cube.
PCF: Use the Phase correlation function (PCF) to calculate the drift for the active reciprocal mask image and the
   acitve image cube..

[✓] Pairwise: If checked, the drift vector calculated by XCF or PCF uses the predecessing image of the cube.
       If unchecked, the first image of the series is used insted as ankor for all images.

Max X: Maximum drift vector component $x$ of a applied drift series. Useful for new Field of view.
Max Y: Maximum drift vector component $y$ of a applied drift series. Useful for new Field of view.

Drift Sequence

Load:Loads a drift vector image created with XCF or PCF.
Apply:Applies a drift vector image created with XCF or PCF to the active image cube.

Phase shifting series reconstruction

This notation strictly follows the original phase shifting holography reconstruction approach by Ru et al. Once a phase shifting hologram series of $n$ images has been aqcuired and the specimen drift correction has been done, the complex exitwave can be reconstructed from the series $I(n)$. $C_i$ describe complex images, that should be recovered from $I(n)$ by solving the least squared problem in matrix form.

$$ I(n) = C_1 + C_2 \exp [+i \phi_n] + C_3 \exp [ -i \phi_n],$$

This equation can be rewritten in matrix form:

$$(1,exp[ +i \phi_n],exp[-i \phi_n] ) \left(\begin{array}{c} C_1\\ C_2 \\ C_3 \end{array}\right) = I(n) $$

Multiplying both sides of the equation by $(1, exp[-i\phi_n], exp[+i \phi_n])^T$, and then summing both sides of the equation over $n$ leads to a $3×3$ matrix expression:

$$\left( \begin{array}{ccc} N & \sum_{n}\exp(+i \phi_n) & \sum_{n}\exp(-i \phi_n)\\ \sum_{n} \exp(-i \phi_n) & N & \sum_{n}\exp(-2i \phi_n) \\ \sum_{n} \exp(+i \phi_n) & \sum_{n}\exp(+2i \phi_n) & N\\ \end{array} \right) \left(\begin{array}{c} C_1\\ C_2 \\ C_3 \end{array}\right) = \left(\begin{array}{c} \sum_{n} I(n)\\ \sum_{n} \exp(-i \phi_n) I(n) \\ \sum_{n} \exp(+i \phi_n)I(n) \end{array}\right) $$

The equation can be solved effeciently by inverting the $3×3$ matrix $\underline{\underline{M}}$.

$$\left(\begin{array}{c} C_1\\ C_2 \\ C_3 \end{array}\right) = \underline{\underline{M}}^{-1} \cdot \left(\begin{array}{c} v_1\\ v_2 \\ v_3 \end{array}\right) $$

Calculating $\underline{\underline{M}}^{-1}$ is done in the reconstruction Matrix section via a digital micrograph script with an embedded python routine.

The complex inverted matrix is needed as input to solve the above matrix equation by calculating $\underline{\underline{M}}^{-1}\cdot \vec{v}$ within the reconstruction Image step. Within our publication we use the following intensity notation for the series:

$$I(x,y,n) = a(x,y) + b(x,y) \cos[(2\pi x)/T_x + (2\pi y)/T_y +\Phi + \phi_n ]$$

The background contrast a(x,y), the fringe contrast b(x,y) and the exit-wave phase $\Phi(x,y)$ are real-images that can be calculated from the complex images $C_i$:

$$\begin{array}{l}a(x,y) = C_1 \\ b(x,y) = 2\sqrt{C_1 \cdot C_2} \\ \Phi(x,y)=atan2\left( \frac{Im(C_2)}{Re(C_2)} \mp (2\pi x)/T_x \mp (2\pi y)/T_y \right)\\ \end{array}$$

Note that the direction of the sign of $T_x$ and $T_y$ depends on the choice of the side band, that is used to calculate the phase ramp. Depending on the data the appropiate signs have to be used here. The measure function of TiltSeriesUI.s uses the side band located in the upper two quadrants.

After the matrix reconstruction process the fitted parameters $C_1$, $C_2$ and $C_3$ can be used to calculate the intensity $\hat{I}(n)$, that is predicted by the least squares model for each hologram of the series and the input phase values $\phi_n$ used for the reconstruction.

The goodness of fit $R^2$ (and the adj. $R^2$) can be calculated by R_sq_adj_from_ReconPS_Holo.s via:

$$R^2=1-\left(\frac{\sum_{n} \left[ I_i(x,y)-\hat{I}_i(x,i)\right]^2} {\sum_{n} \left[ I_i(x,y)-\left< \hat{I}_i(x,i)\right> \right]^2} \right)$$

Measure the carrier frequency phase

TiltSeriesUI.s
Input:

  • Phase shifting hologram series as 3D image cube
Output:
  • 1D image containing the $\phi_n$ of each hologram

The phase shift $\phi_n$ of the hologram carrier frequency of each hologram has to be measured by the Measure stack of TiltSeriesUI.s. The resulting line profile will be used as input for the next step.

Reconstruction Matrix

ReconPS_Holo_Matrix.s
ReconPS_Holo_Matrix_with_Fresnel.s
Input:

  • 1D image containing the $\phi_n$ of each hologram
Output:
  • Two 3x3 pixel images containing the real- and imaginary part of the corresponding inverted matrix
Account for Fresnel modulations

As Lei et al. have shown, in principle the cosine can be replaced by a Taylor series to account for the Fresnel modulation.

$$I_n(x,y)=a(x,y)+\sum_j b^j(y) \cdot \exp [\phi_n^j+2\pi i (q_c-q_j )]$$

The Fourier components are subsequently numbered by $j$. The phase shift of the $j$-th component with the frequency $q_j$ is described by $φ_n^j$ , while $q_c$ describes the hologram carrier frequency. The imatrix to invert has then $j×j$ components. This should in principle increase the fit accuracy by giving account to the Fresnel modulations. We decided to not further follow this approach, because the gain in the goodness of fit was small (~3% $R^2$ gain) compared to the possible risk of overfitting. In our test we used integer fractions of the carrier frequency as Fourier series components, while it may be beneficial to find a proper way to extract them directly from the series or use a theoretical prediction by parametrisation of the Fresnel-modulation for the experimental conditions.

We have implemented the Taylor series reonstruction as digital Micrograph script ReconPS_Holo_Matrix_with_Fresnel.py.

Reconstruction Image

ReconPS_Holo_Image.s
ReconPS_Holo_Image_FresnelDiff.s
Input:

  • 1D image containing the $\phi_n$ of each hologram
  • Drift corrected 3D image cube containing the phase shifting series
  • Two 3x3 pixel images containing the real- and imaginary part of the corresponding inverted matrix
  • Two float number $T_x$ $T_y$ the fringe spacing in pixels in x- and y direction. Note that their sign depends on the choice of the side band maximum to calculate the phase shift. And may have to be adapted. By default (both positive) we assume, that the one that is used is in the upper left quadrant. If it is located in the upper right quadrant, flip the sign of $T_x$.
Output:
  • background constrast image a(x,y)
  • fringe constrast image b(x,y)
  • phase image $\Phi(x,y)$
  • tilt series model prediction $\hat{I}(n)$ as 3D image cube

Reference correction

Amplitude $A(x,y)$ and phase $\Theta(x,y)$ of the exit wavefunction with respect to the reference can be calculated from the reconstructed images by

$$\begin{array}{l}\text{A}(x,y)/ \text{A}_{ref}(x,y) = \sqrt{\frac{a(x,y)}{(a_{ref} (x,y)/2}-1}\\\ \Theta(x,y)= \Phi(x,y)-\Phi_{ref}(x,y) \end{array}$$

Copyright and Disclaimer

Disclaimer

All product and company names are trademarks or registered trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them. All scripts are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

All product and company names are trademarks or registered trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.

About

Software package collecting scripts for the data collection and evaluation of phase shifting holography image stacks with Digital Micrograph Scripting and Tem Scripting for electron microscopy.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published