code: def test_rescale(scale, images):
      img_rescaled = rescale_img_stack(images, 1 / scale)
      n_samples = len(img_rescaled)
      testing.assert_equal(n_samples, len(images))
      for i in range(n_samples):
          # dim1 and dim2 have been rescaled
          testing.assert_equal(
              img_rescaled[i].shape[-1],
              round(images[i].shape[-1] / scale),
          )
          testing.assert_equal(
              img_rescaled[i].shape[-2],
              round(images[i].shape[-2] / scale),
          )
          # n_phases are unchanged
          testing.assert_equal(
              img_rescaled[i].shape[0], images[i].shape[0]
          )
  
file_path: pykale/tests/prepdata/test_image_transform.py
imports: import os
  import matplotlib.figure
  import numpy
  import pytest
  from numpy import testing
  from kale.interpret.visualize import plot_multi_images
  from kale.loaddata.image_access import check_dicom_series_uid, dicom2arraylist, read_dicom_dir
  from kale.prepdata.image_transform import mask_img_stack, normalize_img_stack, reg_img_stack, rescale_img_stack
label_desc: Use image node_id 4 for calling a global function with example usage: test_rescale(scale, images) without return types