Changes to allow expressions of image stacks to be written (providing
they fit in memory).