resolved the z-spacing issue by writing metadata information to the output image