Background / Context: "Bilateral filtering" is a technique that is used in computer graphics and image processing.
An ordinary filtering is usually done by discrete convolution on an image $I$ with a filter $f$:
$$(I * f)(x,y) = \sum_{k,l} I(x-k,y-l) \cdot f(k,l)$$
Bilateral filtering adds another factor in this sum:
$$\sum_{k,l} I(x-k,y-l) \cdot f(k,l) \cdot w(x,y,k,l)$$
Where this weight-function is dependent on the local data : $$w(I,x,y,k,l) = h(I(x,y),I(x-k,y-l))$$ where $h$ is a function $[0,\infty] \to [0,1]$ strictly decreasing with $\|I(x,y)-I(x-k,y-l)\|_2^2$, for example Gaussian.
Finally a kind of normalization is usually done :
$$\frac{\displaystyle\sum_{k,l} I(x-k,y-l) \cdot f(k,l) \cdot w(x,y,k,l)}{\displaystyle\sum_{k,l} f(k,l)\cdot w(x,y,k,l)}$$
Now as our image data above is scalar, in other words $I(x,y)$ only assigned one real value for each $(x,y)$ this is straight forward. But what about if we have Tensor data, if $I(x,y)$ for example instead is assigned a $2\times 2$ positive semi-definite symmetric matrix for each $(x,y)$. What would be reasonable ways to measure this closeness weight $w$ and how to define $h$ in this case?
There is similarity here to existing implementations for color images. In short, one can apply the local weighted averaging on each channel separately, because weighted averaging is a linear operation. What is important is that the weighting be identical for each channel.
The weight function is typically a Gaussian over some local difference function (a function that says how different two pixels are). For color images this is simple: take the $L_1$, $L_2$ or $L\infty$ norm of the difference between the two pixels. For a tensor image one could think of using the largest eigenvalue, for example.
There exist implementations of the bilateral filter that take an image to be filtered, and a second image that is used to determine the magnitude of the difference between pixels (and thus the weighting of the kernel). Such an implementation can be used to filter each of the channels of your tensor image, passing an appropriate scalar image as second image.