This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Automatic Tree Ring Detection using Jacobi Sets

Kayla Makela Dept of Computational Mathematics, Science and Engineering, Michigan State University Tim Ophelders Dept of Computational Mathematics, Science and Engineering, Michigan State University Dept of Mathematics and Computer Science, TU Eindhoven Michelle Quigley Dept of Horticulture, Michigan State University Elizabeth Munch [email protected]
The work of EM was funded in part by NSF-CCF-1907591. The work of EM and DC was funded in part by NSF-DEB-1904267. Dept of Computational Mathematics, Science and Engineering, Michigan State University Dept of Mathematics, Michigan State University
Daniel Chitwood Dept of Horticulture, Michigan State University Dept of Computational Mathematics, Science and Engineering, Michigan State University Asia Dowtin Dept of Forestry, Michigan State University
Abstract

Tree ring widths are an important source of climatic and historical data, but measuring these widths typically requires extensive manual work. Computer vision techniques provide promising directions towards the automation of tree ring detection, but most automated methods still require a substantial amount of user interaction to obtain high accuracy. We perform analysis on 3D X-ray CT images of a cross-section of a tree trunk, known as a tree disk. We present novel automated methods for locating the pith (center) of a tree disk, and ring boundaries. Our methods use a combination of standard image processing techniques and tools from topological data analysis. We evaluate the efficacy of our method for two different CT scans by comparing its results to manually located rings and centers and show that it is better than current automatic methods in terms of correctly counting each ring and its location. Our methods have several parameters, which we optimize experimentally by minimizing edit distances to the manually obtained locations.

1 Introduction

Tree ring widths provide important data sources for dendrochronologists, climatologists, archaeologists, and more. The patterns of widths between rings can be used to date the trees because they will line up between similar trees due to being subjected to the same climactic patterns [7]. This process of comparing width sequences is known as crossdating and allows dendrochronologists to assign a specific year to each annual growth ring. Further, the ring can give information about that year, such as the amount of precipitation or an environmental event such as a forest fire [8].

However, obtaining tree ring measurements takes extensive manual work. There has been considerable progress towards automation of this task in the realms of computer vision and machine learning, but most still require some amount of user interaction, such as marking the center or a measurement path. Deformations in rings, doubled or missing rings, and cuts in the wood can make reliable recognition difficult [2]. Further, features indicating ring boundaries may vary between types of trees. For example, trees near the equator where season climactic variations are minimal do not tend to produce annual rings [16].

There are a variety of programs available which offer the measurement of tree rings from images. Some of the most prominent commercial software include LIGNOVISION™ [11] and WinDENDRO™ [18]. However, these programs are closed-source and require substantial user interaction. There have been many open-source attempts based on varying methods of computer vision and image processing [3, 10, 15], deep learning [6], and GIS [1]. However, these methods still struggle to produce highly accurate results without user interaction, usually requiring a manual marking of the center or a measurement path.

Refer to caption
Refer to caption
(a) Red cedar disk.
Refer to caption
Refer to caption
(b) Spartan branded disk.
Figure 1: Images of the tree disk samples used to test the method with a slice of the 3D XRay CT scan shown in the bottom row. The blue dot shows the location of the center as determined by the method described in Sec. 2.1.

To remedy these issues, this paper presents an automated procedure for the full pipeline of tree ring analysis drawing from tools in topological data analysis [12]. First, we utilize Sobel filters [9] and region blurring for pith location, then we compute Jacobi sets for edge detection [5], and finally use persistent homology to refine the edge results [4]. After pith detection, the located centers are refined using a line of best fit to ensure continuity between slices. 2D slices of the 3D CT scan are converted to polar coordinates using their calculated centers to straighten out the rings for simpler edge recognition. Blurring and thresholding are used to clean up noise, each associated with a parameter which can be tuned to improve accuracy.

The data used in this paper to test the algorithm consists of two 3D CT scans of different tree disks, labeled Red cedar and Spartan. These tree cores were obtained on the campus of Michigan State University and are shown in Figure 1. The Red Cedar disk is labeled by its species; the species of the Spartan disk is undetermined, but it is labeled for its external branding which does not appear in the scans. We compare the results of our ring finding algorithm with the recent open-source program MtreeRing.

2 Methodology

Our method consists of two stages. First, we locate the center of a 2D cross-section of a disk, using the algorithm presented in Section 2.1. This center defines a radius for every point on the disk, and consequently defines the width of a tree ring at a particular angle. The goal of the second algorithm (presented in Section 2.2) is to output a list of numbers indicating the position or width of rings on a given ray emanating from the center of the slice.

2.1 Center Location

Refer to caption
Figure 2: The center finding procedure. The top row shows the directions used for the Sobel filter, whose output is shown in row (a). Row (b): blurred absolute values of row (a). Row (c): average intensity of row (b) at corresponding coordinates. Row (d), left: mask used for averaging in row (c). Center: sum of row (c), with location of minimum marked. Right: location of minimum overlaid on original slice.

The first task is to find the center, or pith, of the given tree disk; an example of this procedure is shown in Fig. 2. Our proposed method of center location relies on Sobel filters, which is a derivative mask commonly used for feature detection in computer vision [9]. The goal of the Sobel filter is to approximate gradients in an image, so pixels with the highest magnitude of gradient can be designated as belonging to edges. The Sobel operator is defined in the horizontal and vertical direction, as well as the two diagonal directions by 3×33\times 3 convolution kernels SxS_{x}, SyS_{y}, SxyS_{xy}, and SyxS_{yx}:

Sx\displaystyle S_{x} =(101202101),\displaystyle=\begin{pmatrix}[r]-1&\hphantom{-}0&\hphantom{-}1\\ -2&0&2\\ -1&0&1\end{pmatrix}\!\!,\!\!\! Sxy=12(220202022),\displaystyle S_{xy}=\frac{1}{\sqrt{2}}\begin{pmatrix}[r]-2&-2&\hphantom{-}0\\ -2&0&2\\ 0&2&2\end{pmatrix}\!\!,
Sy\displaystyle S_{y} =(121000121),\displaystyle=\begin{pmatrix}[r]1&2&1\\ 0&0&0\\ -1&-2&-1\end{pmatrix}\!\!,\!\!\! Syx=12(022202220).\displaystyle S_{yx}=\frac{1}{\sqrt{2}}\begin{pmatrix}[r]0&2&\hphantom{-}2\\ -2&0&2\\ -2&-2&0\end{pmatrix}\!\!.

For a single two-dimensional slice, consider the Sobel filter based on SxS_{x}, shown in the top left of Fig. 2. This filter assigns higher absolute values to vertical edges. In the context of tree rings, we expect very few vertical edges at the xx-coordinate of the center (since tree rings cross that xx-coordinate in a perpendicular fashion), and more or longer vertical edges at xx-coordinates further away from the tree center. In particular, we expect the Sobel filter in a given direction to produce, on average, higher absolute values at coordinates (in that direction) away from the center; see row (b) of Fig. 2. In order to ignore edges that occur in the background of the image, we identify the pixels that are part of the tree disk using a mask. Such a mask can viably be obtained using a threshold intensity when using X-ray CT scans, as well as when working with pictures taken against a contrasting background. The used mask is shown in the left column of row (d) of Fig. 2.

After blurring the absolute values resulting from the Sobel filter, we take, at a given xx-coordinate, the average over all pixels that lie on the tree disk, see row (c) of Fig. 2. If for a given xx-coordinate, fewer than a threshold number of pixels (100 in our case) lie on the tree disk, we default to the maximum value over the image, rather than the average at that xx-coordinate. This results in a function that assigns to any xx-coordinate, a quantity representing how vertically oriented the rings at that xx-coordinate are. We similarly compute a function that represents how horizontally oriented the rings are at a given yy-coordinate, and similar functions for the two diagonal directions; shown in rows (a-c) of columns 2-4.

Intuitively, two such functions can be combined to locate the center of the disk: look for the (x,y)(x,y)-coordinate with a minimum number of rings oriented vertically at the xx-coordinate, and a minimum number of rings oriented horizontally at the yy-coordinate. However, considering only the xx- and yy- directions is not very robust, as radial cracks may form in disks cut from felled trees, as can be seen in the Red Cedar disk, Fig. 1. This creates an edge that is oriented in the direction perpendicular to that of the rings at a given xx- or yy-coordinate, and may give the function an undesirably high value at the center of the disk. To remedy this, we also use the diagonal directions, as it is unlikely for a disk to have cracks in multiple directions. In our final step (see Fig. 2, row (d), columns 2 and 3), we sum for each pixel, the four directional functions at the corresponding coordinate, and identify the location of the pixel with minimum value as the center of the disk.

In the case of a 3D image, we can repeat this process for every 2D slice, and take a line of best fit to ensure that the centers move continuously between adjacent slices. Given the center of a particular 2D slice, we transform the slice into polar coordinates, so that yy-coordinates correspond to angles, and xx-coordinates correspond to distance from the center. To avoid loss of information around the edges of the images, we pad the top of the image with rows from the bottom of the image. These padded polar images represent the end of the preprocessing stage and are shown in Figure 3.

Refer to caption
(a) Red cedar.
Refer to caption
(b) Spartan.
Figure 3: Padded polar images.

2.2 Ring Detection

The next step in the tree ring analysis is to detect the ring boundaries, which is a problem of edge detection in image processing.

For our tree disk scans, we consider two functions associated with the polar image.

  1. 1.

    The intensity value f(x,y)f(x,y) of a 2D grayscale image can be interpreted as a continuous function (by interpolating between adjacent pixels) from a 2D domain.

  2. 2.

    The yy-coordinate g(x,y):=yg(x,y):=y of pixels of a 2D image can similarly be interpreted as a continuous function with the same domain.

To detect ring boundaries, we use a method based on Jacobi sets [5]. The Jacobi set of two real-valued functions with the same domain (such as the ones defined above) is defined as the set of critical points of one function restricted to the level sets of the other. For our functions ff and gg, the Jacobi set corresponds to (a) the local minima and maxima of intensity value at any fixed yy-coordinate, as well as (b) the critical values of gg on components of a fixed intensity. For two sufficiently well-behaved functions (i.e. Morse functions), the Jacobi set forms a collection of paths [5], which we can think of as ridges and valleys of type (a), pairs of which end at points of type (b). These ridges and valleys are shown for Red cedar in Fig. 4. In most conifer trees, the ridges correspond to ring boundaries. However, in some species, such as the Spartan sample, the valleys indicate rings boundaries.

Refer to caption
Refer to caption
Figure 4: The results of the ring detection method. At top is the result of the Jacobi set detection method on Red cedar with a closeup shown below. Ridges in yellow corresponding to rings in this species; valleys in blue corresponding to rings in some species.
Refer to caption
Figure 5: The areas that determine pp’s area-based persistence.

Area-based persistence [13] is applied to the Jacobi results as follows in order to clean up noise and assign high values to ridges based on their persistence. Area-based persistence works by assigning a persistence value to each pixel. For a particular pixel pp, this assignment is based on the intensities of pixels in its row (i.e. the restriction of ff to the yy-coordinate of that pixel). If the intensity of pp is not a local minimum (in its row), the persistence value of pp is zero. On the other hand, if p=(xp,yp)p=(x_{p},y_{p}) is a local minimum, we locate the closest pixels =(xl,yp)\ell=(x_{l},y_{p}) and r=(xr,yp)r=(x_{r},y_{p}) to its left and right that have less intensity (so that f(x,yp)f(xp,yp)f(x,y_{p})\geq f(x_{p},y_{p}) for xx between \ell and rr), and compute the areas

Aleft(p)\displaystyle A_{\text{left}}(p) =xxpmax(0,f(x,yp)f(xp,yp))𝑑x, and\displaystyle=\int_{x_{\ell}}^{x_{p}}\max(0,f(x,y_{p})-f(x_{p},y_{p}))dx\text{, and}
Aright(p)\displaystyle A_{\text{right}}(p) =xpxrmax(0,f(x,yp)f(xp,yp))𝑑x\displaystyle=\int_{x_{p}}^{x_{r}}\max(0,f(x,y_{p})-f(x_{p},y_{p}))dx

under the intensity function above the intensity of pp, see Fig. 5. The persistence value of pixel pp will be the area of the smaller side: min{Aleft(p),Aright(p)}\min\{A_{\text{left}}(p),A_{\text{right}}(p)\}. Intuitively, more significant local minima (valleys) will lie between mountains that are high (in terms of area), so significant minima will be assigned a high persistence value. A symmetric method can be used to find persistent ridges (maxima). The persistence value of a minimum (or maximum, depending on the type of tree) corresponds to the certainty with which we call it a tree ring boundary. As such, we mark all minima or maxima that have at least some threshold persistence value as ring boundaries.

In the next section, we explore different threshold values, and validate our method against manually called ring boundaries, as well as state-of-the-art software. Results of persistence with different choices of thresholds and blur parameters are shown in Fig. 6 for the red cedar disk, and in Fig. 7 for the Spartan disk.

Refer to caption
(a) Blur 0, pre- and post- threshold 0.
Refer to caption
(b) Blur 1, pre-threshold 0.12, post-threshold 0.02.
Refer to caption
(c) Closeup.
Refer to caption
(d) Closeup.
Figure 6: Red cedar results before and after persistence based filtering. At left are the detected local maxima with 0 for both blur and thresholding. At right, the same slice with blur 1, pre-threshold 0.12, and post-threshold 0.02.
Refer to caption
(a) Full.
Refer to caption
(b) Closeup.
Figure 7: Spartan results with minimum cost. Blur 2, pre-threshold 0.16, post-threshold 0.

3 Evaluation of Results

The end goal of the algorithm is to output a list of numbers indicating the positions or widths of rings along a given path through a slice of the tree core. We test our results against the ground truth, created by manually marking ring boundaries on the image using ImageJ [14] software. Thus, we next need to compare these two lists, being vigilant for falsely identified or missing rings. There are three parameters that impact the performance of the algorithm: the blur value during the persistence process and two thresholds, before and after edge detection. We develop a cost function based on string edit distances to compare various combinations of parameters.

3.1 Tree Ring Edit Distance

We use a traditional form of the edit distance [17] to compare sequences of tree ring widths. For each run of the scoring code, two text lists of x-values are compared using matching and costs based on distance. Once pairs are matched, the algorithm places a cost on each of three operations: 200 to add a point (resolve false negative), 200 to remove a point (resolve false positive), and the distance in pixels between two points to move a point (resolve minor errors in placement). The choice of 200 is high enough to make missing or false rings the dominant factor in the cost, and low enough to still be affected by placement errors. Note that the positions of the rings in the ground truth data set are marked by the researcher and thus are also subject to human error.

Refer to caption
(a) Red cedar threshold combinations with blur fixed at 1.
Refer to caption
(b) Spartan threshold combinations with blur fixed at 2.
Figure 8: The heat maps show the edit distance between the computed ring locations and the ground truth for different parameter combinations; darker is lower cost, thus meaning that choice of parameters does a better job of approximating the ground truth locations. Best performance for Red cedar comes with blur 1, pre-threshold 0.12, and post-threshold 0.02. Best performance for Spartan comes with blur 2, pre-threshold 0.16, and post-threshold 0.

3.2 Parameter Choices

We examine edit distance costs for various combinations of the three aforementioned parameters: pre-threshold, blur, and post-threshold. Both thresholds range from 0 to 0.2n0.2\cdot n where nn is the maximum intensity value in the image. The blur value is the value of σ\sigma in a Gaussian blur filter, which indicates the standard deviation for the Gaussian kernel. Exploring these options between species allows us to consider which parameters can be fixed and which will need to be input or determined by the image. Costs for various parameter combinations with fixed blur value are shown in Figure 8. A higher blur value for the Spartan sample performs better, likely due to the increased space between rings as compared to the Red Cedar sample. The results with the minimum cost for Red Cedar are shown in Figure 6, and for Spartan in Figure 7. The matching for these results is shown in Figure 9.

3.3 Comparison with MtreeRing

MtreeRing is a newer open-source program in R for tree ring analysis which compares favorably with prominent software such as WinDENDRO™ [15]. We compare our results with MtreeRing using the edit distance cost we have developed.

For the same row on the same slice of each tree sample, we compute the tree ring boundaries using both our method and MtreeRing. For the Red Cedar sample, the output of our program has a cost of 964 whereas the MtreeRing LinearDetect output costs 2841. For the Spartan sample, our cost is 2213 and MtreeRing has cost 2661.

Refer to caption
(a) Red Cedar, our algorithm (cost 964).
Refer to caption
(b) Red Cedar, MtreeRing LinearDetect (cost 2841).
Refer to caption
(c) Spartan, our algorithm (cost 2213).
Refer to caption
(d) Spartan, MtreeRing LinearDetect (cost 2661).
Figure 9: Comparing the best results of our algorithm to the best results of MtreeRing for both disks. Matchings between the human-annotated ground truth (blue) and computed ring locations (orange).

4 Conclusion

This paper has presented a new method of automatic center and ring detection for scans of tree cores. The most far reaching effects will come from the fact that very little human input is necessary, particularly comparing with the state of the art software, the most accurate of which requires a human-drawn line to use in computations. We are currently working to incorporate improvements to this method can be made in terms of accuracy and applicability across tree species, specifically in terms of ring boundary detection. First, care will need to be taken to consider missing or double rings which will likely require significant collaboration with dendrochronologists. To avoid choosing a measurement path, which may run into knots in the wood or other obstacles, a study of volume between rings could be made in three dimensions. Nonetheless, these computational advancements in dendrochronology have the potential to speed up tree ring analysis and therefore provide more data to climatologists and others for further understanding of climate change.

References

  • [1] Salvador Arenas-Castro, Juan Fernández-Haeger and Diego Jordano-Barbudo “A Method For Tree-Ring Analysis UsingDiva-GisFreeware On Scanned Core Images” In Tree-Ring Research 71.2 Tree-Ring Society, 2015, pp. 118–129 DOI: 10.3959/1536-1098-71.2.118
  • [2] Franco Biondi “From Dendrochronology to Allometry” In Forests 11.2 MDPI AG, 2020, pp. 146 DOI: 10.3390/f11020146
  • [3] Andrew Bunn “A dendrochronology program library in R (dplR)” In Dendrochronologia, 2008
  • [4] Herbert Edelsbrunner and John Harer “Jacobi Sets of Multiple Morse Functions” In Foundations of Computational Mathematics, 2002
  • [5] Herbert Edelsbrunner and John Harer “Jacobi sets of multiple Morse functions” In Foundations of Computational Mathematics, 2004, pp. 35–57
  • [6] Anna Fabijańska and Małgorzata Danek “DeepDendro - A tree rings detector based on a deep convolutional neural network” In Computers and Electronics in Agriculture 150C, 2018 DOI: 10.1016/j.compag.2018.05.005
  • [7] C. Ferguson “Concepts and Techniques of Dendrochronology”, 1970
  • [8] Ernst-Detlef Schulze Fritz H. “Atlas of Woody Plant Stems” Springer-Verlag Berlin Heidelberg, 2008
  • [9] N. Kanopoulos, N. Vasanthavada and R.. Baker “Design of an image edge detection filter using the Sobel operator” In IEEE Journal of Solid-State Circuits 23.2, 1988, pp. 358–367
  • [10] W. Lara and Felipe Bravo “measuRing: An R package to measure tree-ring widths from scanned images” In Dendrochronologia, 2015
  • [11] “Lignovision™” RINNTECH® RINNTECH®
  • [12] Elizabeth Munch “A User’s Guide to Topological Data Analysis” In Journal of Learning Analytics 4.2, 2017 DOI: 10.18608/jla.2017.42.6
  • [13] Tim Ophelders, Willem Sonke, Bettina Speckmann and Kevin Verbeek “Kinetic volume-based persistence for 1D terrains” In 35th European Workshop on Computational Geometry (EuroCG), 2019, pp. 38:1–38:7
  • [14] C.. Rueden, J. Schindelin and M.C. al. “ImageJ2: ImageJ for the next generation of scientific image data” In BMC Bioinformatics 18.529, 2017 DOI: 10.1186/s12859-017-1934-z
  • [15] Jingning Shi, Wei Xiang, Qijing Liu and Sher Shah “MtreeRing: An R package with graphical user interface for automatic measurement of tree ring widths using image processing techniques” In Dendrochronologia, 2019
  • [16] James H. Speer “Fundamentals of Tree-ring Research” University of Arizona Press, 2010
  • [17] Carola Wenk “Applying an edit distance to the matching of tree ring sequences in dendrochronology” In Annual Symposium on Combinatorial Pattern Matching, 1999 DOI: 10.1007/3-540-48452-3˙17
  • [18] “WinDENDRO™2019a” Regent Instruments Inc. Regent Instruments Inc.