class_docstr: This class reads two feature vectors from files (often generated
  by running feature extractors on images in advance)
  and returns n linear combinations of the vectors.
  The coefficients are generated by::
  
      np.linspace(0, 1, n_interpolations)
docstr: This function first reads two vectors, and interpolates them
  with self.n_interpolations mixing coefficients.
  
  Location coordinates are set to ``np.ones`` for all the vectors.
code: def layer_op(self, *_unused_args, **_unused_kwargs):
      """
      This function first reads two vectors, and interpolates them
      with self.n_interpolations mixing coefficients.
  
      Location coordinates are set to ``np.ones`` for all the vectors.
      """
      while True:
          image_id_x, data_x, _ = self.reader(idx=None, shuffle=False)
          image_id_y, data_y, _ = self.reader(idx=None, shuffle=True)
          if not data_x or not data_y:
              break
          if image_id_x == image_id_y:
              continue
          embedding_x = data_x[self.window.names[0]]
          embedding_y = data_y[self.window.names[0]]
  
          steps = np.linspace(0, 1, self.n_interpolations)
          for _, mixture in enumerate(steps):
              output_vector = embedding_x * mixture + embedding_y * (
                  1 - mixture
              )
              coordinates = np.ones(
                  (1, N_SPATIAL * 2 + 1), dtype=np.int32
              )
              coordinates[0, 0:2] = [image_id_x, image_id_y]
              output_dict = {}
              for name in self.window.names:
                  coordinates_key = LOCATION_FORMAT.format(name)
                  image_data_key = name
                  output_dict[coordinates_key] = coordinates
                  output_dict[image_data_key] = output_vector[
                      np.newaxis, ...
                  ]
              yield output_dict
  
file_path: NiftyNet/niftynet/engine/sampler_linear_interpolate_v2.py
imports: from __future__ import absolute_import, print_function, division
  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 the LinearInterpolateSampler obj's underlying member method code with example usage: obj.layer_op() without return types