In this paper, a structure-adaptive approach to the nonlinear image filtering is described. The adaptive procedure is based on selection of the most homogenous neighborhood region from several possible structuring regions by the principle of maximum a posteriori probability. Then, an optimal evaluation of the pixel value is performed involving pixels from the determined neighborhood region. Trimmed mean filters are used for the robust evaluation of local properties during estimation of object and background intensities when the noise has a mixed conditional distribution, e.g. normal distribution with outliers.