class_docstr: resample inputs according to ``sample_coords``
class_docstr_tok: ["resample","inputs","according","to","``","sample_coords","``"]
code: def __init__(
      self,
      interpolation="LINEAR",
      boundary="REPLICATE",
      name="resampler",
      implementation="Fast",
  ):
      super(ResamplerLayer, self).__init__(name=name)
      self.boundary = boundary.upper()
      self.boundary_func = look_up_operations(
          self.boundary, SUPPORTED_BOUNDARY
      )
      self.interpolation = look_up_operations(
          interpolation.upper(), SUPPORTED_INTERPOLATION
      )
  
      if self.boundary == "ZERO" and self.interpolation == "BSPLINE":
          tf.logging.fatal(
              "Zero padding is not supported for BSPLINE mode"
          )
          raise NotImplementedError
  
      if self.boundary == "ZERO" and self.interpolation == "IDW":
          tf.logging.warning(
              "Zero padding is not supported for IDW mode"
          )
          # raise NotImplementedError
  
      self.FastResamplerLayer = None  #
      if implementation.lower() in ["niftyreg", "fast"]:
          # check if niftyreg_resampling_layer is installed
          try:
              from niftyreg_image_resampling import (
                  NiftyregImageResamplingLayer,
              )
              import niftyreg_image_resampling as resampler_module
          except ImportError:
              tf.logging.warning(
                  """
                      niftyreg_image_resampling is not installed; falling back onto
                      niftynet.layer.resampler.ResamplerLayer. To allow fast resampling,
                      please see installation instructions in
                      niftynet/contrib/niftyreg_image_resampling/README.md
                      """
              )
              return
  
          # Passthrough of supported boundary types for  resampling
          SUPPORTED_BOUNDARY_FAST = resampler_module.SUPPORTED_BOUNDARY
  
          # Passthrough of supported interpolation types for NiftyReg resampling
          SUPPORTED_INTERPOLATION_FAST = (
              resampler_module.SUPPORTED_INTERPOLATION
          )
          # check compatibility of the resampling options with niftyreg_image_resampling
          try:
              boundary_fast = look_up_operations(
                  self.boundary, SUPPORTED_BOUNDARY_FAST
              )
              interp_fast = look_up_operations(
                  self.interpolation, SUPPORTED_INTERPOLATION_FAST
              )
              self.FastResamplerLayer = NiftyregImageResamplingLayer(
                  interp_fast, boundary_fast
              )
              tf.logging.info("""NiftyReg image resampling is used.""")
          except ValueError as e:
              tf.logging.warning(e)
              tf.logging.warning(
                  """Falling back onto niftynet.layer.resampler.ResamplerLayer."""
              )
  
file_path: NiftyNet/niftynet/layer/resampler.py
imports: from __future__ import absolute_import, division, print_function
  import tensorflow
  from niftynet.layer.base_layer import Layer
  from niftynet.layer.layer_util import infer_spatial_rank
  from niftynet.utilities.util_common import look_up_operations
label_desc: Use image node_id 1 to create a new ResamplerLayer object from inherited base classes: Layer with example: obj = ResamplerLayer(interpolation, boundary, name, implementation)