class_docstr: generate randomised elastic deformations
  along each dim for data augmentation
code: def _randomise_bspline_transformation(self, shape):
      # generate transformation
      if len(shape) == 5:  # for niftynet reader outputs
          squeezed_shape = [dim for dim in shape[:3] if dim > 1]
      else:
          squeezed_shape = shape[: self.spatial_rank]
      itkimg = sitk.GetImageFromArray(np.zeros(squeezed_shape))
      trans_from_domain_mesh_size = [
          self.num_controlpoints
      ] * itkimg.GetDimension()
      self._bspline_transformation = sitk.BSplineTransformInitializer(
          itkimg, trans_from_domain_mesh_size
      )
  
      params = self._bspline_transformation.GetParameters()
      params_numpy = np.asarray(params, dtype=float)
      params_numpy = (
          params_numpy
          + np.random.randn(params_numpy.shape[0])
          * self.std_deformation_sigma
      )
  
      # remove z deformations! The resolution in z is too bad
      # params_numpy[0:int(len(params) / 3)] = 0
  
      params = tuple(params_numpy)
      self._bspline_transformation.SetParameters(params)
  
file_path: NiftyNet/niftynet/layer/rand_elastic_deform.py
imports: from __future__ import absolute_import, print_function
  import warnings
  import numpy
  from niftynet.layer.base_layer import RandomisedLayer
  from niftynet.utilities.util_import import require_module
label_desc: Use image node_id 3 for calling the RandomElasticDeformationLayer obj's underlying member method code with example usage: obj._randomise_bspline_transformation(shape) without return types