An anisotropic diffusion algorithm with optimized rotation invariance