Changed affine comparison between mask and image from exact equality to numpy.allclose in order to be stable to insignificant numerical perturbations