To study the morphologic structure of axons can help neuroscientists understand the neuronal function and development. The modern microscopes provide the fundamental tool for visual inspection of axonal structure. Due to the high volume of generated microscopic axon image data, it is critical to develop an automated technique for robustly and rapidly detecting 3D axonal structure. In this paper, we present a pure 3D approach to extract the curvilinear structure of axonal axes from microscopic image stacks. The method mimics the axon tracing procedure in 3D space as walking along a path with minimized cost value, which corresponds to the shortest path problem (SPP) in graph theory. The global solution for SPP, such as Dijkstra's algorithm, is infeasible for the real axon tracing problem because of the computation cost. We simplify this problem using a dynamic local tracing technique with linear computation complexity. The merits of the proposed method lie in that it can handle the short turn and non-vertical problems and also can separate closely distributed axons from each other.