code: def calculate_localised_cost(self, d1, d2, neighbours, motions):
          
          my_nbrs_with_motion = [n for n in neighbours[d1] if n in motions]
  
          my_motion = (d1.center[0] - d2.center[0], d1.center[1] - d2.center[1])
  
          if my_nbrs_with_motion == []:
              distance = euclidean_dist(d1.center, d2.center) / self.scale
          else:
              # it is not in motions if there is no trace (cell is considered to vanish)
              distance = min([euclidean_dist(my_motion, motions[n]) for n in my_nbrs_with_motion]) / self.scale
  
          area_change = 1 - min(d1.area, d2.area) / max(d1.area, d2.area)
  
          return distance + self.parameters_cost_iteration["area_weight"] * area_change
docs: Calculates assignment cost between two cells taking into account the movement of cells neighbours.
  
          :param CellFeatures d1: detection in first frame
          :param CellFeatures d2: detection in second frame