In Perona and Malik, they state:
a histogram of the absolute values of the gradient throughout the image was computed, and
K
was set equal to the90%
value of its integral
My interpretation of this is to take the 90%ile of the distribution of magnitude of gradients. This interpretation however differs from the implementation here which seems to do a double cumulative sum.