Replace explicit for loops in open_image

Now contains zero for loops in lmi.py