4.4 Iterative tracking
4.4.2 Track joining
The idea is to implement an algorithm that is able to connect and merge tracks together according to similar criteria as one would connect single spots. The method is based on the same linear optimization problem as the method of Karrenbauer et al. but now for the connection of tracks instead of single spots.
This leads to some subtle amendments. It is not only possible to continue a trajectory by connecting it with another one, but also to really merge overlapping trajectories in the sense that one track is allowed to fill the time gaps of the other one (like shown in Figure4.6 going from panel C to panel D). In the next paragraphs the steps of this procedure are discussed in more detail. The focus of the description is on new features and changes with regard to the technique of Karrenbauer et al. a detailed introduction to the construction of the linear optimization problem is given in Section4.3.
Virtual track endings
In order to take into account the past and future evolution of the tracks for the selection of the most probable joinings, the decision time length๐กdecis introduced. Virtual starting points and endpoints of the trajectories are retrieved by computing the average (=ฬcenter of mass) of the positions of the first and the last๐กdecsnapshots. If there are gaps at the endings of the track, they reduce the number of spots that go into the average, so that one always obtains time averaged virtual endings. A choice of๐กdec = 1avoids any averaging, then the actual endings of the tracks are used.
Search for connectable non-overlapping tracks
For each virtual endpoint one searches for virtual starting points of other tracks at a distance closer than ๐ฟ๐max. The time interval between endpoint and starting point has to be smaller than๐ฟ๐กmaxand bigger than zero, which only allows non-overlapping tracks. Connectable tracks found this way are added to the list of possible links.
Search for connectable overlapping tracks
For each track one also searches for other tracks that have their starting time during the course of that track and have their virtual starting point closer than ๐ โ ๐ฟ๐maxto that trackโs virtual endpoint. A good choice for all purposes is๐ = 3, which avoids the missing of any possible connections. Before adding these links to the list, one has to do more tests. For each of the other tracks found, one needs to check if the other track only fills time gaps, or if there are spots at common times in both tracks. If only gaps are filled, everything is fine, else it depends on whether one wants to allow โjoined spotsโ (see section4.3.3).
Figure 4.8:For overlapping tracks one looks at the spots๐กdecbefore and after a transition from one track to the other. Here they are marked with lighter colors (๐กdec= 3). The average position of all light green spots has to be closer than๐ฟ๐max to the average position of all light magenta spots. If spot joining is allowed, spots at common times, here at๐ก= 38, must be closer than the join radius๐ฟ๐join
4.4 Iterative tracking If they shall be allowed, one checks if the distance of spots at common times is always smaller than the join radius๐ฟ๐join. If this is not the case, this possible link is discarded. Finally, before adding the link to the list, one has to decide if the spatial distance between the two overlapping tracks is small enough. In order to do this one has to look at all transitions from one track to the other, more precisely at the spots ๐กdecbefore and๐กdecafter the transitions (see Figure4.8). For each of both tracks the average position of all those spots is computed. Only if the distance between these two averages is smaller than๐ฟ๐maxthe corresponding link is added to the list of possible links.
Search for conflicts
The connection of overlapping tracks can lead to conflicts. In this context it is not a transitive relation, in the sense that if AโB and BโC are allowed it does not follow that AโC is possible, too. Track A is compatible with track C only if either AโC is on the list of possible connections or if the time lines of A and C do not overlap. Otherwise their connection leads to wrong and unexpected results, e.g. tracks with two spots at one time. Figure4.9gives examples for such conflicts.
coordinate
Figure 4.9: Conflicts in the connection of overlapping tracks: AโB or BโC is allowed, but not both, since AโฎC. Another conflict is: AโB or AโD is allowed but not both, since BโฎD. A third one is:
AโB or AโE is allowed but not both, since BโฎE. Note that the latter conflict is already avoided by the rule that a track can only have one successor track if no โeatingโ is involved (the concept of โeatingโ is explained later). The solution for this case would be AโDโE and BโC.
Figure 4.10:Walking the network of possible links of overlapping tracks in the search for conflicts in the connections of the tracks shown in Figure4.9. In the left panel we see the network of possible links, to the right we see how the network is explored, starting individually from each of the five nodes indicated with large capitals. Numbers give the order in which track compatibility is tested. Jagged lines denote incompatible tracks that lead to the registration of a set of conflicting possible links in the list of conflicts.
In this case the sets{AโB, BโC}and{AโB, AโD}are added to this list.
In order to avoid them, starting from each track individually one needs to walk through the network given by the list of possible links of overlapping tracks and check for a conflict between connectable tracks.
Tracks are the nodes of this network. The search must go forward and backward in time, if the link AโB is possible, the link BโA is possible too, there is no direction in track connectivity. Figure4.10 illustrates how the network is explored. As an example, let us look at the walk starting from D (magenta arrows): From D one can go directly to A. Now the task is to search for other connections starting at D and conflicting with DโA. First one has to test if DโE is allowed at the same time and yes, since A and E do not overlap in time they are compatible (marked with the number 1). Therefore, the links DโA and DโE are not conflicting. There are no other links starting directly at D or E, therefore one goes further with the direct links starting at A: Is DโA allowed together with AโB? No it is not, tracks B and D are not compatible (marked as test number 2). No other links start from A and since the path to B is not allowed it is not necessary to continue the search with B. The search for conflicts starting from D can be stopped here.
Since the network is walked starting individually from each node, it is clear that one finds many of the incompatibilities more than once (see Figure 4.10). Each incompatibility can be described by a set of conflicting links that might not be selected together in the optimization step (in the example above there are only sets with two links, but larger sets are definitely possible). When a set is added to the list of all the sets that have been found before, it makes sense to check if adding this set is necessary and/or if other sets in the list become obsolete after this set has been added. This keeps the list of conflicts as short as possible.
Cost function
Again the aim of the optimization step is to minimize the distances squared with the proper selection of possible links. Therefore, a very similar cost function is used for track joining. It depends on the squared space distance between the virtual endings of the tracks and the squared time interval between their real endings. The cost for a connection of a track A and a track B is defined as:
๐๐ด๐ต = (๐ฅ๐ต,๐ โโ๐ฅ๐ด,๐โ)2+ (๐ฆ๐ต,๐ โโ๐ฆ๐ด,๐โ)2+ (๐ง๐ต,๐ โโ๐ง๐ด,๐โ)2+ (๐ก๐ต,๐ โ๐ก๐ด,๐)2 (4.8) Here๐ โand๐โdenote virtual starting points and endpoints, as well as๐ and๐denote real ones. For each track that has no successive track the costs are๐ฟ๐2max+๐ฟ๐ก2max, which is analogue to Karrenbauerโs method (see Equation4.7). The same cost is paid for having no predecessive track, which means one has to pay twice for an unconnected track. Note that this cost function can also be adapted to include other particle features like e.g. particle diameters or detection quality.
Modifications to the optimization step: Conflicting links and โeatingโ links
The general form of the linear optimization problem given above in Equations4.4and4.5stays the same as before. However, new rules must be included in the linear equations of constraints๐ ๐ฑ=๐in order to avoid the selection of conflicting links. In the list of conflicts each entry is a set of links that may not be selected all at once. Remember that selecting link number๐ means that in the solution vector๐ฑwe have ๐ฅ๐ = 1. Let us assume the set๎ฟ๐ = {๐, ๐, ๐}represents a set of conflicting links, saying that selecting together all the links with the numbers๐, ๐and๐is not allowed. If the inequality
๐ฅ๐+๐ฅ๐+๐ฅ๐ <3
is fulfilled it is clear that at least one of the three links is not selected in the solution vector.
4.4 Iterative tracking
Figure 4.11:Track A โeatsโ track B: In this situation one should allow a second track to connect to track A and forbid further connections to track B.
More generally written, we demand ๐2๐+๐,โโ ๐ฑ=โ
๐
๐2๐+๐,๐๐ฅ๐ < ๐! ๐ =๐2๐+๐ with ๐2๐+๐,๐ = 1 for every link๐โ๎ฟ๐, (4.9) where๐2๐+๐,โis the(2๐+๐)th row of๐,๐2๐+๐is the(2๐+๐)th element of the constraint vector๐and ๐๐is the number of links in set number๐from the list of conflicts. The constraint matrix is thus extended with๐ถnew rows, where๐ถis the number of sets in the list of conflicts. Analogously, the constraint vector ๐is also extended with๐ถnew elements, each of them being the number of links๐๐of the corresponding set of conflicting links. So for each set in the list of conflicting links one linear inequality in the form of Equation4.9is appended to the constraints of the linear optimization problem.
Another subtle problem arises if a possible link means that one track โeatsโ another one. A โeatsโ B means that track B only fills gaps in the timeline of track A but does not extend the track in time (see Figure4.11). In this case there should be the possibility to connect a second track to track A and further connections to track B should be forbidden. In order to allow for a second connection starting at A one has to change the equation of constraints, because one of the key rules is that one spot may only have one successor spot. A second change in the constraints is required to prohibit further connections starting from B.
To this end, the solution vector๐ฑis extended with๐ธ more entries (before it had2๐elements),๐ธbeing the total number of possible eating links. Consequently, also the matrix of constraints๐ is extended with๐ธmore columns (entries of๐not mentioned later are all set to โ0โ). By adding another row to the constraints for each eating link, the solution vector๐ฑis forced to be โ1โ at position๐+ 2๐+๐if an eating connection๐ is selected:
๐2๐+๐ถ+๐,โโ ๐ฑ=โ
๐
๐2๐+๐ถ+๐๐ฅ๐ = 0! with ๐2๐+๐ถ+๐,๐ = โ1and๐2๐+๐ถ+๐,๐+2๐+๐ = 1. (4.10) Here๐ is the position of the eating link in the list of all possible links, ๐ is its position in the list of eating links only; ๐ถ is the number of rows that have been added before to deal with conflicting links.
Letโs say the eating link๐connects track number๐(A in Fig.4.11) with track number๐(B in Fig.4.11).
Equation4.10enforces๐ฅ๐+2๐+๐ = 1if the โeatingโ link๐ is selected. If๐is selected, the permission for track๐to have a successor must be re-enabled, which is done by setting๐๐+๐,๐+2๐+๐= โ1. Furthermore, track๐may not have a successor if๐is selected, which is enforced by setting๐๐+๐,๐+2๐+๐= 1.
Implementation
For tests of Karrenbauer and Wรถllโs algorithm on experimental data, their code was already translated to a Python/NumPy version for 3D data points. Their MATLAB script published onarXiv.org[78]
therefore serves as the basis for the implementation of the new track joining algorithm. However, since
so many details and subtleties have been added, there is not so much left of their code in the end. Some key parts like the (adapted) matrix of constraints and the solution of the linear optimization problem with the IBM ILOG CPLEX optimizer are still used.
The computational performance of the implementation depends on the number and complexity of the tracks to be connected: With many small tracks a big part of the computation time is consumed by the CPLEX optimizer. With fewer and longer tracks at complex constellations the search for possible links takes most of the time. As an example, the reduction ofโผ 40000small tracks toโผ 20000longer tracks is done in about 30 seconds on a3GHz machine, at a RAM usage ofโผ 1GB. In the evaluation of the experimental data discussed here, this is comparable to an average step in an iterative tracking sequence, so the code is fast enough to do about 20iterations in about ten minutes, and does not need excessive amounts of RAM. Compared to Karrenbauer and Wรถllโs code that was not applicable due to its large memory requirement, this is a great improvement.