Skip to main content
. 2020 Oct 31;20(21):6222. doi: 10.3390/s20216222
Algorithm 1 Algorithm for building contact wires
1:  roiPoints extractPointsFromROI() ▹ First stage
2:  for all slice roiPoints do ▹ Second stage
3:      clusteredPoints DBSCAN(slice)
4:  end for
5:  finalClusters NULL ▹ Third stage
6:  for all cluster clusteredPoints do
7:      if cluster.Length > 6 then
8:          continue
9:      else if cluster.Length > 3 then
10:          splittedCluster SPLIT(cluster)
11:          finalClusters.Add(splittedCluster)
12:      else
13:          finalClusters.Add(cluster)
14:      end if
15:  end for
16:  listO fWires NULL ▹ Fourth stage
17:  for all cluster finalClusters do
18:      closestWire getGlosestWireFromList(cluster)
19:      if closestwire.Distance < ϵ then
20:          closestWire.Add(cluster)
21:      else
22:          newWire cluster
23:          listO fWires.Add(newWire)
24:      end if
25:  end for
26:  longerWire getGlongerWire(listO fWires) ▹ Fifth stage
27:  for all wire listO fWires do
28:      if wire.Length< longerWire.Length * 0, 5 then
29:          listO fWires.Remove(wire)
30:      end if
31:  end for
32:  for all wire listO fWires do ▹ Sixth stage
33:      computeBestFirStraitht(wire)
34:      measureHeithtAndStagger(wire)
35:  end for
36:  for all wire listO fWires do ▹ Seventh stage
37:      for all potentialSustainer listO fWires do
38:          if isSustaniner(potencialSustainer,wire) then
39:             wire.AddSustainer(potencialSustainer)
40          end if
41:      end for
42:  end for