Interactive Pruning Simulation of Apple Tree

: Pruning treatment is one of the important management practices of perennial fruit tree cultivation. Combining fruit tree growth theory with mathematics model and software development is an effective way in agricultural research. Virtual apple tree is built as a case to study pruning treatment in this paper. First, architectural development of apple tree was analyzed and stored in xml file. Then, the simulation software of apple tree pruning is build based on the Qt framework and OpenGL graphics library. The interactive pruning and automatic pruning with setting conditions are realized in the software. Reaction laws of apple tree pruning are extracted from the analysis on the experiment data. Stochastic 3D apple tree architectures after being pruned also can be simulated. Result indicates that simulation is efficient, accurate and timely judgment of pruning reaction is possible. This work is the foundation of future research, which will simulate the apple tree development of architecture and biomass after pruning treatment over time.


Introduction
Tree architecture plays a key role in foliage distribution and consequently in light interception and carbon acquisition, which in turn strongly affect the reproductive growth of fruit trees.Pruning treatment is one of common measures for architecture study in perennial fruit tree cultivation.
Reasonable pruning plays a key role in tree fruit quantity and quality [1].It had been found that removal of flowering shoots at a young stage of growth with less pruning of old branches tends to stimulate growth of the remaining shoots and fruit set of adjacent inflorescences [2][3][4], Jean Stephan studied the effect of pruning strategies on shoot demography and development during 2 years based on experiment and demographic approach [5].A biological model of apple tree production and a biomechanical model of apple tree development using mixed statistics are built successively [6][7].The perennial nature of apple tree make modeling complex, but the simplifications and codes description of tree topology presented by E.Costes make apple tree model possible [8][9].Many models are focus on the apple tree growth and development under the natural state rather than after pruning [10][11].Pruning research based on virtual apple tree model can be meaningful and efficient.However, few interactive virtual platform of apple tree pruning are found [12][13]

Overall design
The technical framework of apple tree pruning simulation is established on visual apple tree model combined with computer graphics technology.First, the hierarchical data organization which describes apple tree's morphological structure is formed based on the geometry structure of the apple tree.
Second, the three-dimensional model of apple tree is build based on OpenGL.Finally, an interactive interface of apple tree pruning simulation based on QT framework is developed.The work is showed in figure 1.

The Model
It is commonly accepted that plants are modular organisms that develop by the repetition of elementary botanical entities [14].Here, apple tree architecture is described in Growth Units (GU) level, which were divided into latent bud, medium shoot (5-15cm), short shoot (<5cm) and long shoot (>15cm) according to the length.Topology structure of apple tree, which describes the connection relationship among all units, is modeled using the dual-scale automata approach [15][16][17].In this way, apple tree is divided into hierarchy according with self-similarity and branching order during apple tree growth.
Different years of germination branches reflect difference vigor, which is called physiology age (PA).
Except the trunk, primary branch on trunk is defined as PA1, and secondary branch on primary branch is defined as PA2 and so on.Each branch belongs to a certain GU according to the branch length.In commercial orchards apple tree usually are pruned short and less branch level.According to dual-scale automata model, four macro states are applied to simulate a young apple tree topology development.A local-to-global approach is taken in building apple tree 3D model.Apple tree is decomposed into four level structure unit: node、internode、branch、organ.Node refers to the key point of apple tree skeleton.Node information, including space coordinates and distance to internode surface, is calculated by extracting a certain rule based on some measured data.The adjacent nodes constitute an internode and a series of internodes constitute a branch.Organ refers to apple tree leaves and apple fruit.Single organ geometric structure is built by 3d scanning.All organs, whose space position, orientation and size are simulated by using the information of measured data in special coordination system, are assumed only having differences in position, angle and size for same type.

Data Organization
Two categories of data are included in apple tree model: one is node information, another is organ information.Both are saved as a standard XML file with different suffix.Only the key node information of tree skeleton is stored in model, not including the surface node information of the branches in order to reduce the data storage.
The information of function topology is added into geometry topology based on the three-dimensional model structure of apple tree mentioned in 3.1.Taking the branch for example, the model data include PA, POS and all the node information on the branch.The coordinates of the pruning point located the branch where the pruning point is on, then, the function topology information of selected branch like PA is obtained from the node information XML file.POS is designed as a sequence which stores the position order from trunk to branch or organ in an even number.For example, the list<10,1,8,3>, means a piece of leaf or a shoot born on the 3th small branch of the 8th node , which is on the first branch of the 10th node of the trunk.A branch and an organ data are organized as below.All nodes are described by 3D space coordinates x,y,z and the diameter of the node to the branch.The organ is described by a transfer matrix that can generate different size and direction organ by organ transformation.Vector is used to store the data of apple tree model by using the C++ programming language.The node vector corresponds to a node which contains the node coordinates and diameter of the branch which the node is on.The branch vector takes a single node vector as a basic item, and the whole apple tree vector takes a single branch vector as a basic item.The branch position vector consists of POS of each branch, and so as branch age vector.

Interactive pruning simulation
Interactive pruning includes deterministic point pruning and combined conditional pruning.
Deterministic point pruning means pruning the branch from the mouse clicked point.The following steps are needed: (1) Coordinates transformation.It refers to transform the pruning point coordinates given by mouse click to the coordinates in apple tree model space.In OpenGL.First, transform 2d coordinates on screen to 3d view-part coordinates.Then, transform view-part coordinates to the model coordinates.
(2) Considering that the coordinates processed in (1) is on the surface of the branch and may not be contained in the file of node information, a method based on distance is applied to establish a mapping between clicked-point and points in the apple tree model.The method tries to find the closest node to the pruning point and then get the POS character of the branch with pruning point.
(3)The last step is to find all the related branches based on the POS character of matching point, and deletes point data and organ data of corresponding branch.
There are many pruning treatments in orchard management, not only including shape pruning and conditional pruning determined by branch or organ types, angles or PA, but also including different level pruning based on branch length, branch ratio and so on.Combined pruning refers to interactive pruning of apple tree in the way that combines mouse clicking with pruning parameters input.
For example, make the apple tree spindle shape and cut off 1/3 of the branches whose physiology age is 2, the steps of interactive pruning are as follows: (1) Click the key point on the screen to define spindle shape.(2)Expand 2d spindle shape to 3d spindle body.(3)Pruning judgment.First, delete the related nodes which are not in the scope of 3d spindle body.Second, find all the branches whose physiology age is 2 and then find the nearest nodes of the point at a third of the branch; finally delete the related information based on the found node coordinates.( 4) Redraw the apple tree model based on the updated data information.

Running time of interactive pruning simulation
Interactive pruning simulation on apple tree is running on an ordinary computer ( ③ Prune to make the tree look like sphere shape 1 ④ Cut off all the branches of PA = 3 3 ⑤ Cut off all the branches whose length < 0.1m 1 Pruning with conditions ⑥ Cut off 1/3 of the branches of PA = 2 2 The results show that the pruning system makes it easy for users to select the branches need to be cut by mouse clicking or keyboard input with a single condition or several conditions combined.The simulation time with the average response time is ms level, which is independent of the complexity of pruning.The simulation of natural pruning could be achieved on ordinary PC hardware.The efficiency of the simulation could be probably improved if the GPU technology is applied.The system comes into the view mode in default after the data of the tree model loaded.In this mode, mouse and keyboard are used to move, scale or rotate the visual tree model, then the exact position of pruning is easily to locate.The branches and organs are selected to be cut off by different ways in pruning mode after mode switching.Pruning is done before growth resumed in the spring when the leaves have not come out yet. Figure 3b, 3c clearly show the rendering of two different pruning cases.

3D results of interactive pruning simulation
The pruning effect can be clearly observed.

Discussion
Apple tree geometric model is established by the method that dividing the model into different structural units and levels, which reduces the complexity of the apple tree three-dimensional modeling.
The topological relationship between the branches is well documented by reasonable way of data organization so that it is easily to realize the pruning operation that all the child branches also are cut off when the mother branch is cut off, which simplify pruning realization and improve simulation efficiency.
Both shape pruning and combined conditional pruning are considered in the view of actual planting.
Two interactive ways of pruning, i.e.by mouse or keyboard and by parameters input, are provided for the convenient user operation.Stochastic architecture after pruned also is simulated according experiment data.If we can get more nodes information on pruned branch from base to top, discrete-time and discrete-state-space stochastic processes can be used to illustrate the branching architecture for any pruning measure.Now stochastic branch is limited to batch pruning for same physiology age branch.
The method of interactive pruning on visual apple tree in this paper can provide a reference for pruning simulation of other species.It also can be used in entertainment, education or tree research.
Meanwhile, this work provides an intuitive, flexible auxiliary tool for the further research on the tree pruning effect combined with the function model of the apple tree.The stochastic architecture showed in Fig 3 cannot be well explained, if tree structure model is considered independently.Pruning causes apple tree architecture changed.New organs will create, which change apple tree production (source) and demand (sink) ability.New local and global source-sink ratio is closely related to pruning bud fate.
Function-structural plant models (FSPM) have more advantages to explain it [18][19][20][21].With more field experiment and model developed, different virtual pruning treatment can be done to minimize the vegetative branch.Optimal pruning strategy can be got by analyzing source-sink ratio of reproductive branch.Optimization of simulation algorithm, the extensibility of the program simulation and verification of the simulation can be further studied.
. The work in this paper include: (a) Build a virtual apple tree model based on architectural development of apple trees.(b) Design and realize 3D interactive pruning simulation on general PC.Pruning strategies commonly used in real planting are considered in this platform.(c) Stochastic 3D architectures of virtual apple tree were modeled after pruning.The work is the foundation of further work, which focuses on the relationship between structure change which is reduced by pruning of apple tree and function change regarding as physiological character of fruit tree.

Fig 2 .
Fig 2. Dual-scale automata model of a 5 years old apple tree

Fig 3 .
Fig 3. Renderings of two pruning cases with interactive interface.

Table 1 .
Running time of different pruning modes