implemented saving and loading of image stacks