class_docstr: Reimplementation of LocalNet, based on:
  `Weakly-supervised convolutional neural networks for multimodal image registration
  <https://doi.org/10.1016/j.media.2018.07.002>`_.
  `Label-driven weakly-supervised learning for multimodal deformable image registration
  <https://arxiv.org/abs/1711.01666>`_.
  
  Adapted from:
      DeepReg (https://github.com/DeepRegNet/DeepReg)
docstr: Args:
      spatial_dims: number of spatial dims
      in_channels: number of input channels
      num_channel_initial: number of initial channels
      out_kernel_initializer: kernel initializer for the last layer
      out_activation: activation at the last layer
      out_channels: number of channels for the output
      extract_levels: list, which levels from net to extract. The maximum level must equal to ``depth``
      pooling: for down-sampling, use non-parameterized pooling if true, otherwise use conv3d
      use_additive_sampling: whether use additive up-sampling layer for decoding.
      concat_skip: when up-sampling, concatenate skipped tensor if true, otherwise use addition
      mode: mode for interpolation when use_additive_sampling, default is "nearest".
      align_corners: align_corners for interpolation when use_additive_sampling, default is None.
docstr_tok: ["Args",":","spatial_dims",":","number","of","spatial","dims","in_channels",":","number","of","input","channels","num_channel_initial",":","number","of","initial","channels","out_kernel_initializer",":","kernel","initializer","for","the","last","layer","out_activation",":","activation","at","the","last","layer","out_channels",":","number","of","channels","for","the","output","extract_levels",":","list",",","which","levels","from","net","to","extract",".","The","maximum","level","must","equal","to","``","depth","``","pooling",":","for","down-sampling",",","use","non-parameterized","pooling","if","true",",","otherwise","use","conv3d","use_additive_sampling",":","whether","use","additive","up-sampling","layer","for","decoding",".","concat_skip",":","when","up-sampling",",","concatenate","skipped","tensor","if","true",",","otherwise","use","addition","mode",":","mode","for","interpolation","when","use_additive_sampling",",","default","is","``","nearest","''",".","align_corners",":","align_corners","for","interpolation","when","use_additive_sampling",",","default","is","None","."]
code: def __init__(
      self,
      spatial_dims: int,
      in_channels: int,
      num_channel_initial: int,
      extract_levels: tuple[int],
      out_kernel_initializer: str | None = "kaiming_uniform",
      out_activation: str | None = None,
      out_channels: int = 3,
      pooling: bool = True,
      use_additive_sampling: bool = True,
      concat_skip: bool = False,
      mode: str = "nearest",
      align_corners: bool | None = None,
  ):
      """
      Args:
          spatial_dims: number of spatial dims
          in_channels: number of input channels
          num_channel_initial: number of initial channels
          out_kernel_initializer: kernel initializer for the last layer
          out_activation: activation at the last layer
          out_channels: number of channels for the output
          extract_levels: list, which levels from net to extract. The maximum level must equal to ``depth``
          pooling: for down-sampling, use non-parameterized pooling if true, otherwise use conv3d
          use_additive_sampling: whether use additive up-sampling layer for decoding.
          concat_skip: when up-sampling, concatenate skipped tensor if true, otherwise use addition
          mode: mode for interpolation when use_additive_sampling, default is "nearest".
          align_corners: align_corners for interpolation when use_additive_sampling, default is None.
      """
      self.use_additive_upsampling = use_additive_sampling
      self.mode = mode
      self.align_corners = align_corners
      super().__init__(
          spatial_dims=spatial_dims,
          in_channels=in_channels,
          num_channel_initial=num_channel_initial,
          extract_levels=extract_levels,
          depth=max(extract_levels),
          out_kernel_initializer=out_kernel_initializer,
          out_activation=out_activation,
          out_channels=out_channels,
          pooling=pooling,
          concat_skip=concat_skip,
          encode_kernel_sizes=[7] + [3] * max(extract_levels),
      )
  
imports: from __future__ import annotations
  import torch
  from torch import nn
  from torch.nn import functional
  from monai.networks.blocks.regunet_block import RegistrationDownSampleBlock, RegistrationExtractionBlock, RegistrationResidualConvBlock, get_conv_block, get_deconv_block
  from monai.networks.utils import meshgrid_ij
label_desc: Use image node_id 1 to create a new LocalNet object from inherited base classes: RegUNet with example: obj = LocalNet(spatial_dims, in_channels, num_channel_initial, extract_levels, out_kernel_initializer, out_activation, out_channels, pooling, use_additive_sampling, concat_skip, mode, align_corners)