imViewer_Simple.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:augment3D 作者: yulkang 项目源码 文件源码
def get_LUT_value(self, 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")
        if isinstance(window, list):
            window = window[0]
        if isinstance(level, list):
            level = level[0]
        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)]
                            )

    # -----------------------------------------------------------
    # ImFrame.loadPIL_LUT(dataset)
    # Display an image using the Python Imaging Library (PIL)
    # -----------------------------------------------------------
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号