code: def boxes_center_distance(
      boxes1: NdarrayOrTensor,
      boxes2: NdarrayOrTensor,
      euclidean: bool = True,
  ) -> tuple[NdarrayOrTensor, NdarrayOrTensor, NdarrayOrTensor]:
      """
      Distance of center points between two sets of boxes
  
      Args:
          boxes1: bounding boxes, Nx4 or Nx6 torch tensor or ndarray. The box mode is assumed to be ``StandardMode``
          boxes2: bounding boxes, Mx4 or Mx6 torch tensor or ndarray. The box mode is assumed to be ``StandardMode``
          euclidean: computed the euclidean distance otherwise it uses the l1 distance
  
      Returns:
          - The pairwise distances for every element in boxes1 and boxes2,
            with size of (N,M) and same data type as ``boxes1``.
          - Center points of boxes1, with size of (N,spatial_dims) and same data type as ``boxes1``.
          - Center points of boxes2, with size of (M,spatial_dims) and same data type as ``boxes1``.
  
      Reference:
          https://github.com/MIC-DKFZ/nnDetection/blob/main/nndet/core/boxes/ops.py
  
      """
  
      if not isinstance(boxes1, type(boxes2)):
          warnings.warn(
              f"boxes1 is {type(boxes1)}, while boxes2 is {type(boxes2)}. The result will be {type(boxes1)}."
          )
  
      # convert numpy to tensor if needed
      boxes1_t, *_ = convert_data_type(boxes1, torch.Tensor)
      boxes2_t, *_ = convert_data_type(boxes2, torch.Tensor)
  
      center1 = box_centers(
          boxes1_t.to(COMPUTE_DTYPE)
      )  # (N, spatial_dims)
      center2 = box_centers(
          boxes2_t.to(COMPUTE_DTYPE)
      )  # (M, spatial_dims)
  
      if euclidean:
          dists = (center1[:, None] - center2[None]).pow(2).sum(-1).sqrt()  # type: ignore
      else:
          # before sum: (N, M, spatial_dims)
          dists = (center1[:, None] - center2[None]).sum(-1)
  
      # convert tensor back to numpy if needed
      (dists, center1, center2), *_ = convert_to_dst_type(
          src=(dists, center1, center2), dst=boxes1
      )
      return dists, center1, center2
  
imports: from __future__ import annotations
  import inspect
  import warnings
  from abc import ABC, abstractmethod
  from collections.abc import Callable, Sequence
  from copy import deepcopy
  import numpy
  import torch
  from monai.config.type_definitions import NdarrayOrTensor, NdarrayTensor
  from monai.utils import look_up_option
  from monai.utils.enums import BoxModeName
  from monai.utils.type_conversion import convert_data_type, convert_to_dst_type
label_desc: Use image node_id 8 for calling a global function with example usage: boxes_center_distance(boxes1, boxes2, euclidean) and returns: dists,  center1,  center2