code: def templateLengthProcessData(
      input_sample,
      start_centers,
      expected_cluster_length,
      type_splitting,
      kmax,
      ccore,
      **kwargs,
  ):
      if isinstance(input_sample, str):
          sample = read_sample(input_sample)
      else:
          sample = input_sample
  
      xmeans_instance = xmeans(
          sample,
          start_centers,
          kmax,
          0.025,
          type_splitting,
          ccore,
          **kwargs,
      )
      xmeans_instance.process()
  
      clusters = xmeans_instance.get_clusters()
      centers = xmeans_instance.get_centers()
      wce = xmeans_instance.get_total_wce()
  
      obtained_cluster_sizes = [len(cluster) for cluster in clusters]
  
      assertion.eq(len(sample), sum(obtained_cluster_sizes))
      assertion.eq(len(clusters), len(centers))
      assertion.le(len(centers), kmax)
  
      expected_wce = 0.0
      metric = kwargs.get(
          "metric", distance_metric(type_metric.EUCLIDEAN_SQUARE)
      )
      for index_cluster in range(len(clusters)):
          for index_point in clusters[index_cluster]:
              expected_wce += metric(
                  sample[index_point], centers[index_cluster]
              )
  
      assertion.eq(expected_wce, wce)
  
      if expected_cluster_length is not None:
          assertion.eq(len(expected_cluster_length), len(centers))
  
          obtained_cluster_sizes.sort()
          expected_cluster_length.sort()
  
          assertion.eq(obtained_cluster_sizes, expected_cluster_length)
  
file_path: pyclustering/pyclustering/cluster/tests/xmeans_templates.py
imports: import numpy
  import random
  from pyclustering.cluster.xmeans import xmeans, splitting_type
  from pyclustering.cluster.center_initializer import random_center_initializer
  from pyclustering.samples.definitions import SIMPLE_SAMPLES
  from pyclustering.utils import read_sample, distance_metric, type_metric
  from pyclustering.tests.assertion import assertion
label_desc: Use image node_id 1 for calling the XmeansTestTemplates obj's underlying member method code with example usage: obj.templateLengthProcessData(input_sample, start_centers, expected_cluster_length, type_splitting, kmax, ccore) without return types