当前位置: 首页>>代码示例>>Python>>正文


Python Session.acquire_mask方法代码示例

本文整理汇总了Python中session.Session.acquire_mask方法的典型用法代码示例。如果您正苦于以下问题:Python Session.acquire_mask方法的具体用法?Python Session.acquire_mask怎么用?Python Session.acquire_mask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在session.Session的用法示例。


在下文中一共展示了Session.acquire_mask方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from session import Session [as 别名]
# 或者: from session.Session import acquire_mask [as 别名]

#.........这里部分代码省略.........
            self.update_state(self.STATE_RUNNING)
            self.run_th = threading.Thread(target=self.session.run)
            self.run_th.start()
        elif self.state == self.STATE_RUNNING:
            self.session.session_kill = True
            self.update_state(self.STATE_KILLED_SESSION)

    def evt_pause(self, evt):
        if not self.session.paused:
            self.session.pause(True)
            self.view.pause_button.SetLabel('Unpause')
            self.view.pause_button.SetBackgroundColour((0,255,0))
            self.view.start_button.Disable()
        elif self.session.paused:
            self.session.pause(False)
            self.view.pause_button.SetLabel('Pause')
            self.view.pause_button.SetBackgroundColour((0,100,200))
            self.view.start_button.Enable()

    def evt_close(self, evt):
        if self.state in [self.STATE_RUNNING]:
            dlg = wx.MessageDialog(self.view, message='End session before closing interface.', caption='Session is active.', style=wx.OK)
            res = dlg.ShowModal()
            dlg.Destroy()
            evt.Veto()
        elif self.state in [self.STATE_NULL, self.STATE_RUN_COMPLETE, self.STATE_PREPARED]:
            dlg = wx.MessageDialog(self.view, message="", caption="Exit Experiment?", style=wx.OK|wx.CANCEL)
            result = dlg.ShowModal()
            dlg.Destroy()
            if result == wx.ID_OK:
                if self.state == self.STATE_PREPARED:
                    self.session.end()
                    self.update_state(self.STATE_KILLED_SESSION)
                    while self.state != self.STATE_RUN_COMPLETE:
                        pass
                self.tcpip.end()
                self.view.Destroy()
            else:
                evt.Veto()

    def evt_addsub(self, evt):
        dlg = wx.TextEntryDialog(self.view, message='Enter new subject name:')
        ret = dlg.ShowModal()
        if ret == wx.ID_OK:
            self.view.add_sub(dlg.GetValue().strip().lower())
        else:
            pass

    def set_light(self, evt, state):
        if self.state in [self.STATE_PREPARED,self.STATE_RUNNING,self.STATE_KILLED_SESSION]:
            self.session.dummy_light(state)
        else:
            dummy_light(state)
    def evt_puff(self, evt):
        if self.state in [self.STATE_PREPARED,self.STATE_RUNNING,self.STATE_KILLED_SESSION]:
            self.session.dummy_puff()
        else:
            dummy_puff()
    def evt_deliver(self, evt):
        if self.state in [self.STATE_RUNNING]:
            self.session.deliver_override = True
            logging.info('Manual trial delivering.')
        else:
            logging.info('No session running to deliver trial.')
    def update_usrinput(self, evt):
        self.session.notes = self.view.usrinput_box.GetValue()
        logging.info('Metadata updated.')
    def evt_roi(self, evt):
        if self.state not in [self.STATE_PREPARED, self.STATE_RUNNING]:
            logging.info('No session for ROI selection.')
            return
            
        if not self.selecting:
            self.view.roi_but.SetLabel('DONE')
            im = self.session.im
            self.mov_im.set_data(im)
            self.view.ax_interactive.axis([0,im.shape[1],0,im.shape[0]])
            self.view.ax_interactive.figure.canvas.draw()
            logging.info('Select ROI now, and press DONE to stop.')
            self.selecting = True
        elif self.selecting:
            self.session.roi_pts = np.copy(self.selection_pts)
            self.session.acquire_mask()
            self.view.roi_but.SetLabel('ROI')
            self.selection_pts = []
            self.selecting = False
    def evt_resetcam(self, evt):
        if self.state in [self.STATE_PREPARED, self.STATE_RUNNING]:
            self.session.cam.reset_cams()
    def evt_interactive_click(self, event):
        if self.selecting:
            self.selection_pts.append((event.xdata, event.ydata))
            lims = self.view.ax_interactive.axis()
            self.view.ax_interactive.plot(event.xdata,event.ydata,'rx')
            self.view.ax_interactive.axis(lims)
            self.view.ax_interactive.figure.canvas.draw()
    def on_slide(self, evt):
        if self.state in [self.STATE_PREPARED, self.STATE_RUNNING]:
            self.session.eyelid_thresh = self.view.slider.GetValue()
        self.view.update_thresh()
开发者ID:bensondaled,项目名称:eyeblink,代码行数:104,代码来源:controllers.py


注:本文中的session.Session.acquire_mask方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。