# Research on a 3D Seismic Horizon Automatic-Tracking Method Based on Corrugated Global Diffusion
## 2 Method
### Stage 1: Local Connection Algorithm Based on Dynamic Time Warping Algorithm  
After sampling the original seismic data, a regularized sample space is obtained. In the sample space, the two neighboring seismic traces, X1 and X2, are selected, and the correlation between each point in X1 and each point in X2 is calculated. The arrows in Figure 1a represent the different connections, and the different matching relationships can be seen in Figure 1b. The blue squares inside the blue circles in Figure 1b represent the correlation value between the seed point of X1 at t1 and the seed point of X2 at t1, and the red squares inside the red circles represent the correlation value between the seed point of X1 at t1 and the seed point of X2 at t2. There are two lines in Figure 1b representing the different matching paths between the seed points contained in X1 and X2.  
When searching for horizon positions, correspondences with high correlation coefficients are likely. When a set of high-probability correspondences is drawn as a segment, we get a \"correlation comb\", which connects multiple seismic reflection points. The dynamic time warping (DTW) algorithm is used to identify the best \"correlation comb\" with the highest correlation.  
Dynamic time warping (DTW) algorithm: It describes the time correspondence between a test template and a reference template using a time regularization function W(n) that satisfies certain conditions (bounds limit, monotonicity limit, and continuity limit), solves for the regularization function that corresponds to the minimum accumulated distance when matching the two templates, and thus obtains the best path (best \"correlation comb\") between two points (Figure 2).  
Figure 2a has no actual meaning in the \(y\)-axis, and the \(x\)-axis represents the sample points in the time series.  
In Figure 2a, when comparing the similarity between the solid line and the dotted line time series, if time is kept consistent, point a of the solid waveform will correspond to point b' of the dotted waveform, but in reality, point a of the solid line corresponds to point b of the dotted line. The DTW algorithm calculates the similarity between two time series by stretching and shortening the time series. The matching process is shown in Figure 2b, where the \(y\)-axis represents the solid line A of length Q in Figure 2a, and the \(x\)-axis represents the dotted line B of length C in Figure 2a, and each square represents the correlation between the i-th point of line A and the j-th point of line B. The optimal path from w1 to wk is found through DTW, and the result is shown by the solid dot set that forms the path, as shown in Figure 2b.  
Figure 1: Calculation diagram of similarity coefficient matrix. (**a**) Two adjacent seismic channels: X1 and X2; (**b**) corresponding correlation coefficient grid.  
It is worth noting that Figure 2b is a real example that calculates the similarity between two time series \(Q=,\ q_{2},\dots,q_{i},\dots q_{n}\) and \(C=c_{1},c_{2},\dots,c_{i},\dots c_{m}\). The matrix element (i, j) in Figure 2b represents the similarity between two points \(q_{i}\) and \(c_{j}\). By using the DTW algorithm, the best path between two points is obtained: w\({}_{1}\), w\({}_{2}\), w\({}_{3}\), w\({}_{4}\)... w\({}_{k}\), as indicated by the orange dots in Figure 2b.  
Figure 3a is a plot of the correlation coefficient calculated based on the actual seismic tracks (X1, X2). The yellow-green color represents the magnitude of the correlation between data points in the two tracks, with yellow indicating a high correlation and green indicating a low correlation. Figure 3b is the best path extracted from Figure 3a based on DTW, consisting of a large number of points, and its linear property is comparable to the w1 to wk path in Figure 2b, that is, the best \"correlation comb\" with maximum correlation.