0%
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| import tifffile as tiff import math import numpy from itertools import chain img = tiff.imread('tiffilePath') listImg = list(chain.from_iterable(img))
x = numpy.array([num for num in listImg if num >= 0]) def percentile(data, perc: int): size = len(data) return sorted(data)[int(math.ceil((size * perc) / 100)) - 1]
print("5th percentile:"+str(percentile(x, 5)))
print("95th percentile:"+str(percentile(x, 95)))
|