Rewrite image IO to be thread-safe and object oriented.

Seems to have solved crashes in STEM3 running multiple TDS runs.