lddmm_pytorch.py 文件源码

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

项目:lddmm-ot 作者: jeanfeydy 项目源码 文件源码
def plot(self, ax, color = 'rainbow', linewidth = 3) :
        "Simple display using a per-id color scheme."
        segs = self.segments()

        if color == 'rainbow' :   # rainbow color scheme to see pointwise displacements
            ncycles    = 5
            cNorm      = colors.Normalize(vmin=0, vmax=(len(segs)-1)/ncycles)
            scalarMap  = cm.ScalarMappable(norm=cNorm, cmap=plt.get_cmap('hsv') )
            seg_colors = [ scalarMap.to_rgba( i % ((len(segs)-1)/ncycles) ) 
                           for i in range(len(segs)) ]
        else :                    # uniform color
            seg_colors = [ color for i in range(len(segs)) ] 

        line_segments = LineCollection(segs, linewidths=(linewidth,), 
                                       colors=seg_colors, linestyle='solid')
        ax.add_collection(line_segments)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号