@@ -24,7 +24,7 @@ class TrackComparator:
2424 def __init__ (self ,
2525 gt : Union [str , 'TrackMate' ],
2626 pred : Union [str , 'TrackMate' ],
27- downsample : int = 1 ):
27+ downsampleT : int = 1 ):
2828 # Load TrackMate instances
2929 self .gt = TrackMate (xml_path = gt , enhanced_computation = False ) if isinstance (gt , str ) else gt
3030 self .pred = TrackMate (xml_path = pred , enhanced_computation = False ) if isinstance (pred , str ) else pred
@@ -35,9 +35,9 @@ def __init__(self,
3535 raw_gt = self ._track_cloud (self .gt_df )
3636 raw_pred = self ._track_cloud (self .pred_df )
3737 # Downsample factor (1=no downsampling)
38- self .downsample = max (1 , downsample )
38+ self .downsampleT = max (1 , downsampleT )
3939 # Precompute track items
40- self .gt_items = [(tid , coords [:: self . downsample ] ) for tid , coords in raw_gt .items ()]
40+ self .gt_items = [(tid , coords ) for tid , coords in raw_gt .items ()]
4141 self .pred_items = list (raw_pred .items ())
4242
4343 def _track_cloud (self , df : pd .DataFrame ) -> Dict [int , np .ndarray ]:
@@ -97,7 +97,7 @@ def cca_metric(self) -> float:
9797 for tid ,_ in self .gt_items ]
9898 # Pred lengths up-sampled back to GT grid
9999 pred_len = [((self .pred_df [self .pred_df ['unique_id' ]== tid ]['t' ].max () -
100- self .pred_df [self .pred_df ['unique_id' ]== tid ]['t' ].min ()) * self .downsample )
100+ self .pred_df [self .pred_df ['unique_id' ]== tid ]['t' ].min ()) * self .downsampleT )
101101 for tid ,_ in self .pred_items ]
102102 gt_arr = np .array (gt_len , int ); pred_arr = np .array (pred_len , int )
103103 if gt_arr .size == 0 : return np .nan
@@ -116,7 +116,7 @@ def ct_metric(self, assignments: pd.DataFrame) -> float:
116116 spans .setdefault ('gt' ,{})[tid ] = (int (sub ['t' ].min ()), int (sub ['t' ].max ()))
117117 for tid ,_ in self .pred_items :
118118 sub = self .pred_df [self .pred_df ['unique_id' ]== tid ]
119- b = int (sub ['t' ].min ())* self .downsample ; e = int (sub ['t' ].max ())* self .downsample
119+ b = int (sub ['t' ].min ())* self .downsampleT ; e = int (sub ['t' ].max ())* self .downsampleT
120120 spans .setdefault ('pred' ,{})[tid ] = (b ,e )
121121 # count T_rc
122122 T_rc = 0
0 commit comments