A new filtering algorithm was developed for the removal of random noise from digitally imaged aerodynamic flow structures while minimizing geometrical distortion of their shapes. This is a modification of a spin filter previously presented. The algorithm defines a kernel around each pixel and detects the direction of the prevailing pattern passing through that kernel. The median grey level along this preferred direction is then used to replace the grey level recorded by the pixel at the centre of the kernel. Applications of this filter were demonstrated by processing shadowgraph images of shock waves. The noise as measured by the standard deviation from the mean was reduced by nearly 50% after one application of the filter and by nearly 70% after three applications, while distortion of the imaged shock angle remained below the angle measurement uncertainty.