TManual: Assistant for manually measuring length development in structures built by animals

Abstract Structures built by animals are extended phenotypes, and animal behavior can be better understood by recording the temporal development of structure construction. For most subterranean and wood‐boring animals, these structures consist of gallery systems, such as burrows made by mice, tunnel foraging by termites, and nest excavation in ants. Measurement of the length development of such structures is often performed manually. However, it is time‐consuming and cognitively costly to track length development in nested branching structures, hindering the quantitative determination of temporal development. Here, I introduce TManual, which aids the manual measurement of structure length development using a number of images. TManual provides a user interface to draw gallery structures and take over all other processes handling input datasets (e.g., zero‐adjustment, scaling the units, measuring the length, assigning gallery identities, and extracting network structures). Thus, users can focus on the measuring process without interruptions. As examples, I provide the results of the analysis of a dataset of tunnel construction by three termite species after successfully processing 1125 images in ~3 h. The output datasets clearly visualized the interspecific variation in tunneling speed and branching structures. Furthermore, I applied TManual to a complex gallery system by another termite species and extracted network structures. Measuring the lengths of objects from images is an essential task in biological observation. TManual helps users handle many images in a realistic time scale, enabling a comparative analysis across a wide array of species. TManual does not require programming skills and outputs a tidy data frame in CSV format. Therefore, it is suitable for any user who wants to perform image analysis for length measurements.


Abstract
Structures built by animals are extended phenotypes, and animal behavior can be better understood by recording the temporal development of structure construction.
For most subterranean and wood-boring animals, these structures consist of gallery systems, such as burrows made by mice, tunnel foraging by termites, and nest excavation in ants. Measurement of the length development of such structures is often performed manually. However, it is time-consuming and cognitively costly to track length development in nested branching structures, hindering the quantitative determination of temporal development. Here, I introduce TManual, which aids the manual measurement of structure length development using a number of images. TManual provides a user interface to draw gallery structures and take over all other processes handling input datasets (e.g., zero-adjustment, scaling the units, measuring the length, assigning gallery identities, and extracting network structures). Thus, users can focus on the measuring process without interruptions. As examples, I provide the results of the analysis of a dataset of tunnel construction by three termite species after successfully processing 1125 images in ~3 h. The output datasets clearly visualized the interspecific variation in tunneling speed and branching structures. Furthermore, I applied TManual to a complex gallery system by another termite species and extracted network structures. Measuring the lengths of objects from images is an essential task in biological observation. TManual helps users handle many images in a realistic time scale, enabling a comparative analysis across a wide array of species. TManual does not require programming skills and outputs a tidy data frame in CSV format. Therefore, it is suitable for any user who wants to perform image analysis for length measurements.

K E Y W O R D S
burrow digging, image analysis, nest excavation, root growth, shelter-tube construction, tunneling

| INTRODUC TI ON
Structures built by animals are considered extended phenotypes, and the temporal development of such structures reflects the temporal dynamics of the animal's behavior (Hansell, 2005;Sugasawa & Pritchard, 2022). One common type of structure built by animals is a gallery system, which is observed in most subterranean animals, and includes burrow construction in mice (Bedford et al., 2022;Metz et al., 2017), tunnel foraging by termites (Bardunias & Su, 2005;, and nest excavation in ants (Buhl et al., 2005;Toffin et al., 2009). Gallery systems can also be observed aboveground in some social insects, for example, shelter-tube construction by ants and termites (Chiu et al., 2022;Mizumoto & Bourguignon, 2020). Tracking the temporal development of gallery structures is important for understanding the dynamics of collective nest building.
Temporal development is often observed in two-dimensional experimental setups (e.g., Figures 1-3), and researchers have used two different approaches to capture the geometric properties of structures. Some studies have focused on overall structural patterns, such as the excavated area (Buhl et al., 2005), perimeter (Mizumoto et al., 2015;Toffin et al., 2009Toffin et al., , 2010, and nodes in a gallery system (Buhl et al., 2004;Gravish et al., 2012;Perna et al., 2008). The main advantage of this approach is that it can be automated, with the parameters automatically obtained by image-processing programs after binarizing them (which is often achieved using program languages such as C++ software). However, this approach requires high-quality standardized recording setups, and the interpretation of outcomes is sometimes not intuitive. For example, several different morphological patterns can increase/decrease the perimeter of a gallery system.
Most previous studies have directly measured the length of each gallery in a whole system and categorized them into different groups to capture the geometric patterns. This approach has been adopted to assess ant nest excavation (Kwapich et al., 2018;O'Fallon et al., 2022), termite tunnel foraging (Hedlund & Henderson, 1999;Robson et al., 1995;Su et al., 2004), shelter-tube construction (Mizumoto & Matsuura, 2013), and cooperative burrowing in mice (Bedford et al., 2022). In this approach, because experimenters arbitrarily identify and measure each gallery, the outcomes are intuitive, and the results are easy to interpret. However, because this process requires considerable effort, most studies have only focused on one or a few snapshots of structural development, which hinder our understanding of the dynamics of gallery-building behaviors. Furthermore, the time-consuming manual processes will prevent a comparative analysis of building behavior from a wide variety of species. Still, a manual analysis can be useful for handling images with much noise (e.g., it is common for images of structures to contain nonstructure objects, such as excavated substrates and individuals). Thus, it is important to develop a simpler way to aid the manual measuring process and to effectively process a large number of images.
The key stages in the manual process include measuring gallery length, identifying nodes, assigning galleries into categories, measuring the length of an object for scaling, and storing the information obtained in an organized file format for subsequent data analysis.
This often requires users to move back and forth between image analysis software and spreadsheets, which makes the process laborintensive and cognitively costly; it can also result in unintentional human errors. To overcome these problems, I herein introduce the TManual software, which is designed to achieve stress-free and quick manual measurement of gallery length. The user simply needs to click on the points of interest in images to obtain spreadsheets that include all geometric information.
The EXE file is also available for Microsoft Windows users. The future development of the software will also be announced in this GitHub deposit. TManual consists of two processes: measurement and post-analysis. The user should prepare the sequential image files (e.g., JPG), which should be named "id_serial," for example, formats supported by OpenCV can be analyzed. Because of the manual processes, there are no requirements for image quality (e.g., contrasting background, image resolution, and size) as long as users can identify the structures with their eyes.

| Measurement
The measurement program is designed to display all images of inter- which is an identifiable landmark across all images (e.g., the corner of the experimental arena). This is useful when the relative position of the camera and object is not fixed (e.g., when users take photos every 24 h and need to bring the experimental arena under the camera when filming). If the camera and object are fixed, users can skip this process (the reference point will be the top left corner of the image).
3. Measure: Users draw the galleries as freeform line objects with straight segments. For branching structures, two gallery lines need to contact (< threshold pixel, users can decide). The start and end points of galleries are treated as nodes to reconstruct a network structure (nodes within the threshold are regarded as the same node). If the users follow the gallery identity definition in the next section (also in Figure 1c), each gallery is assigned to one of the categories (primary, secondary, tertiary, …). 4. Scale: Measure the length of the scale object. This is used to convert the unit from pixels to mm during the post-analysis stage.
All the user inputs are stored in res.pickle, and are used in the following post-analysis stage.

| Post-analysis
The post-analysis program creates CVS files containing all of the information about the gallery structures based on res.pickle. This includes the length of each gallery (and total length), the number of galleries, the number of nodes, gallery classification, and network structure of gallery system.
In termite foraging tunnels, many studies have categorized branching tunnels into primary, secondary, tertiary, and quaternary tunnels to capture the geometry of gallery structures (Hedlund & Henderson, 1999;Su et al., 2004). All tunnels originating from the initial point are classified as primary, and primary tunnels are often extended to the farthest point possible (Hedlund & Henderson, 1999). Tunnels branching from the primary tunnel are classified as secondary tunnels; tertiary tunnels branch from secondary tunnels; and quaternary tunnels branch from tertiary tunnels. However, this definition cannot always determine tunnel identity uniquely (Su et al., 2004); e.g., some researchers only focus on one snapshot, and tunnel identity can change according to temporal developments (Hedlund & Henderson, 1999). Hence, expanding the definition of previous studies, I defined tunnels as follows: 1. Primary tunnels originate from the start point.
2. Tunnels that emerge from the side of preexisting tunnels are descendant tunnels (primary → secondary, secondary → tertiary, tertiary → quaternary, and following). F I G U R E 1 Overview of the TManual. TManual aids manual measurement of the temporal development of gallery-formed structures. (a) An overview of the imageprocessing procedure. First, the user draws all gallery structures by clicking on the image. Then the post-analysis program automatically categorizes galleries (primary, secondary, tertiary, …, in different colors), calculates gallery length with scaling in mm, reconstructs network structures, and outputs tidy data frames in CSV format for subsequent analysis. (b) Overflow of the measurement process. TManual sequentially shows images and asks users to analyze or skip the image (Check), identify a consistent landmark as a reference if required (Ref point), draw galleries in a freeform object with straight segments (Measure), and select scale objects (Scale). The information will be inherited in the next image. (c) The rule used to identify tunnel identity.

| Comparative analysis of tunnel time development in termites
To demonstrate the application of the software, I analyzed the development of termite foraging tunnels observed in a previous study . The previous study measured tun- It took ~3 h to analyze all of the images using TManual (all analyzed images are available at Video S1). Even with the manual process, the processing speed of ~400 images/h was sufficiently cost-effective to produce high-resolution datasets for assessing temporal development. However, it should be noted that the required time will be based on the complexity of the tunnel structures and size, and the analysis will take longer for gallery structures with many nested branching patterns.
A previous study found interspecific variation in excavation speed and tunnel structures from snapshots .
Applying TManual, I successfully reproduced and better quantified the results, particularly the visualization of temporal development.
First, it was found that H. aureus and R. tibialis excavated longer tunnels than P. simplicicornis (Figure 2a), consistent with the previous observation that the former two species reached the arena wall faster than the latter . The tunnel identification provided by TManual captured the interspecific variation in tunnel geometry (Figure 2b,c). It was previously indicated that H. aureus builds more branching tunnels than R. tibialis and P. simplicicornis, which was confirmed by counting the number of ends of tunnels . TManual quantified this variation by showing that H. aureus builds more secondary tunnels than R. tibialis and P. simplicicornis. Despite R. tibialis excavating longer tunnels, P. simplicicornis and R. tibialis produced very similar structures.

F I G U R E 2
Example of the application of TManual. The results of analysis of 1125 images of termite tunnel development by TManual. (a) The temporal development of total tunnel length. Heterotermes aureus and Reticulitermes tibialis built longer tunnels than Paraneotermes simplicicornis. (b) Representative images analyzed by TManual. The gallery structures with tunnel identity were overlayed on the original images provided by the postanalysis program. (c) Comparison of tunnel geometry between species. 1st, 2nd, 3rd, and ≥4th indicate primary, secondary, tertiary, and quaternary or later tunnels. The structures are described by the proportion of each tunnel identity, with H. aureus building more branching tunnels than the other species.
These results demonstrate that TManual is a cost-effective and strong tool for the manual measurement of gallery development by animals.

| Network structure of termite foraging tunnels
In the above example, gallery structures were described by tunnel identities. However, for more complex structures, another way is to regard the gallery system as edges and nodes that form a net-

| FUTURE DE VELOPMENTS
TManual assumes that galleries become longer according to time and does not support the case when galleries become shorter.

| CON CLUS ION
Measuring the lengths of objects from images is a basic task in biological observations and this task needs to be completed in a quick and simple way. TManual provides a user interface to manually measure the length development from multiple images. Although I present the software with a focus on the termite tunneling system, it can be applied to similar structures built by other animals, such as ant nest excavations and burrows dug by mice. Furthermore, as shown by studies of root development in plants (Kume et al., 2018), branching structures are ubiquitous in nature, which provides another potential application of TManual.

ACK N OWLED G M ENTS
I thank Sang-Bin Lee for informing me that this tool will likely be helpful for other researchers, encouraging me to write this paper, and providing several sample images; Kaitlin Gazdick for assistance in designing the software specifications, performing several test runs, and providing several sample images; and Jamie M. Kass for advice in depositing source codes. F I G U R E 3 Network structures provided by post-analysis program in TManual. Tunnel network structures created by C. formosanus termites in two-dimensional arenas. Purple nodes indicate entrance, green nodes indicate intersection, and yellow nodes indicate tunnel ends. (a) The structure created in arena between two entrances. The photograph is provided by Sang-Bin Lee. (b) Foraging tunnel structures created from a single entrance in the center. The photograph used in (Lee et al., 2008) was used for the analysis.

CO N FLI C T O F I NTER E S T S TATEM ENT
The author declares no competing interests.

This study was supported by a JSPS Research Fellowships for
Young Scientists CPD (grant number: 20J00660) and by Sumitomo Foundation (2200302).

DATA AVA I L A B I L I T Y S TAT E M E N T
The source codes of TManual are available at Zenodo, DOI: 10.5281/ zenodo.8198515. Updated source codes can be accessed at the GitHub repository: https://github.com/nobua ki-mzmt/tmanu al/.