pyfrp_img_module.py 文件源码

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

项目:PyFRAP 作者: alexblaessle 项目源码 文件源码
def saveImg(img,fn,enc="uint16",scale=True,maxVal=None):

    """Saves image as tif file.

    ``scale`` triggers the image to be scaled to either the maximum
    range of encoding or ``maxVal``. See also :py:func:`scaleToEnc`.

    Args:
        img (numpy.ndarray): Image to save.
        fn (str): Filename.

    Keyword Args:   
        enc (str): Encoding of image.
        scale (bool): Scale image.
        maxVal (int): Maximum value to which image is scaled.

    Returns:
        str: Filename.

    """

    #Fill nan pixels with 0
    img=np.nan_to_num(img)

    #Scale img
    if scale:
        img=scaleToEnc(img,enc,maxVal=maxVal)
    else:
        #Convert to encoding
        img=img.astype(enc)



    skimage.io.imsave(fn,img)


    return fn
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号