def updateD(self, filled=None, fillFront=None, inpainted=None): if (filled is not None) and (fillFront is not None) and (inpainted is not None): nr, nc = computeNormal(psiHatP=self, fillFront=fillFront, filledImage=filled) self._normal = (nr, nc) gr, gc = computeGradient(psiHatP=self, inpaintedImage=inpainted, filledImage=filled) self._grad = (gr, gc) if (nr is not None) and (nc is not None): self._D = np.abs(nr*gc-nc*gr)/self._alpha else: self._D = 1