Simple code to load and process image stacks