code: def run(self, datastore):
      logger.info("Reading datastore metadata for heuristic planner...")
      if len(datastore.list_images()) == 0:
          logger.warning(
              "Currently no images are available in datastore for sampling"
          )
          return
  
      # Sampling max_samples images from the datastore
      datastore_check = (
          datastore.list_images()
          if len(datastore.list_images()) < self.max_samples
          else random.sample(datastore.list_images(), self.max_samples)
      )
  
      spacings = []
      img_sizes = []
      pix_img_max = []
      pix_img_min = []
      pix_img_mean = []
      pix_img_std = []
      loader = LoadImage(image_only=False)
      for n in tqdm(datastore_check):
          img, mtdt = loader(datastore.get_image_uri(n))
  
          # Check if images have more than one modality
          if mtdt["pixdim"][4] > 0:
              logger.info(
                  f"Image {mtdt['filename_or_obj'].split('/')[-1]} has more than one modality ..."
              )
          spacings.append(mtdt["pixdim"][1:4])
          img_sizes.append(mtdt["spatial_shape"])
  
          pix_img_max.append(img.max())
          pix_img_min.append(img.min())
          pix_img_mean.append(img.mean())
          pix_img_std.append(img.std())
  
      spacings = np.array(spacings)
      img_sizes = np.array(img_sizes)
  
      logger.info(f"Available GPU memory: {gpu_memory_map()} in MB")
  
      self.target_spacing = self._get_target_spacing(
          np.mean(spacings, 0)
      )
      self.spatial_size = self._get_target_img_size(
          np.mean(img_sizes, 0, np.int64)
      )
      logger.info(
          f"Spacing: {self.target_spacing}; Spatial Size: {self.spatial_size}"
      )
  
      # Image stats for intensity normalization
      self.max_pix = np.max(np.array(pix_img_max))
      self.min_pix = np.min(np.array(pix_img_min))
      self.mean_pix = np.mean(np.array(pix_img_mean))
      self.std_pix = np.mean(np.array(pix_img_std))
      logger.info(
          f"Pix Max: {self.max_pix}; Min: {self.min_pix}; Mean: {self.mean_pix}; Std: {self.std_pix}"
      )
  
file_path: MONAILabel/monailabel/utils/others/planner.py
imports: import logging
  import random
  import numpy
  from monai.transforms import LoadImage
  from tqdm import tqdm
  from monailabel.utils.others.generic import gpu_memory_map
label_desc: Use image node_id 2 for calling the HeuristicPlanner obj's underlying member method code with example usage: obj.run(datastore) without return types