Added code for multidimensional hyperstacks

Made it work with imp.setPosition as an alternative to imp.setSlice, and
added a choice whether to work on frames or slices in stacks with
multiple frames and slices.