Changed Img to RandomAccessibleInterval where adequate