code: def rescale_img_stack(images, scale=0.5):
      """Rescale stacked images by a given factor
  
      Args:
          images (list): Input data list, where each sample in shape (n_phases, dim1, dim2).
          scale (float, optional): Scale factor. Defaults to 0.5.
  
      Returns:
          list: Rescaled images, each sample in the list in shape (n_phases, dim1 * scale, dim2 * scale).
      """
      n_samples = len(images)
      # n_phases = images.shape[:2]
      images_rescale = []
      for i in range(n_samples):
          stack_i = []
          n_phases = images[i].shape[0]
          for j in range(n_phases):
              img = images[i][j, ...]
              img_rescale = rescale(img, scale, preserve_range=True)
              # preserve_range should be true otherwise the output will be normalised values
              stack_i.append(
                  img_rescale.reshape((1,) + img_rescale.shape)
              )
          stack_i = np.concatenate(stack_i, axis=0)
          images_rescale.append(stack_i)
  
      return images_rescale
  
file_path: pykale/kale/prepdata/image_transform.py
imports: import logging
  import numpy
  import torchvision.transforms
  from skimage.transform import estimate_transform, rescale, warp
label_desc: Use image node_id 3 for calling a global function with example usage: rescale_img_stack(images, scale) and returns: images_rescale