See section 4.2 from Adaptive histogram equalization and its variations, Pizer et al, 1987)
The procedure of clipping a histogram seems general enough that it could be implemented once for all, however I expect it would require care to make it compatible with SWAHE (#301).