Dm upgrades

 - major re-factoring to reduce duplicate code
 - added PIMS object to iterate over images.
can we call this `ImageSequence` and drop the `Dm` since it's in pipeline.py already?