Modified ndimage to take any open filehandle with a seek.  Inspired by numpy's savetxt and similar