2.3 Root hair extraction
Based on the classified image we extracted the medial axis from pixels, which were classified as root hair. We then identified all termination points, which have only one neighboring pixel on the medial axis, and junction points, which have more than two neighboring pixels on the medial axis. We connected all pairs of these points, if they were within a certain proximity, by traversing paths along the medial axis. This resulted in a set with paths that either do or do not resemble a segment of a root hair correctly. To smooth out artifacts of the medial axis and to resemble actual root hairs more accurately we fitted a weighted spline to each path with weights calculated by Equation 1, wheredMA is the measured diameter of the medial axis and dRH is an estimate of the expected root hair diameter.
\(w=1/max(1.0,\ d_{\text{MA}}-d_{\text{RH}}\ )\) (1)
We then used simulated annealing to combinatorically find the set of splines that resolves intersections and find root hairs in a globally optimal way [10]. At each iteration of the annealing process, either a spline is removed or a new spline is added to the set. During the annealing process we try to minimize a predefined cost function, which we calculate as the weighted root mean square of three metrics: (1) The average of the smallest distances of all root hairs to the root, (2) the residual strain energy, i.e. a metric to reduce the curvature of splines and (3) the fraction of remaining root hairs based on unresolved medial axis segments. At each iteration we restore the feasibility of the solution by ensuring that no spline branches of another spline and all intersections of splines are valid [11]. Two splines overlapping at one end are merged to a single entity to ensure that longer root hairs can be extracted in their full length. The annealing process stops once the cost function converges to a minimum and no more changes to the set are accepted.