class_docstr: The resampled field grid warper defines a grid based on
  sampling coordinate values from a spatially varying displacement
  field  (passed as a tensor input) along an affine grid pattern
  in the field.
  This enables grids representing small patches of a larger transform,
  as well as the composition of multiple transforms before sampling.
class_docstr_tok: ["The","resampled","field","grid","warper","defines","a","grid","based","on","sampling","coordinate","values","from","a","spatially","varying","displacement","field","(","passed","as","a","tensor","input",")","along","an","affine","grid","pattern","in","the","field",".","This","enables","grids","representing","small","patches","of","a","larger","transform",",","as","well","as","the","composition","of","multiple","transforms","before","sampling","."]
docstr: Assembles the module network and adds it to the graph.
  
  The internal computation graph is assembled according to the set of
  constraints provided at construction time.
  
  Args:
    field: Tensor containing a batch of transformation parameters.
  
  Returns:
    A batch of warped grids.
  
  Raises:
    Error: If the input tensor size is not consistent with the constraints
      passed at construction time.
docstr_tok: ["Assembles","the","module","network","and","adds","it","to","the","graph",".","The","internal","computation","graph","is","assembled","according","to","the","set","of","constraints","provided","at","construction","time",".","Args",":","field",":","Tensor","containing","a","batch","of","transformation","parameters",".","Returns",":","A","batch","of","warped","grids",".","Raises",":","Error",":","If","the","input","tensor","size","is","not","consistent","with","the","constraints","passed","at","construction","time","."]
code: def layer_op(self, field):
      """Assembles the module network and adds it to the graph.
  
      The internal computation graph is assembled according to the set of
      constraints provided at construction time.
  
      Args:
        field: Tensor containing a batch of transformation parameters.
  
      Returns:
        A batch of warped grids.
  
      Raises:
        Error: If the input tensor size is not consistent with the constraints
          passed at construction time.
      """
      input_shape = tf.shape(field)
      input_dtype = field.dtype.as_numpy_dtype
      batch_size = int(field.shape[0])
  
      # transform grid into field coordinate space if necessary
      if self._field_transform == None:
          coords = self._psi
      else:
          coords = tf.matmul(
              self._psi, self._field_transform[:, :, 1:3]
          )
      # resample
      coords = tf.reshape(
          tf.tile(coords, [batch_size, 1, 1]),
          [-1] + list(self._output_shape) + [len(self._source_shape)],
      )
      resampled_coords = self._resampler(field, coords)
      return resampled_coords
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import tensorflow
  from niftynet.layer.grid_warper import GridWarperLayer
  from niftynet.layer.resampler import ResamplerLayer
label_desc: Use image node_id 3 for calling the ResampledFieldGridWarperLayer obj's underlying member method code with example usage: obj.layer_op(field) and returns: resampled_coords