embedding.py 文件源码

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

项目:Dragonfly 作者: duaneloh 项目源码 文件源码
def end_track_positions(self):
        pos = np.array(self.positions)
        if pos.size == 0:
            return
        try:
            xnum = int(self.x_axis_num.text())
            ynum = int(self.y_axis_num.text())
        except ValueError:
            sys.stderr.write('Need axes numbers to be integers\n')
            return
        pos = np.append(pos, pos[-1]).reshape(-1,2)
        self.path_list.append(matplotlib.path.Path(pos, closed=True))
        points_inside = np.array([self.path_list[-1].contains_point((p[xnum], p[ynum])) for p in self.embed])
        sys.stderr.write('%d/%d frames inside ROI %d\n' % (points_inside.sum(), len(points_inside), len(self.points_inside_list)))
        self.points_inside_list.append(self.conversion.indices[np.where(points_inside)[0]])

        self.roi_list.append(
            matplotlib.patches.PathPatch(
                self.path_list[-1],
                color='white',
                fill=False,
                linewidth=2.,
                figure=self.frame.fig
            )
        )
        self.frame.fig.get_axes()[0].add_artist(self.roi_list[-1])
        for p in self.click_points_list:
            p.remove()
        self.frame.canvas.draw()

        self.frame.canvas.mpl_disconnect(self.connect_id)
        self.positions = []
        self.click_points_list = []
        if self.roi_summary is None:
            self.add_roi_frame()
        elif self.roi_summary.text() == '':
            self.roi_frame.show()
        self.gen_roi_summary()
        self.add_roi_radiobutton(len(self.roi_list)-1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号