Two-photon microscope in combination with novel fluorescent labeling techniques enables imaging of three-dimensional neuronal morphologies in intact brain tissue. In principle it is now possible to automatically reconstruct the dendritic branching patterns of neurons from 3D fluorescence image stacks. In practice however, the signal-to-noise ratio clan be low, in particular in the case of thin dendrites or axons imaged relatively deep in the tissue. Here we present a nonlinear anisotropic diffusion filter that enhances the signal-to-noise ratio while preserving the original dimensions of the structural elements. The key idea is to use structural information in the raw data - the local moments of inertia - to locally control the strength and direction of diffusion filtering. A cylindrical dendrite, for example, is effectively smoothed only parallel to its longitudinal axis, not perpendicular to it. This is demonstrated for artificial data as well as for in vivo 2-photon microscopic data from pyramidal neurons of rail neocortex. In both cases noise is averaged out along the dendrites, leading to bridging of apparent gaps, while dendritic diameters acre not affected. The filter is a valuable general tool for smoothing cellular processes and is well suited for preparing data for subsequent image segmentation and neuron reconstruction.