When flattening an image, need to make sure the origin, direction, and spacing are maintained, so add call to alignImages before returning.