Input: random path through all ROIs (path_{0}), labels indicating which ROI corresponds to each path_{0} pixel (tags) |
Step 1. Find unique ROIs |
For ROI in unique(tags): Â Â Â Find ROI centroid |
Step 2. Find optimal path through ROIs centroids (path_{TSP}) applying genetic algorithm to solve TSP |
Randomly initialize a population of 100 individuals (random paths through all ROIs) Find minimum path length min_{glob} and the individual than minimize path length (path_{TSP}) For generation in [1:1000]: Â Â Â Compute the path length for each individual Â Â Â If exist a path shorter then min_{glob}, then update min_{glob} and path_{TSP} Â Â Â Randomly split population in groups of 4 individuals Â Â Â For each group of 4 individuals: Â Â Â Â Â Find the individual with shortest path Â Â Â Â Â Create 4 mutations (original, flip, swap, slide) of the individual for the next generation |
Step 3. Compute path_{SLS} |
Initialize empty trajectory path_{SLS} |
For ROI in path_{TSP}: Â Â Â Find path through all ROIâ€™s pixels (path_{ROI}) using a greedy algorithm Â Â Â Append path_{ROI} to path_{TSP} |
Return: path_{TSP} |