Implement assert_nD in filter and feature packages

Builds on #1159.
Even though `ndim=2` is the most common use case, I think it very badly affects readability here. I suggest we always explicitly call the ndim argument. (so it might be better to move it in front of the 'what' argument.)