Read_image_with_mask function moved to utilities