'Return the i, j cell index closest to `pos` in local coordinates.'

def _cellCloseTo(self, pos):

    if (self.image is None):
        return ((-1), (-1))
    else:
        (h, w) = self.image.shape
        (i, j) = numpy.floor([pos.y(), pos.x()])
        i = numpy.clip(i, 0, (h - 1))
        j = numpy.clip(j, 0, (w - 1))
        return (int(i), int(j))
