## 2 Materials and Methods
### Methods
#### 2.2.2 Model Definition
Then, the source node is set as \(V_{S}\), which iterates over the \(U\) to find the optimal path \(E_{O}\) comparing with \(E_{R}\). Then, the forwarding-satisfaction rate of each option is applied to select a more effective path, which is given as follows:  
\[P_{S}(s,e)=\frac{\sum\limits_{j=1}^{n}{x_{ij}\delta_{i,j}}}{\varepsilon} \tag{3}\]  
where \(x_{ij}\) represents the pixel value at the position \((i,j)\), and \(P_{S}(s,e)\) stands for the forwarding-satisfaction rate from the source node to the end node. \(\delta_{i,j}\) is the degree of information correlation between the pixel \(x_{i,j}\) and its neighborhood pixels. \(\varepsilon\) represents the routing hops of the path to be calculated. Then, the optimal path \(E_{O}\) is selected according to the presented routing satisfaction rate. Figure 6: Key areas for the cutting curve replanning. Regions within the green ellipse are vital targets that the refined cutting lines try to avoid. Subfigures (**a**)–(**c**) are the three selected samples for illustration. Moreover, the optimal path \(E_{O}\) is further refined using the detected edges (segmentation mask \(E_{M}\)); we define the positive factor \(f_{PO}\), negative factor \(f_{NE}\), and the penalty factor \(f_{PE}\) to modulate the refined path dynamically. \[E_{R}=(\alpha\times f_{PO}+(1-\alpha)\times f_{NE}+f_{PE}\times{E_{M}}^{*}\cap E _{O}(E))\to E_{O}(E) \tag{4}\]  
where \(\alpha\in(0,1)\), which is the adjusting item of the factors. When \(\alpha\) increases, the force that constrains the optimal cutting line \(E_{O}\) close to the segmentation mask will increase. \(f_{PO}\) and \(f_{NE}\) adjust the refined cutting path jointly, which closes to the segmentation mask border while maintaining the rough boundary. \({E_{M}}^{*}\) refers to the alarming parts in the segmentation masks, including the pectoralis major, rib periosteum, and nervous tissue. \(f_{PE}\) keeps the refined cutting line away from the sensitive areas by testing the intersection of \({E_{M}}^{*}\) and \(E_{O}\). Therefore, the initial cutting curve is reoptimized, the critical areas of the thoracoscopic surgery are avoided, the operational efficiency is improved, and the potential risk is reduced. The generation process of the refined cutting curve using the improved leapfrog algorithm is given in Algorithm 1:  
```
Input:\(\sim\) directed graph \(G=(V,E)\) Output:\(\sim\) fine-tuned cutting path \(E_{F}\)
1: Treat pixels of graph \(G\) as individuals in frog population and record its size as \(P\), set the population number as \(M\), and set the first and maximum iteration number as \(1\) and \(I\);
2: Define the frogs as the vector \(\left\{X_{1},X_{2},\ldots,X_{i},\ldots,X_{p}\right\}\), where \(X_{i}=(x_{i1},x_{i2},\ldots,x_{ij},\ldots,x_{in})\). When \(x_{in}=0\), the node is removed; otherwise, the node is selected;
3: Calculate the forwarding-satisfaction rate \(P_{S}(s,e)\) of each path using Equation (3); then, adjust the frog order;
4: Divide \(P\) frogs into \(M\) populations, and set the sub-population as \(\left\{F_{1},F_{2},\ldots,F_{n},\ldots,F_{M}\right\}\). Iterate over the potential paths \(U=(U_{1},U_{2},\ldots,U_{d})\), and set \(X_{h}\) as the path with highest forwarding-satisfaction rate and \(X_{l}\) as the path with the lowest rate. Update the value of \(X_{h}\) in sub-population \(F_{n}\);
5: Re-adjust the frogs of sub-population \(F_{n}\) according to \(P_{S}(s,e)\), and generate the optimal subpopulation. Obtain the globally optimal path \(E_{O}\) by comparing with \(U=(U_{1},U_{2},\ldots,U_{d})\);
6: Re-arrange the frog order in sub-population \(F_{n}\), and apply the positive factor \(f_{PO}\), the negative factor \(f_{NE}\), and the penalty factor \(f_{PE}\) for the calculation of \(P_{S}(s,e)\).