code: def _infer_spatial_size(img_sizes, win_sizes):
      """
      Utility function to find the spatial size of image,
      and the largest spatial window size across input sections.
  
      Raises NotImplementedError if the images have
      different spatial dimensions.
  
      :param img_sizes: dictionary of {'input_name': (img_size_x, img_size,y,...)}
      :param win_sizes: dictionary of {'input_name': (win_size_x, win_size_y,...)}
      :return: (image_spatial_size, window_largest_spatial_size)
      """
      uniq_spatial_size = set(
          [
              img_size[:N_SPATIAL]
              for img_size in list(img_sizes.values())
          ]
      )
      if len(uniq_spatial_size) != 1:
          tf.logging.fatal(
              "Don't know how to generate sampling "
              "locations: Spatial dimensions of the "
              "grouped input sources are not "
              "consistent. %s",
              uniq_spatial_size,
          )
          raise NotImplementedError
      img_spatial_size = np.asarray(
          uniq_spatial_size.pop(), dtype=np.int32
      )
  
      # find the largest spatial window across input sections
      _win_spatial_sizes = [
          win_size[:N_SPATIAL] for win_size in win_sizes.values()
      ]
      _win_spatial_sizes = np.asarray(
          _win_spatial_sizes, dtype=np.int32
      )
      win_spatial_size = np.max(_win_spatial_sizes, axis=0)
  
      assert all(
          [
              img_spatial_size[i] >= win_spatial_size[i]
              for i in range(N_SPATIAL)
          ]
      ), "window size {} is larger than image size {}".format(
          win_spatial_size, img_spatial_size
      )
  
      return img_spatial_size, win_spatial_size
  
file_path: NiftyNet/niftynet/engine/sampler_uniform_v2.py
imports: from __future__ import absolute_import, division, print_function
  import numpy
  import tensorflow
  from niftynet.engine.image_window_dataset import ImageWindowDataset
  from niftynet.engine.image_window import N_SPATIAL, LOCATION_FORMAT
label_desc: Use image node_id 2 for calling a global function with example usage: _infer_spatial_size(img_sizes, win_sizes) and returns: img_spatial_size,  win_spatial_size