[wip] not prooperly working

This commit is contained in:
Jan Grewe 2025-02-25 08:14:53 +01:00
parent 3bc938cda7
commit 461f3aadfe
3 changed files with 9 additions and 2 deletions

View File

@ -38,6 +38,8 @@ class TrackingData(QObject):
return self._data["track"].shape[0] return self._data["track"].shape[0]
def _find(self, ids): def _find(self, ids):
if len(ids) < 1:
return np.array([])
ids = np.sort(ids) ids = np.sort(ids)
indexes = np.ones_like(ids, dtype=int) * -1 indexes = np.ones_like(ids, dtype=int) * -1
j = 0 j = 0
@ -75,8 +77,10 @@ class TrackingData(QObject):
ids : array-like ids : array-like
An array-like object containing the IDs to be set as user selections. An array-like object containing the IDs to be set as user selections.
""" """
print(ids)
self._selection = self._find(ids) self._selection = self._find(ids)
self._selected_ids = ids self._selected_ids = ids
print(self._selection, self._selected_ids)
def setTrack(self, track_id:int, setUserLabeled:bool=True)-> None: def setTrack(self, track_id:int, setUserLabeled:bool=True)-> None:
"""Assign a new track_id to the user-selected detections """Assign a new track_id to the user-selected detections
@ -88,7 +92,8 @@ class TrackingData(QObject):
setUserLabeled : bool setUserLabeled : bool
Should the "userlabeled" state of the detections be set to True? Otherwise they will be left untouched. Should the "userlabeled" state of the detections be set to True? Otherwise they will be left untouched.
""" """
self["track"][self._user_selections] = track_id print(self._selection)
self["track"][self._selection] = track_id
if setUserLabeled: if setUserLabeled:
self.setUserLabeledStatus(True, True) self.setUserLabeledStatus(True, True)

View File

@ -136,7 +136,8 @@ class DetectionView(QWidget):
coordinates = self._data.coordinates(selection=True) coordinates = self._data.coordinates(selection=True)
centercoordinates = self._data.centerOfGravity(selection=True) centercoordinates = self._data.centerOfGravity(selection=True)
userlabeled = self._data.selectedData("userlabeled") userlabeled = self._data.selectedData("userlabeled")
indices = self._data.selectedData("index")
indices = self._data.selectionIndices
image_rect = self._pixmapitem.boundingRect() if self._pixmapitem is not None else QRectF(0,0,0,0) image_rect = self._pixmapitem.boundingRect() if self._pixmapitem is not None else QRectF(0,0,0,0)
for i, idx in enumerate(indices): for i, idx in enumerate(indices):

View File

@ -307,6 +307,7 @@ class FixTracks(QWidget):
def on_detectionsSelected(self, detections): def on_detectionsSelected(self, detections):
logging.debug("Tracks: Detections selected") logging.debug("Tracks: Detections selected")
print(detections)
tracks = np.zeros(len(detections), dtype=int) tracks = np.zeros(len(detections), dtype=int)
ids = np.zeros_like(tracks) ids = np.zeros_like(tracks)
frames = np.zeros_like(tracks) frames = np.zeros_like(tracks)