code: def _get_smoothing_kernel(sigma, spatial_rank):
      """
  
      :param sigma: float, standard deviation for gaussian smoothing kernel
      :param spatial_rank: int, rank of input
      :return: smoothing kernel
      """
      # sigma defined in voxel not in freeform deformation grid
      if sigma <= 0:
          raise NotImplementedError
      tail = int(sigma * 2)
      if spatial_rank == 2:
          x, y = np.mgrid[-tail : tail + 1, -tail : tail + 1]
          g = np.exp(-0.5 * (x * x + y * y) / sigma * sigma)
      elif spatial_rank == 3:
          x, y, z = np.mgrid[
              -tail : tail + 1, -tail : tail + 1, -tail : tail + 1
          ]
          g = np.exp(-0.5 * (x * x + y * y + z * z) / sigma * sigma)
      else:
          raise NotImplementedError
      return g / g.sum()
  
imports: from __future__ import absolute_import, print_function
  import numpy
  import tensorflow
  from tensorflow.contrib.layers.python.layers import regularizers
  from niftynet.engine.application_initializer import GlorotUniform
  from niftynet.layer.convolution import ConvolutionalLayer
  from niftynet.layer.downsample_res_block import DownBlock
  from niftynet.layer.grid_warper import _create_affine_features
  from niftynet.layer.layer_util import infer_spatial_rank, check_spatial_dims
  from niftynet.layer.linear_resize import LinearResizeLayer
  from niftynet.layer.spatial_gradient import SpatialGradientLayer
  from niftynet.layer.upsample_res_block import UpBlock
  from niftynet.network.base_net import BaseNet
label_desc: Use image node_id 1 for calling a global function with example usage: _get_smoothing_kernel(sigma, spatial_rank) and returns: unknown