code: def template_clustering(
      start_centers,
      path,
      tolerance=0.025,
      criterion=splitting_type.BAYESIAN_INFORMATION_CRITERION,
      ccore=True,
  ):
      sample = read_sample(path)
  
      xmeans_instance = xmeans(
          sample,
          start_centers,
          20,
          tolerance,
          criterion,
          ccore,
          repeat=5,
      )
      (ticks, _) = timedcall(xmeans_instance.process)
  
      clusters = xmeans_instance.get_clusters()
      centers = xmeans_instance.get_centers()
  
      criterion_string = "UNKNOWN"
      if criterion == splitting_type.BAYESIAN_INFORMATION_CRITERION:
          criterion_string = "BAYESIAN INFORMATION CRITERION"
      elif (
          criterion
          == splitting_type.MINIMUM_NOISELESS_DESCRIPTION_LENGTH
      ):
          criterion_string = "MINIMUM NOISELESS DESCRIPTION_LENGTH"
  
      print(
          "Sample: ",
          ntpath.basename(path),
          "\nInitial centers: '",
          (start_centers is not None),
          "', Execution time: '",
          ticks,
          "', Number of clusters:",
          len(clusters),
          ",",
          criterion_string,
          "\n",
      )
  
      visualizer = cluster_visualizer()
      visualizer.set_canvas_title(criterion_string)
      visualizer.append_clusters(clusters, sample)
      visualizer.append_cluster(centers, None, marker="*")
      visualizer.show()
  
imports: import ntpath
  import random
  from pyclustering.samples.definitions import SIMPLE_SAMPLES, FCPS_SAMPLES
  from pyclustering.cluster import cluster_visualizer
  from pyclustering.cluster.xmeans import xmeans, splitting_type
  from pyclustering.utils import read_sample, timedcall
label_desc: Use image node_id 1 for calling a global function with example usage: template_clustering(start_centers, path, tolerance, criterion, ccore) without return types