Writing out the segmented image.

To provide a more complete test.