Guidelines for small script development: image acquisition

By Wouter Arts - May 24, 2018

Scripts are small software tools that help a Scanning Electron Microscopy (SEM) operator in their daily work. It can be used to automate a repetitive task, to scan large areas quickly, or to obtain a higher repeatability between measurements. To do this a software script must be developed. In this blog we will give guidelines how to develop a small script.


SEM workflows 

Typically, the workflow for SEM measurements consists of the following steps:
  • Sample prep and loading
  • Image acquisition
  • Analysis
  • Evaluation
  • Reporting
  • Conclusion/Action

This workflow is illustrated in Figure 1. Steps 1 to 4 can be automated using scripts. Sample preparation has been extensively covered in our previous blogs on sample preparation techniques and on how sputter coating assists your SEM imaging.

Image acquisition, step 1, is mostly self-descriptive and concerns all steps that are necessary to acquire a high-quality image. It starts with moving the sample to the right position under the microscope and setting image parameters. The task is completed by acquiring and saving the image.

Image analysis concerns the processing of images to obtain the physical quantities from the images. This could, for example, be:

  • Thresholding BSD images to quantify compositional differences in the image
  • Segment the image to find particles
  • Measure the working distance to detect a height step in your sample

phenom blog ppi guidelinesFigure 1: Scanning Electron Microscopy workflow


In the evaluation step
, the physical quantities are evaluated and categorized. This can be done by:

  • Counting particles based on their morphology
  • Determining the coverage on a sample
  • Counting the number of defects on a sample

In the reporting step, a report is made (automatically) that contains all relevant information to make a well-informed decision. The report could be:

  • The acquired images that contain useful information
  • Histograms showing information about the sample such as coverage or size distributions
  • A complete PDF report with tables, graphs and images

If a script is made in an effective way, all these steps can be made with a single click of a button and a report will roll out once acquisition and processing is finished. Then all the operator has to do is check the report and decide what action is appropriate.

In this blog we will focus on the first step of script development and explain how to acquire images efficiently and with the most suitable quality. In future blogs we will explore the other steps in more detail.

 

Acquiring images with the Phenom through PPI

In my previous blog, I have already shown how easy it is to capture an image with the Phenom through PPI. This time I’ll show the full potential of the image acquisition methods in PPI, and how easy it is to get these images in Python.

Image acquisition is a method of the Phenom class. To acquire an image with the preferred settings we have to create an object containing the image acquisition parameters. This class is called: ScanParams. The scan parameters class contains the following attributes:

  • size: The dimensions (resolution) of the image to scan.
  • detector: The detector configuration.
  • nFrames: The number of frames to average for signal to noise improvement.
  • hdr: The option to use the High Dynamic Range mode, to create 16-bit images.
  • scale: The scale of the acquisition within the field of view.

The detector is a separate class (called: detectorMode) that needs to be provided to the scan parameters. This class has the following options:

  • All: Use all BSD detector segments
  • NorthSouth: Subtract the bottom two BSD segments from the top two (Topo A)
  • EastWest: Subtract the left two BSD segments from the right two (Topo B)
  • A: Select only BSD segment A
  • B: Select only BSD segment B
  • C: Select only BSD segment C
  • D: Select only BSD segment D
  • Sed: Select SE detector

This might all seems a bit intimidating, but it is very easy to use in Python with PPI. To show this, I created a little code snippet that will acquire an image using the Topo A mode of the Phenom. The other settings will be: resolution: 1024x1024 pixels; number of frames: 16; high definition mode: off (an 8-bit image will be acquired); and the image is not scaled. The code is:

ppi scriptFigure 2: Acquiring images in PPI

In the first line, PPI is loaded into Python. After that the Phenom object is created and the connection to the Phenom is set up. The scanParams are initialized and filled out according to the settings described in the previous paragraph. Acquiring the image is completed by calling the phenom.SemAcquireImage method while passing the scan parameters into it and the image is obtained.

 

Developing a real-life small script

To illustrate how a script is developed, we will show how a real-life script is developed. This script will image a copper-aluminum sample and find the boundary between these elements. The script will first determine what the characterizing parameters of copper and aluminum are. It will use these characteristics to move the sample to a position in which both aluminum and copper are visible. The copper-aluminum stub is used in the calibration of energy-dispersive X-ray spectroscopy, Figure 3 shows an image of the stub.

copper aluminium sampleFigure 3: The copper aluminium sample


First, it is important to know how you can differentiate between copper and aluminum in a SEM. In this blog
 it is explained that the gray-value of the BSD-image is directly correlated to the z-value of the atoms on the sample. This can be used to differentiated between copper and aluminum. Copper is lighter than aluminum and will therefore appear darker on the image.  

The contrast information is best obtained using 16-bit images. In 16-bit images entire registry from the ADC (analog-digital converter) is used instead of a sub-selection of this information. This is better than using 8-bit images because no auto-contrast/brightness needs to be applied between the images. Therefore, no information is lost, and images can be directly compared.

Figure 3 shows that the center of the stub is copper and its outer edge is aluminum. This geometrical information can be used in the process. For this example, we position the sample in the center stub position in the Phenom XL, or in the normal stub position in the P-series. To determine the gray-level of the copper part we take an image at the center of the stub. The gray level of the aluminum is determined by moving the stage by 0.5 cm to the right. To ensure that there is no overlap, the horizontal flied of view is set to 500µm.

The images that have been acquired are plotted to validate they are correct. Matplotlib is used for plotting, it is a versatile plotting tool that is commonly used in Python. More information on Matplotlib can be found here.

To acquire the images, move the stage and plot using the following code:

ppi scrip to acquire imagesFigure 4: PPI script to acquire an image of the copper and aluminum part of the stub

The script in Figure 4 first loads PPI and Matplotlib into Python and sets-up the connection to the Phenom. It then moves the sample to the central location, assuming that the sample is loaded into the Phenom and is in focus (this can, of course, also be automated, but I’ll leave that as an exercise for the reader). The horizontal field of view is set to 500µm with phenom.SetHFW.

The image settings can be set to a relatively low quality because the average of the gray value is barely influenced by it. A resolution of 256x256 is plenty for statistics (there are still more than 65,000 data points!). The BSD-detector is used with the ppi.detectorMode.All. A short integration time is also acceptable as the noise in the image is dominated by white noise. White noise will only increase the width of the gray-value spectrum (or in other words increase the standard deviation) but it will not change the average. I chose a very aggressive approach here by taking just 1 frame. After the first image is saved, the stage is moved by 0.5 centimeters to the right and a second image is acquired. These images are plotted using the plt commands, which call the Matplotlib package for plotting.

These speed-tweaks in the scripts are often rather important to consider. In many well written scripts, the acquisition time dominates the execution time of a script. For example, if we had taken the acquisition parameters as shown in Figure 2, the acquisition time would be a factor of 20 slower - from about 4 seconds per image to 0.2 seconds. For scripts that acquire many images, it is especially important that the right set of image parameters is chosen.  


images plotted with Matloplib

Figure 5: Acquired images of the copper and aluminum parts of the stub; plotted with Matplotlib 


The next step would be to analyze the images and obtain the gray values, find the border and move the stage to exactly the right location. This will be covered in my next blog, which will be published in a few weeks.

Can’t wait to learn more about developing small scripts? Already want to know more about PPI? In our PPI spec sheet you can read everything about the possibilities of PPI.

Download the free spec sheet here:

Download your Phenom Programming Interface sheet

 


About the author

Wouter Arts is Application Software Engineer at Thermo Fisher Scientific, the world leader in serving science. He is interested in finding new smart methods to convert images to physical properties using the Phenom desktop SEM. In addition, he develops scripts to help companies in using the Phenom desktop SEM for automated processes.

Press Room | Privacy Policy | Terms of Use | Sitemap