code: def _create_affine_features(
      output_shape, source_shape, relative=False
  ):
      """
      Generates n-dimensional homogeneous coordinates
      for a given grid definition.
      `source_shape` and `output_shape` are used to
      define the size of the source and output signal domains.
  
      For example,
      for an image of size `width=W` and `height=H`,
      `{source,output}_shape=[H, W]`;
      for a volume of size `width=W`, `height=H` and `depth=D`,
      `{source,output}_shape=[H, W, D]`.
  
      Note returning in Matrix indexing 'ij'
  
      Args:
        output_shape: Iterable of integers determining
          the shape of the grid to be warped.
        source_shape: Iterable of integers determining
          the domain of the signal to be resampled.
      Returns:
        List of flattened numpy arrays of coordinates
        When the dimensionality of `output_shape` is smaller that that of
        `source_shape` the last rows before [1, ..., 1] will be filled with -1.
      """
      dim_gap = len(source_shape) - len(output_shape)
      embedded_output_shape = list(output_shape) + [1] * dim_gap
      if not relative:
          ranges = [
              np.arange(dim, dtype=np.float32)
              for dim in embedded_output_shape
          ]
      else:
          ranges = [
              np.linspace(-1.0, 1.0, x, dtype=np.float32)
              for x in embedded_output_shape
          ]
      ranges.append(np.array([1.0]))
      return [x.ravel() for x in np.meshgrid(*ranges, indexing="ij")]
  
imports: from __future__ import absolute_import, division, print_function
  from itertools import chain
  import numpy
  import tensorflow
  from niftynet.layer.base_layer import Layer, LayerFromCallable, Invertible
label_desc: Use image node_id 1 for calling a global function with example usage: _create_affine_features(output_shape, source_shape, relative) and returns: unknown