Cw7 first commit, and fixing erosion and dilation in cw6.