def add_lineout(self, index, roi_type=''): try: item = self.roi_manager.ROIs['ROI_{:02d}'.format(index)] item_param = self.roi_manager.settings.child( 'ROIs', 'ROI_{:02d}'.format(index)) item_param.child(('use_channel')).setOpts(limits=self.labels) if len(self.labels) == 0: lab = '' else: lab = self.labels[0] item_param.child(('use_channel')).setValue(lab) item.sigRegionChanged.connect(self.update_lineouts) item.sigRegionChangeFinished.connect( self.ROI_changed_finished.emit) for child in customparameter.iter_children_params(item_param, childlist=[]): if child.type() != 'group': child.sigValueChanged.connect(self.update_lineouts) item_lo = self.ui.Graph_Lineouts.plot() item_lo.setPen(item_param.child(('Color')).value()) self.lo_items['ROI_{:02d}'.format(index)] = item_lo self.lo_data = OrderedDict([]) for k in self.lo_items: self.lo_data[k] = np.zeros((1, )) self.update_lineouts() except Exception as e: self.update_status(str(e), wait_time=self.wait_time)
def set_ROI(self): params = custom_tree.iter_children_params( self.settings.child(('cam_settings')), []) param_names = [param.name() for param in params] if self.settings.child('ROIselect', 'use_ROI').value(): #one starts by settings width and height so that offset could be set accordingly param = self.settings.child('ROIselect', 'width') param_to_set = params[param_names.index('Width')] step = param_to_set.opts['step'] val = int((param.value() // step) * step) param_to_set.setValue(val) self.controller.device.node_map.get_node('Width').value = val param = self.settings.child('ROIselect', 'height') param_to_set = params[param_names.index('Height')] step = param_to_set.opts['step'] val = int((param.value() // step) * step) param_to_set.setValue(val) self.controller.device.node_map.get_node('Height').value = val param = self.settings.child('ROIselect', 'x0') param_to_set = params[param_names.index('OffsetX')] step = param_to_set.opts['step'] val = int((param.value() // step) * step) param_to_set.setValue(val) self.controller.device.node_map.get_node('OffsetX').value = val param = self.settings.child('ROIselect', 'y0') param_to_set = params[param_names.index('OffsetY')] step = param_to_set.opts['step'] val = int((param.value() // step) * step) param_to_set.setValue(val) self.controller.device.node_map.get_node('OffsetY').value = val else: # one starts by settings offsets so that width and height could be set accordingly param_to_set = params[param_names.index('OffsetX')] val = 0 param_to_set.setValue(val) self.controller.device.node_map.get_node('OffsetX').value = val param_to_set = params[param_names.index('OffsetY')] val = 0 param_to_set.setValue(val) self.controller.device.node_map.get_node('OffsetY').value = val param_to_set = params[param_names.index('Width')] val = self.width_max param_to_set.setValue(val) self.controller.device.node_map.get_node('Width').value = val param_to_set = params[param_names.index('Height')] val = self.height_max param_to_set.setValue(val) self.controller.device.node_map.get_node('Height').value = val
def update_features(self): #start = time.perf_counter() for child in custom_tree.iter_children_params( self.settings.child(('cam_settings')), []): try: if self.controller.device.node_map.get_node( child.name()).get_access_mode() == 0: child.setOpts(visible=False) elif self.controller.device.node_map.get_node( child.name()).get_access_mode() in [1, 3]: child.setOpts(enabled=False) else: child.setOpts(visible=True) child.setOpts(enabled=True) child.setValue( self.controller.device.node_map.get_node( child.name()).value) except Exception as e: pass