class_docstr: The rescaled field grid warper defines a grid based on
  sampling coordinate values from a spatially varying displacement
  field  (passed as a tensor input) along a regular cartesian grid
  pattern aligned with the field. Specifically, this class defines
  a grid by resampling the field (using tf.rescale_images with
  align_corners=False) to the output_shape.
class_docstr_tok: ["The","rescaled","field","grid","warper","defines","a","grid","based","on","sampling","coordinate","values","from","a","spatially","varying","displacement","field","(","passed","as","a","tensor","input",")","along","a","regular","cartesian","grid","pattern","aligned","with","the","field",".","Specifically",",","this","class","defines","a","grid","by","resampling","the","field","(","using","tf.rescale_images","with","align_corners=False",")","to","the","output_shape","."]
code: def layer_op(self, field):
      input_shape = tf.shape(field)
      input_dtype = field.dtype.as_numpy_dtype
      batch_size = int(field.shape[0])
      reshaped_field = tf.reshape(
          field,
          [batch_size, self._coeff_shape[0], self._coeff_shape[1], -1],
      )
      coords_intermediate = tf.image.resize_images(
          reshaped_field,
          self._output_shape[0:2],
          self._interpolation,
          align_corners=False,
      )
      sz_xy_z1 = [
          batch_size,
          self._output_shape[0] * self._output_shape[1],
          self._coeff_shape[2],
          -1,
      ]
      tmp = tf.reshape(coords_intermediate, sz_xy_z1)
      final_sz = [batch_size] + list(self._output_shape) + [-1]
      sz_xy_z2 = [
          self._output_shape[0] * self._output_shape[1],
          self._output_shape[2],
      ]
      coords = tf.reshape(
          tf.image.resize_images(
              tmp, sz_xy_z2, self._interpolation, align_corners=False
          ),
          final_sz,
      )
      return 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 2 for calling the RescaledFieldImageGridWarperLayer obj's underlying member method code with example usage: obj.layer_op(field) and returns: coords