def get_LUT_value(data, window, level):
"""Apply the RGB Look-Up Table for the given data and window/level value."""
if not have_numpy:
raise ImportError("Numpy is not available. See http://numpy.scipy.org/"
" to download and install")
return np.piecewise(data,
[data <= (level - 0.5 - (window - 1) / 2),
data > (level - 0.5 + (window - 1) / 2)],
[0, 255, lambda data: ((data - (level - 0.5)) /
(window - 1) + 0.5) * (255 - 0)])
评论列表
文章目录