New function to transform diffusion tensor into stencil.