=Paper= {{Paper |id=Vol-3027/paper84 |storemode=property |title=Improvement of an Algorithm for Determining the Interplanar Distances of the Crystal Structure of a Substance from Transmission Electron Microscopy Images |pdfUrl=https://ceur-ws.org/Vol-3027/paper84.pdf |volume=Vol-3027 |authors=Stepan Nebaba }} ==Improvement of an Algorithm for Determining the Interplanar Distances of the Crystal Structure of a Substance from Transmission Electron Microscopy Images== https://ceur-ws.org/Vol-3027/paper84.pdf
Improvement of an Algorithm for Determining the Interplanar
Distances of the Crystal Structure of a Substance from
Transmission Electron Microscopy Images
Stepan Nebaba 1
1
    Tomsk Polytechnic University, 30, Lenin Avenue, Tomsk, 634050, Russia

                Abstract
                The paper considers the previously developed automated algorithm for determining the
                interplanar distances of the crystalline structure of a substance from images of transmission
                electron microscopy (TEM images), and also proposes a modification of the algorithm that
                allows to increase the automation level of obtaining the result. The question of automation of
                the process of normalization of images of crystal structures by angles of rotation is considered.
                Also, an alternative is proposed at the step of image binarization with a given threshold in the
                form of adaptive binarization with an automatically selected binarization window size. The
                improved algorithm was tested on a number of publicly available TEM images, and the
                interplanar distance measurements were compared with the measurements in the specialized
                software package named Digital Micrograph GMS 1.8. Comparison of the results showed that
                the proposed improved algorithm determines the distance with sufficient precision and fits
                within the range of measurement error for the considered images.

                Keywords 1
                Computer vision, image processing, image analysis, transmission electron microscopy,
                adaptive binarization

1. Introduction
   Algorithms of computer vision associated with the processing and analysis of raster images are
widely used in various fields of science [1-5], including in the field of processing images obtained using
electron microscopes. One of the key problems in these areas is the automation of assessing the
composition and structure of materials from their images. An effective solution of these problems
simplifies the tasks of non-destructive quality control of materials and products, their identification and
determination of their properties and appearance.
   Transmission electron microscopy (TEM) is used to assess the structure of the material, both in the
volume of the sample and in its surface region. TEM is one of the most highly informative research
methods used in materials science, solid state physics, biology, and other sciences [6].
   The development of information technology and computing devices contributes to progress in tasks
of automatic analysis of TEM images. However, nowadays, existing methods for identifying and
evaluating microobjects from a raster image do not have sufficient universality and automation. In
addition, these methods and algorithms are often part of proprietary software that is closely associated
with electronic microscopy equipment and is protected by the copyright of the manufacturers of this
equipment [6]. The cost of such equipment can be high, which limits the availability of professional
image analysis tools.
   At the same time, systems for analyzing such images can be widely demanded by many scientific
organizations as well as enterprises in the manufacturing sector, making it possible to carry out
operational control and analysis of the composition and structure of materials and products. Cheap

GraphiCon 2021: 31st International Conference on Computer Graphics and Vision, September 27-30, 2021, Nizhny Novgorod, Russia
EMAIL: stepan-lfx@tpu.ru (S. Nebaba)
ORCID: 0000-0001-9203-2170 (S. Nebaba)
             ©️ 2021 Copyright for this paper by its authors.
             Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0).
             CEUR Workshop Proceedings (CEUR-WS.org)
analogues of existing software for critical areas of enterprise activity can stimulate the development of
technologies for the synthesis, analysis and production of micro- and nanomaterials.
    Earlier in [8], an automated algorithm was proposed for estimating the value of interplanar distances
on images obtained in direct resolution mode, as well as an automated algorithm for determining the
crystal lattice parameters of material samples from electron diffraction patterns in selected area electron
diffraction images (SAED-images) was proposed in [9].
    The algorithm for measurement the interplanar distances in the TEM images, proposed in [8], had a
number of assumptions and manual operations, which require the participation or control of the
operator. In this paper, the improvements of a number of steps of the existed algorithm are proposed in
order to create its modification that requires much less participation of a specialist.

2. Opportunities to automate the existing algorithm
    To better match the idea of fully automatic measurement, an analysis of the possibilities of
automating the steps of the algorithm was made. The original algorithm consisted of the following
sequence of steps.
    1. Selection of a rectangular TEM image area suitable for evaluating the interplanar distances of
    the crystal structure of a material sample described by two points: (x1, y1) - (x2, y2).
    2. Selection of the image rotation angle R for orientation of the material sample layers relative to
    the horizontal axis of the image.
    3. Rotation of the image by the R angle using affine transformations.
    4. Choice of the image binarization threshold T to maximize contrast transitions between layers
    of the material sample.
    5. Binarization of the image with the selected threshold T.
    6. Calculation of a vector that sums the values of the image pixels brightness in columns, which
    makes it possible to obtain an estimate of the density of white pixels, which expresses the proximity
    to the center of the crystal structure layer (the higher values show the center of the layer where the
    number of white pixels is bigger, the lower values shows the center of interplanar space in the sample
    material where the number of white pixels less).
    7. Calculation of the first derivative of the vector of the sum of pixels. The transition of this
    derivative between negative and positive values characterizes the intersection of the layers of the
    crystal structure.
    8. Calculation of the number of layers in the selected area of the image by the vector of the sum
    of pixels and its derivative. Then it is possible to set the threshold for crossing the derivative of zero
    values by the absolute maximum and minimum of the derivative in the selected area of the image
    and assuming a sufficiently homogeneous structure within the measurement area.
    9. Calculation of the physical value of the average interplanar distance of the crystal structure of
    the sample of the material with found number of layers and the size of the selected in 1st step area of
    the image, assuming that the scale of the image of the sample of the material is known.
    The algorithm is described in more detail in [8]. In this algorithm, a number of stages require explicit
operator actions to specify the parameters, in particular, in steps 1, 2, 4 and 9 (to set the image scale).
1st step cannot be fully automated due to the impossibility of integral image evaluation by the proposed
algorithm. 2nd step, the search for the rotation angle R, and 4th step, the selection of the binarization
threshold T, are the most promising for automation process, since both the rotation angle and the
binarization threshold are discrete quantities, whose range of possible values is limited. The rest of the
steps are strictly deterministic and the process of their implementation is already fully automated.
    Since both parameters, the angle of rotation and the binarization threshold, are scalar values, the
range of possible values for two parameters can be represented as a surface (r, t, c), where r is a variable
characterizing the angle of image rotation, t is a variable characterizing the binarization threshold of the
image. In this case, c is the criterion, the value of which characterizes the proximity of the result of the
interplanar distance measurement to the true value of the interplanar distance of the material sample. In
this particular problem, this criterion c can be the difference between the maximum and minimum
values of the derivative of the vector of the sums of pixels, since, obviously, this variable will be
maximum under conditions when the layers of substance in the image are maximally contrasting and
are oriented strictly along the ordinate axis.
   Values of angles from 0 to 89 degrees and threshold values from 0 to 255 can be considered as
possible values of the parameters.
   Knowing the entire range of permissible parameters, it is possible to select the optimal parameters
for the tasks of image rotation and binarization iteratively over all values, based on the criterion of the
maximum difference in the values of the first derivative of the sum of pixels.

3. Improved algorithm for determining the interplanar distances of the
   crystalline structure of a substance
    During the implementation of the proposed method of automating the algorithm, it was revealed that
the adaptive binarization algorithm at 5th step is able to more accurately highlight the contrast transitions
between the layers of the material sample in the image.
    In this case the binarization parameter is the size of the window in which the neighboring pixels are
taken into account, and varies in the range from 1 to N (with a step of 2), where N is the minimum of
the linear dimensions of the selected area of the image (h,w). The surface of parameters transforms into
following view: (r, s, c), where s is a variable characterizing the adaptive binarization window size.
    From the above considerations, the improved algorithm for measurement of the interplanar distances
of the crystal structure of a substance in TEM images can be described as follows.
    1. Selection of the image area. This is similar to 1st step of the original algorithm. It is critical for
    the algorithm that the area should not cover image areas without a regular structure, or areas with
    multidirectional structures.
    2. Calculation of the image rotation angle R. This process consists of: rotation by an angle r in the
    range [0; 89], calculation of the vector of the sum of pixels and its derivative, calculation of the
    difference between the maximum and minimum of the derivative. A rotation angle R is selected
    based on the calculated differences, corresponding to the greatest difference.
    3. Rotation of the original image by the found angle R.
    4. Calculation of the size of the adaptive binarization window S in the range [1; N], where N is
    the smallest of the linear dimensions of the image (h, w). The criterion for choosing the parameter S
    is similar to the criterion for choosing the angle of rotation R at 2nd step.
    5. Adaptive binarization of the image with the found window size S.
    6. Steps 6-9 are completely analogous to the steps of the previously proposed algorithm.
    The result of the improved algorithm depends only on the choice of the area for measuring the
interplanar distance. Thus, it can be considered as the maximum possible automation of the algorithm
for estimating the interplanar distance of the crystal structure of a material sample in the TEM image
for operator-driven cases.

4. Testing of an improved algorithm
   A set of 24 publicly available TEM images was taken for testing. On these images it is possible to
visually determine the presence of the crystalline structure of a material sample. Examples of images
are shown in Figure 1.
                1                             2                              3




                 4                            5                              6
Figure 1: Examples of TEM images

   Figure 2 shows examples of TEM images which were rotated by automatically calculated angle R
for selected area of image (3rd step of the algorithm).




                1                             2                              3




                 4                            5                              6
Figure 2: Examples of rotated TEM images
   Figure 3 shows examples of TEM images which were transformed with an algorithm of adaptive
binarization and automatically calculated window size S (5th step of the algorithm).




                  1                               2                                3




                 4                                 5                               6
Figure 3: Examples of binary rotated TEM images
   Figure 4 shows visual representation of pixels sum vector of each image (6th step of the algorithm).




                  1                               2                                3




                 4                                5                                6
Figure 4: Examples of visual representation of pixels sum vector
   Table 1 presents parameters of the algorithm with which the tests were carried out, as well as the
final result of the measurements of the average interplanar distance in the image with improved
algorithm and with specialized software package Digital Micrograph GMS 1.8.

Table 1
Results of interplanar distances measurement with the improved algorithm and with the specialized
software package Digital Micrograph GMS 1.8
 Example          Area of      Angle of   Size of       Scale,       Distance       Distance
 number measurement, rotation, binarization pixels/nm               calculated     calculated
              (x1,y1)-(x2,y2),   R,     window, S,                   with the       with the
                   pixels      degrees    pixels                  algorithm, nm    specialized
                                                                                  software, nm
     1          (900,400)-       42          5            19          0.3864         0.3870
               (1500,1000)
     2          (600,600)-       63         31            74          0.2457         0.2468
               (1400,1400)
     3          (150,350)-       18         21            18          1.1904         1.1891
                 (450,650)
     4          (350,350)-       93         19            6.2         3.7221          3.714
                 (650,650)
     5          (600,600)-       12         25            56          0.3106         0.3117
               (1000,1000)
     6          (100,150)-       25         13           2.28         4.7619         4.7805
                 (300,350)



5. Analysis of the results
   As it can be seen from the test results presented in Table 1 and Figures Figure 1-Figure 4, the
proposed improved algorithm calculates the values of interplanar distances quite close to the values
obtained using the specialized software package Digital Micrograph GMS 1.8. Taking into account the
range of measurement error that is allowed in compressed raster images analysis, it is possible to make
a conclusion that the proposed algorithm correctly determined the interplanar distance on all images
used in testing, based on 2 predetermined parameters: the analysis area and the image scale. The
proposed algorithm requires less user involvement than the algorithm proposed in [8] and Digital
Micrograph GMS 1.8. Thus, the approach used in its development can be used in the area of algorithms
for processing TEM images, since there are many tasks in this direction, the automation of which is
important in research and production problems.

6. Acknowledgements
   The work was supported by RFBR, Grant 19-07-00844 A.

7. References
[1] S. Leutenegger, M. Chli, R.Y. Siegwart, BRISK: Binary Robust invariant scalable keypoints. In:
    Proceedings of the 2011 International Conference on Computer Vision, ICCV 2011, pp. 2548-
    2555. doi:10.1109/ICCV.2011.6126542.
[2] S.G. Nebaba, A.A. Zakharova, An Algorithm for Building Deformable 3d Human Face Models
    and Justification of its Applicability for Recognition Systems, SPIIRAS Proceedings 52 (2017)
    157-179. doi:10.15622/sp.52.8.
[3] R. Schettini, S. Corchs, Underwater Image Processing: State of the Art of Restoration and Image
    Enhancement Methods. EURASIP Journal on Advances in Signal Processing (2010).
    doi:10.1155/2010/746052.
[4] V. Sokratis, E. Kavallieratou, R. Paredes, K. Sotiropoulos, A Hybrid Binarization Technique for
    Document Images. In: Biba, M., Xhafa, F. (eds) Learning Structure and Schemas from Documents.
    Studies in Computational Intelligence. 2011, vol. 375, pp. 893-898. Springer, Berlin, Heidelberg
    (2015). doi:10.10007/10.1109/IADCC.2015.7154834.
[5] B. Alhadidi, M.H. Zu'bi, H.N. Suleiman, Mammogram Breast Cancer Image Detection Using
    Image Processing Functions, Information Technology Journal 6(2) (2007) 217–221.
    doi:10.3923/itj.2007.217.221.
[6] Ph. Sciau, Chapter Two - Transmission Electron Microscopy: Emerging Investigations for Cultural
    Heritage Materials, Editor(s): Peter W. Hawkes, Advances in Imaging and Electron Physics,
    Elsevier, Volume 198, 2016, pp. 43-67. doi:10.1016/bs.aiep.2016.09.002.
[7] Gatan Microscopy Suite Software. URL: https://www.gatan.com/products/tem-analysis/gatan-
    microscopy-suite-software.
[8] S.G. Nebaba, A.Y. Pak, A.A. Zakharova, Automated Algorithm for Determining the Interplanar
    Distances of the Crystal Structure of a Substance from Transmission Electron Microscopy Images.
    In: CEUR Workshop Proceedings, 2019, vol. 2485, pp. 248-251. doi:10.30987/graphicon-2019-2-
    248-251.
[9] S.G. Nebaba, A.Ya. Pak, Patterns Detection in SAED Images of Transmission Electron
    Microscopy. CEUR Workshop Proceedings, 2020, vol. 2763, pp. 319-322.
    doi:10.51130/graphicon-2020-2-3-63.