#### DETAILS OF THE NEURITE DETECTION AND TRACING ALGORITHMS

In the implementation of our neurite detector, the required second-order image derivatives are computed by convolution with the second-order derivatives of the Gaussian kernel (27). Mathematically this means that if *f* denotes the image and *G* the normalized Gaussian, we compute

where * denotes spatial convolution, x = (*x*, *y*) denotes the pixel position, and the derivative directions *i* and *j* can be *x* or *y*. The eigenvectors and eigenvalues are computed in our algorithm, not from the standard second-derivative matrix, but from the slightly modified matrix given by

where α is a parameter whose optimal value will be given in the sequel. Denoting the normalized eigenvectors of this matrix by v′_{i}(x) and the eigenvalues by λ′_{i}(x), we compute them as

where the v_{i}(x) and λ_{i}(x) are, respectively, the normalized eigenvectors and the eigenvalues of the standard second-derivative matrix, or Hessian (28), at pixel position x.

The suitability of the matrix H′_{f} for neurite detection can be appreciated by analyzing the filter implicitly used in the computations. It is a fact from linear algebra (28) that λ_{i} = v · H_{f} · v_{i}, where the right-hand side is equal to *f* * (v_{i} · ∇)^{2}*G*, the second-order image derivative in the direction v_{i}. From the relations just given and the orthogonality of the eigenvectors, it follows that, implicitly, the eigenvalues are computed as λ′_{i} = *f* * *h*′_{i}, where the *h′*_{i} are instances of the filter *h′* = {(r · ∇)^{2} + α(r^{⟂} · ∇)^{2}}*G* corresponding to r = v_{i}, which are the directions of maximum and minimum response. The parameter α is chosen in our algorithm such that *h*′, which happens to be a steerable filter (29), is maximally flat in its longitudinal direction. This translates into the criterion

Working out the details, we find that the left-hand side of this equation is equal to (1 + 3α)∥r∥^{4}/σ^{4}, with σ the standard deviation of the Gaussian kernel, from which it follows that the optimal value for the free parameter is α = −1/3. Visual impressions of the shape of the filter are given in Figure 5.

Based on the eigenvalue analysis described above, the algorithm assigns to each pixel in the image a measure of “neuriteness” according to the formula

where λ is the larger in magnitude of the two eigenvalues and λ_{min} denotes the smallest λ over all pixels, which in practice will always be smaller than zero. In addition, the algorithm stores for each pixel the local ridge orientation as indicated by v, the normalized eigenvector corresponding to the smaller absolute eigenvalue. Note that dark line-like structures, for which λ ≥ 0, are ignored by the detector. Also note that since we are using a second-order detector, responses to first-order structures, such as background intensity discontinuities, are suppressed. Moreover, since the Gaussian kernel involved in the computations is a scalable function, with scale parameter σ, the detector can be tuned to neurites of specific width, while at the same time suppressing noise.

In our implementation of the live-wire segmentation algorithm, the function used for computing the cost of moving from any pixel x to an eight-connected neighboring pixel y is computed as

where γ∈ [0, 1] is a user-defined parameter determining the relative weight of the two normalized cost components, C_{λ} and C_{v}. The former of these is computed from the eigenvalues at y as

The second component is computed from the eigenvectors at x and y as

where ϕ(x, y) = |v(x) · d(x, y)| with d(x, y) = (y − x)/∥y − x∥ the unit “link vector” from x to y. By taking the absolute values of the inner products, the algorithm ignores the actual directions of the eigenvectors and considers only their orientations. Optimal paths based on this cost function are computed by a version of Dijkstra's shortest-path algorithm (30) based on a discretization of the cost values and the use of a circular priority queue (19, 20, 22). The placing of starting points is facilitated by applying “local snapping,” which implies that the cursor is always moved to the locally lowest cost point in a small window, of size w × w pixels, around the actual cursor position. The smoothness of the paths computed by the algorithm is improved by application of a uniform postfilter, of size 2p+1, to the subsequent coordinates of the path pixels, after which they are subsampled with a factor s.