The signal preserving ability of a median filter has been improved from the classic implementation to a space-varying median filter, and further to a structure-oriented median filter. However, the performance of structure-oriented median filter highly depends on the accuracy of estimated local slopes of the input seismic data. We have proposed a variant of MF, named structure-oriented space-varying median filter, that preserves signal energy even in cases with complicated structure, and can adapt to the inaccurate slope estimation in a structure-oriented filtering framework by applying a space-varying median filter along the imperfectly flattened dimension. The proposed method can be applied to remove spike-like noise in datasets that contain structural patterns. Structure-oriented space-varying median filter can also be conveniently used as an extra constraint during iterative deblending to improve the deblending performance based on the shaping regularization framework. Both synthetic and field data examples demonstrate the great advantages and potential of the the proposed method.