_tifffile.py 文件源码

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

项目:radar 作者: amoose136 项目源码 文件源码
def read_uic1tag(fh, byteorder, dtype, count, plane_count=None):
    """Read MetaMorph STK UIC1Tag from file and return as dictionary.

    Return empty dictionary if plane_count is unknown.

    """
    assert dtype in ('2I', '1I') and byteorder == '<'
    result = {}
    if dtype == '2I':
        # pre MetaMorph 2.5 (not tested)
        values = fh.read_array('<u4', 2*count).reshape(count, 2)
        result = {'z_distance': values[:, 0] / values[:, 1]}
    elif plane_count:
        for i in range(count):
            tagid = struct.unpack('<I', fh.read(4))[0]
            if tagid in (28, 29, 37, 40, 41):
                # silently skip unexpected tags
                fh.read(4)
                continue
            name, value = read_uic_tag(fh, tagid, plane_count, offset=True)
            result[name] = value
    return result
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号