Contour regression: A general approach to dimension reduction