code: def test_cluster_map_centroid_add_cluster():
      clusters = ClusterMapCentroid()
  
      centroids = []
      for i in range(3):
          cluster = ClusterCentroid(centroid=np.zeros_like(features))
  
          centroids.append(np.zeros_like(features))
          for id_data in range(2 * i):
              centroids[-1] = (
                  centroids[-1] * id_data + (id_data + 1) * features
              ) / (id_data + 1)
              cluster.assign(id_data, (id_data + 1) * features)
              cluster.update()
  
          clusters.add_cluster(cluster)
          assert_array_equal(cluster.centroid, centroids[-1])
          assert_equal(type(cluster), ClusterCentroid)
          assert_true(cluster == clusters[-1])
  
      assert_equal(type(clusters.centroids), list)
      assert_array_equal(
          list(itertools.chain(*clusters.centroids)),
          list(itertools.chain(*centroids)),
      )
  
      # Check adding features of different sizes (shorter and longer)
      features_shape_short = (1, features_shape[1] - 3)
      features_too_short = np.ones(features_shape_short, dtype=dtype)
      assert_raises(ValueError, cluster.assign, 123, features_too_short)
  
      features_shape_long = (1, features_shape[1] + 3)
      features_too_long = np.ones(features_shape_long, dtype=dtype)
      assert_raises(ValueError, cluster.assign, 123, features_too_long)
  
imports: import copy
  import itertools
  import numpy
  from numpy.testing import assert_array_equal, assert_raises, assert_equal
  from dipy.segment.clustering import Cluster, ClusterCentroid
  from dipy.segment.clustering import ClusterMap, ClusterMapCentroid
  from dipy.segment.clustering import Clustering
  from dipy.testing import assert_true, assert_false, assert_arrays_equal
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 23 for calling a global function with example usage: test_cluster_map_centroid_add_cluster() without return types