def on_point_clicked(self, plot_item: pg.PlotDataItem, points: list) -> None: """ Callback function for the click event on a detection. The detection is highlighted with a white circle around it and the detection's properties are written on the info label. :param plot_item: the PlotDataItem which holds the points :param points: List of points which where clicked on. :return: None """ scatter_data = plot_item.scatter.data if len(points) > 0: empty_pen = QtGui.QPen() empty_pen.setStyle(QtCore.Qt.NoPen) scatter_data["pen"] = np.array([empty_pen] * len(scatter_data), dtype=object) uuids = np.array([x[11] for x in scatter_data["data"]]) detection = points[0].data() det_uuid = detection["uuid"] idx = np.where(uuids == det_uuid)[0] if len(idx) > 0: idx = idx[0] scatter_data["pen"][idx] = pg.mkPen(color="w", width=3) plot_item.opts["symbolPen"] = scatter_data["pen"] plot_item.updateItems() tr_id = detection["track_id"].decode() if len(tr_id) == 0: tr_id = "<None>" info_text = ( "UUID = {}\nSensor ID = {}\nTimestamp = {}\nRange = {:.3f} m\nAzimuth = {:.3f}°\nRCS = {:.3f} dBsm\n" "x (cc) = {:.3f} m\ny (cc) = {:.3f} m\nRadial Velocity = {:.3f} m/s\n" "Compensated Rad. Vel. = {:.3f} m/s\n" "Label ID = {} ({})\nTrack ID = {}").format( detection["uuid"].decode(), detection["sensor_id"], detection["timestamp"], detection["range_sc"], np.rad2deg(detection["azimuth_sc"]), detection["rcs"], detection["x_cc"], detection["y_cc"], detection["vr"], detection["vr_compensated"], detection["label_id"], self.label_id_to_display_name[detection["label_id"]], tr_id) if "pred_label_id" in detection.dtype.names: pred_label = detection["pred_label_id"] pred_instance = detection["pred_instance_id"] info_text += "\nPredicted Label = {} ({})".format( pred_label, self.prediction_mapping_names.get( pred_label, "Unknown")) mapped_true_label = self.prediction_mapping.get( detection["label_id"], "Unknown") info_text += "\nMapped True Label = {} ({})".format( mapped_true_label, self.prediction_mapping_names.get( mapped_true_label, "Unknown")) if pred_instance is None: info_text += "\nPredicted Instance = <None>" else: info_text += "\nPredicted Instance = {}".format( pred_instance) self.info_label.setText(info_text)