Analysing individual 3D tree structure using the R package ITSMe

Detailed 3D quantification of tree structure plays a crucial role in understanding tree‐ and plot‐level biophysical processes. Light detection and ranging (LiDAR) has led to a revolution in tree structural measurements and its 3D data are increasingly becoming publicly available. Yet, calculating structural metrics from LiDAR data can often be complex and time‐consuming and potentially requires expert knowledge. We present the R package Individual Tree Structural Metrics (ITSMe), a toolbox that works with LiDAR tree point clouds and quantitative structure models (QSMs) derived from LiDAR point clouds to obtain individual tree structural metrics. It serves as a robust synthesis framework for researchers who want to readily obtain structural information from 3D data of individual trees. The package includes functions to determine basic structural metrics (tree height, diameter at breast height, diameter above buttresses, projected crown area, 3D alpha crown volume) from individual tree point clouds, as well as more complex structural metrics (individual tree component volumes, branch angle‐, radius‐ and length‐related metrics) from QSMs. The ITSMe package is an open‐source package hosted on GitHub that will make the use of 3D data more straightforward and transparent for a range of end‐users interested in exploiting tree structure information.


| INTRODUC TI ON
Measurements of tree structure, defined as the 3D size and spatial arrangement of the basic components of a tree (e.g. twigs, branches, leaves), play a crucial role in understanding tree-and plot-level biophysical processes (e.g. photosynthesis and evapotranspiration ;Lau et al., 2018). In the past, tree structure quantification was limited to metrics that are easily measurable in the field, for example, the diameter at breast height (DBH) and the tree height (H). Yet, even these metrics are sometimes difficult to measure, for example, in tropical forests due to buttressed trees and dense canopies . More complex structural metrics that are, for instance, based on branching angles, lengths and radii are practically impossible to measure manually in the field for more than a handful of trees (Wilkes et al., 2021). Therefore, studies linking a tree's complex structure with, for example, its functionality or, biotic or abiotic environment, have remained limited (Verbeeck et al., 2019).
The emergence of light detection and ranging (LiDAR, also called laser scanning) and more specifically terrestrial laser scanning (TLS) in forestry has led to a revolution in tree structural measurements Malhi et al., 2018;Newnham et al., 2015). TLS is an active remote sensing technique that can accurately measure distances by transmitting laser pulses and analysing the returned energy as a function of time . Using laser scanners mounted on unoccupied aerial vehicles (UAV-LS) is also an interesting tool to monitor forest structure as it can cover larger areas in a fraction of the time compared to TLS . Calders et al. (2020) have shown that laser scanning data will play a critical role in understanding fundamental ecological questions about tree size and shape, allometric scaling, metabolic function and plasticity of form.
In the last decade, TLS and UAV-LS have been used to quantify the structural complexity of forest stands (Atkins et al., 2018;Ehbrecht et al., 2017;Terryn et al., 2021) and there has also been significant progress in the development of algorithms for individual tree detection, segmentation and reconstructive modelling which allows detailed quantification of individual tree structure. Several semiautomatic tree segmentation algorithms enable the user to quickly obtain individual tree point clouds from laser scanning data acquired at the plot level (Burt et al., 2019;Krisanski et al., 2021;Raumonen et al., 2021). From these individual (leaf-on) tree point clouds, tree structural metrics (e.g. the DBH, H, etc.) have been reliably measured Terryn et al., 2022). To infer volumes and complex structural metrics of trees, algorithms that model the tree point cloud using geometric shapes (often cylinders) have been developed (Åkerblom et al., 2017;Hackenberg et al., 2014;Pfeifer et al., 2004;Raumonen et al., 2013). TreeQSM (https://github.com/Inver seTam pere/TreeQSM) by Raumonen et al. (2013), a freely available quantitative structure model (QSMs) method, has been used for purposes such as the non-destructive estimation of AGB , tree species classification (Åkerblom et al., 2017;Terryn et al., 2020) and the quantification of branch architecture .
Increasingly, more datasets with tree point clouds and QSMs are becoming publicly available for a broader group of scientists that are not specifically trained in processing LiDAR point clouds Weiser et al., 2022). Moreover, laser scanning and 3D tree data are more frequently used by governments to upgrade their national forest inventories (Kükenbrink et al., 2022;Puletti et al., 2021), and can help to manage our natural capital through the evaluation of nature-based solutions projects that focus on carbon sequestration (Girardin et al., 2021). Hence, there is a growing need for accessible tools that translate the calculations of structural metrics into easy-touse and well-documented functions. The open-source software environment R, which ecologists widely use, is free, does not require a specific licence and can be used across many platforms with shared compatibility (Atkins et al., 2022). Thus, it is a suitable environment to develop and share 3D forest structure-related packages to stimulate forest structure-related research. Several of these packages in R already exist (Atkins et al., 2018(Atkins et al., , 2022, yet most focus on stand structure from airborne laser scanning. Of the TLS-related R packages, Atkins et al. (2022) identified, only the FORTLS package of Molina-Valero et al. (2022) allows for the determination of individual tree attributes from point clouds (DBH and H), but mainly focuses on providing these metrics and variables at stand level. Both the VoxR (Lecigne et al., 2017) and rTLS package (Guzmán et al., 2019) allow to determine the H, DBH and some volume and crown characteristics from tree point clouds but lack flexibility in the DBH measurement for different types of trees (e.g. buttressed trees) and a comprehensive user manual.
Moreover, no R package supporting the calculation of individual tree structural metrics from QSMs appears to be available ( Figure 1).
In this paper, we present the R package Individual Tree Structural Metrics (ITSMe), a toolbox that works with tree point clouds and QSMs in the TreeQSM format Raumonen et al., 2013), to obtain individual tree structural metrics efficiently The package can be freely downloaded from GitHub and is accompanied by a documentation website. The ITSMe package will lower the threshold for researchers to use forest and tree 3D data for various purposes (e.g. tree monitoring, linking tree structure to tree functionality or environmental factors).

| ITSMe availability
The current version (1.0.0) of the package ITSMe requires R version 2.10 or above and is distributed under the MIT licence. The package can be downloaded from GitHub at https://github.com/lmter ryn/ ITSMe. The current and future versions of the package will also be hosted at Zenodo (https://doi.org/10.5281/zenodo.6769105). The ITSMe website is available at https://lmter ryn.github.io/ITSMe/ and includes documentation of a complete workflow to help the user get acquainted with the package.

| Structural metrics
To determine individual tree structural metrics with the ITSMe package you only require tree point cloud files (txt, ply or las format with the x, y and z coordinate attributes of the points) and/or TreeQSM files (mat format). The package provides two read functions, one to read the tree point cloud file and one to read the TreeQSM file, that transform those files to the required input format for the other functions in the package (Table 1). Figure 2 presents a flowchart, illustrating the input, functions and output of the ITSMe package.

| Tree point cloud-based metrics
The ITSMe package includes functions to obtain the H, DBH, DAB, PA and AV from individual tree point clouds (Table 2). H is calculated as the height difference between the highest and the lowest point of the tree point cloud. In case, the lower part of the tree is not sampled (e.g. with low point density UAV-LS or in dense forests), a digital terrain model (DTM) can be provided and is used to estimate the lowest point of the tree.
DBH is calculated as the diameter of the optimal circle fitted through a horizontal slice of a chosen thickness (default 6 cm) around 1.3 m from the lowest point of the tree point cloud. To fit the circle, a least-squares circle fitting algorithm was applied . If there are branches at breast height (indicated by the residuals of the circle fit, or the estimated diameter is larger than 2 or larger than the diameter at 15 cm above ground), the lower trunk (up to 1.5 m) without the branches is extracted and a new circle fitting F I G U R E 1 Illustration of structural metrics that can already be determined using the packages available at the moment (blue) and those that the Individual Tree Structural Metrics (ITSMe) package offers additionally (red).

Support function Description
read_tree_pc Reads a tree point cloud file of txt, las or ply format For buttressed trees, the diameter needs to be determined above the buttresses (DAB). In this case, an iterative approach was implemented to determine the height above buttresses. Starting at 1.27 m to 1.33 m from the lowest point of the tree point cloud, the average residual between the points and the fitted circle is calculated. When the average residual exceeds a value of a user-defined parameter (thresholdbuttress, default = 0.001) times the radius, indicating a non-circular (irregular) stem shape and presumably buttresses, the process is repeated with a new slice 6 cm higher than the previous one until a slice above the buttresses is reached. When the maximum buttress height (user-defined parameter) is exceeded, the iterative process is restarted with a higher thresholdbuttress. Similar as with the fDBH, also a functional DAB (fDAB) is determined on the slice above buttresses.
The projected area (PA) is calculated as the area of a concave hull (with concavity as a user-defined parameter) constructed for the points of the tree point cloud. The 3D alpha volume (AV) is The plot function is the function with which the metric is determined for multiple trees in a folder and the accompanying figure is produced.
calculated as the volume of the 3D alpha shape (with alpha as a userdefined parameter) generated for the points of the tree point cloud.
The crown is defined as the leaves and the woody part above the start of the lowest branch. The crown points can be identified and extracted using the classify_crown_pc function and given as the input point cloud to calculate the PCA and 3D ACV (

| QSM-based metrics
The ITSMe package includes functions to extract structural metrics from TreeQSMs (Table 3). These include the H, DBH, tree volume, trunk volume, total branch volume, total branch length and total cylinder length. The functions work for QSMs with and without triangulation of the stem.
The ITSMe package also provides functions to extract more complex structural metrics from TreeQSMs (Table 4) These metrics can be calculated for a group of QSMs in a single folder using summary_qsm_metrics. Because TreeQSM uses a random seed to start the reconstruction process, there are likely differences between the resulting models. Therefore, multiple TreeQSM iterations are often made for a single tree. When multiple QSMs are provided for one tree in the input folder, the summary_qsm_metrics function additionally returns the mean and standard deviation for each structural metric of each tree (the tree point cloud files need to follow the naming conventions specified in the help files).

| Demonstration data
To demonstrate the applicability of the package, we discuss its use on a total of 1030 tree point clouds at three different sites (Table 5)

| DBH and DAB
The DBH measurement (dbh_pc) for different TLS tree point clouds is illustrated in Figure 4. The DBH fitting was successful (resembling In the case of buttressed trees, the diameter needs to be measured above the buttresses. This is implemented in the dab_pc function and illustrated in Figure 6. An RMSE of 4.8 cm is achieved for the buttressed trees in RC compared to the census data. The unit depends on the chosen normalisation (could be unitless or in meter).

TA B L E 4
List of the TreeQSM metrics defined by Terryn et al. (2020) and Åkerblom et al. (2017) and their respective functions in ITSMe TA B L E 5 Site details of the three sites used for the package demonstration

| QSM metrics
The summary_qsm_metrics function results in a matrix with each row representing a tree and each column representing a structural metric derived from the trees' QSM. These structural metrics matrices can be used for a range of purposes such as supporting tree species classification , evaluating a plant structural economics spectrum (Verbeeck et al., 2019), or exploring the link between tree structure and the environment. It can be used to monitor the structural dynamics within a plot or between plots.

| Outlook
At the moment, the QSM-based functions can only be used for QSMs reconstructed with TreeQSM (Raumonen et al., 2013). Yet, in the future, we aim to expand the package and also include the use of other popular methods like those developed by Pfeifer et al. (2004) and Hackenberg et al. (2014). Moreover, new point cloud and QSMbased structural metrics can be integrated in the future versions of the package as new research on tree structure develops. This is particularly easy as the code is publicly hosted on the collaborative GitHub platform.

| CON CLUS ION
Here we present the ITSMe package which offers a synthesis framework for researchers who want to easily obtain structural information from 3D data of individual trees. The package allows the determination of structural metrics that are often difficult or even impossible to measure in the field, from individual tree point clouds and QSMs reconstructed using the TreeQSM method from different types of forests. Future versions of the package will also include other QSMs and new structural metrics. We believe that the open-source ITSMe package, hosted on GitHub, will make the use of LiDAR data more straightforward for a range of end-users and further our understanding of tree structure.

CO N FLI C T O F I NTE R E S T
The author declares no conflict of interest.

PEER R E V I E W
The peer review history for this article is available at https://publo ns.com/publo n/10.1111/2041-210X.14026.