class_docstr: The fast BSpline 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 based on BSpline smoothing, as described by Rueckert et al.
      To ensure that it can be done efficiently, several assumptions are made:
      1) The grid is a cartesian grid aligned with the field.
      2) Knots occur every M,N,O grid points (in X,Y,Z) This allows the
         smoothing to be represented as a 4x4x4 convolutional kernel with MxNxO channels
class_docstr_tok: ["The","fast","BSpline","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","based","on","BSpline","smoothing",",","as","described","by","Rueckert","et","al",".","To","ensure","that","it","can","be","done","efficiently",",","several","assumptions","are","made",":","1",")","The","grid","is","a","cartesian","grid","aligned","with","the","field",".","2",")","Knots","occur","every","M",",","N",",","O","grid","points","(","in","X",",","Y",",","Z",")","This","allows","the","smoothing","to","be","represented","as","a","4x4x4","convolutional","kernel","with","MxNxO","channels"]
docstr: Creates the convolutional kernel
docstr_tok: ["Creates","the","convolutional","kernel"]
code: def _create_features(self):
      """Creates the convolutional kernel"""
      build_coefficient = lambda u, d: np.reshape(
          np.stack(
              [
                  (np.power(1 - u, 3)) / 6,
                  (3 * np.power(u, 3) - 6 * np.power(u, 2) + 4) / 6,
                  (-3 * np.power(u, 3) + 3 * np.power(u, 2) + 3 * u + 1)
                  / 6,
                  np.power(u, 3) / 6,
              ],
              0,
          ),
          np.roll([4, 1, 1, len(u), 1, 1], d),
      )
      coeffs = [
          build_coefficient(np.arange(k) / k, d)
          for d, k in enumerate(self._knot_spacing)
      ]
      kernels = tf.constant(
          np.reshape(np.prod(coeffs), [4, 4, 4, 1, -1]),
          dtype=tf.float32,
      )
      return kernels
  
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 BSplineFieldImageGridWarperLayer obj's underlying member method code with example usage: obj._create_features() and returns: kernels