A new expression for the output moments of weighted median filtered da
ta is derived in this paper. The noise attenuation capability of a wei
ghted median filter can now be assessed using the L-vector and M-vecto
r parameters in the new expression. The second major contribution of t
he paper is the development of a new optimality theory for weighted me
dian filters. This theory is based on the new expression for the outpu
t moments, and combines the noise attenuation and some structural cons
traints on the filter's behavior. In certain special eases, the optima
l weighted median filter can be obtained by merely solving a set of li
near inequalities. This leads in some cases to closed form solutions f
or optimal weighted median filters. Some applications of the theory de
veloped in this paper, in 1-D signal processing and image processing a
re discussed. Throughout the analysis, some striking similarities are
pointed out between linear FIR filters and weighted median filters.