ENH: work on n-D images