def nrbFromROI(self):
"""
Acquire an average spectrum from a user-selected ROI and apply to the \
NRB-- either as the new NRB or averaged with the existing (sender- \
dependent)
Note: This function just sets up the signal-slot connection for the \
MPL window. It executes all the way through
"""
# I found that the objectName is a better way than a reference to the
# actual action (e.g., self.ui.action_*) as the reference may change
# depending on the call location or how this method is called
sender = self.sender().objectName()
if ((sender == 'actionNRB_from_ROI') or
(sender == 'actionAppend_NRB_from_ROI') or
(sender == 'actionNRB_from_ROI_Left_Side') or
(sender == 'actionNRB_from_ROI_Right_Side')):
# Updated by _roiClick
self.x_loc_list = []
self.y_loc_list = []
# print('Sender: {}'.format(sender))
# print('Sender is actionNRB_from_ROI: {}'.format(sender == self.ui.actionNRB_from_ROI))
# Need to send sender as the text name as the actual object
# will change
if self.cid is None:
self.cid = self.img_BW.mpl.mpl_connect('button_press_event', lambda event: self._roiClick(event, self._roiNRB, sender))
self.img_BW.mpl.setCursor(_QCursor(_QtCore.Qt.CrossCursor))
self.setCursor(_QCursor(_QtCore.Qt.CrossCursor))
else:
print('Unknown action send to nrbFromROI')
评论列表
文章目录