class_docstr: Build GlobalNet for image registration.
  
  Reference:
      Hu, Yipeng, et al.
      "Label-driven weakly-supervised learning
      for multimodal deformable image registration,"
      https://arxiv.org/abs/1711.01666
docstr: Args:
      image_size: output displacement field spatial size
      spatial_dims: number of spatial dims
      in_channels: number of input channels
      num_channel_initial: number of initial channels
      depth: input is at level 0, bottom is at level depth.
      out_kernel_initializer: kernel initializer for the last layer
      out_activation: activation at the last layer
      pooling: for down-sampling, use non-parameterized pooling if true, otherwise use conv
      concat_skip: when up-sampling, concatenate skipped tensor if true, otherwise use addition
      encode_kernel_sizes: kernel size for down-sampling
      save_theta: whether to save the theta matrix estimation
docstr_tok: ["Args",":","image_size",":","output","displacement","field","spatial","size","spatial_dims",":","number","of","spatial","dims","in_channels",":","number","of","input","channels","num_channel_initial",":","number","of","initial","channels","depth",":","input","is","at","level","0",",","bottom","is","at","level","depth",".","out_kernel_initializer",":","kernel","initializer","for","the","last","layer","out_activation",":","activation","at","the","last","layer","pooling",":","for","down-sampling",",","use","non-parameterized","pooling","if","true",",","otherwise","use","conv","concat_skip",":","when","up-sampling",",","concatenate","skipped","tensor","if","true",",","otherwise","use","addition","encode_kernel_sizes",":","kernel","size","for","down-sampling","save_theta",":","whether","to","save","the","theta","matrix","estimation"]
code: def __init__(
      self,
      image_size: list[int],
      spatial_dims: int,
      in_channels: int,
      num_channel_initial: int,
      depth: int,
      out_kernel_initializer: str | None = "kaiming_uniform",
      out_activation: str | None = None,
      pooling: bool = True,
      concat_skip: bool = False,
      encode_kernel_sizes: int | list[int] = 3,
      save_theta: bool = False,
  ):
      """
      Args:
          image_size: output displacement field spatial size
          spatial_dims: number of spatial dims
          in_channels: number of input channels
          num_channel_initial: number of initial channels
          depth: input is at level 0, bottom is at level depth.
          out_kernel_initializer: kernel initializer for the last layer
          out_activation: activation at the last layer
          pooling: for down-sampling, use non-parameterized pooling if true, otherwise use conv
          concat_skip: when up-sampling, concatenate skipped tensor if true, otherwise use addition
          encode_kernel_sizes: kernel size for down-sampling
          save_theta: whether to save the theta matrix estimation
      """
      for size in image_size:
          if size % (2**depth) != 0:
              raise ValueError(
                  f"given depth {depth}, "
                  f"all input spatial dimension must be divisible by {2 ** depth}, "
                  f"got input of size {image_size}"
              )
      self.image_size = image_size
      self.decode_size = [size // (2**depth) for size in image_size]
      self.save_theta = save_theta
      super().__init__(
          spatial_dims=spatial_dims,
          in_channels=in_channels,
          num_channel_initial=num_channel_initial,
          depth=depth,
          out_kernel_initializer=out_kernel_initializer,
          out_activation=out_activation,
          out_channels=spatial_dims,
          pooling=pooling,
          concat_skip=concat_skip,
          encode_kernel_sizes=encode_kernel_sizes,
      )
  
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 GlobalNet object from inherited base classes: RegUNet with example: obj = GlobalNet(image_size, spatial_dims, in_channels, num_channel_initial, depth, out_kernel_initializer, out_activation, pooling, concat_skip, encode_kernel_sizes, save_theta)