class_docstr: ### Description
  This network estimates affine transformations from
      a pair of moving and fixed image:
  
          Hu et al., Label-driven weakly-supervised learning for
          multimodal deformable image registration, arXiv:1711.01666
          https://arxiv.org/abs/1711.01666
  
          Hu et al., Weakly-Supervised Convolutional Neural Networks for
          Multimodal Image Registration, Medical Image Analysis (2018)
          https://doi.org/10.1016/j.media.2018.07.002
  
      see also:
          https://github.com/YipengHu/label-reg
  
  ### Building blocks
  [DOWN CONV]         - Convolutional layer + Residual Unit + Max pooling
  [CONV]              - Convolutional layer
  [FC]                - Fully connected layer, outputs the affine matrix
  [WARPER]            - Grid resampling with the obtained affine matrix
  
  ### Diagram
  
  INPUT PAIR --> [DOWN CONV]x4 --> [CONV] --> [FC] --> [WARPER] --> DISPLACEMENT FIELD
  
  ### Constraints
  - input spatial rank should be either 2 or 3 (2D or 3D images only)
class_docstr_tok: ["#","#","#","Description","This","network","estimates","affine","transformations","from","a","pair","of","moving","and","fixed","image",":","Hu","et","al.",",","Label-driven","weakly-supervised","learning","for","multimodal","deformable","image","registration",",","arXiv:1711.01666","https",":","\/\/arxiv.org\/abs\/1711.01666","Hu","et","al.",",","Weakly-Supervised","Convolutional","Neural","Networks","for","Multimodal","Image","Registration",",","Medical","Image","Analysis","(","2018",")","https",":","\/\/doi.org\/10.1016\/j.media.2018.07.002","see","also",":","https",":","\/\/github.com\/YipengHu\/label-reg","#","#","#","Building","blocks","[","DOWN","CONV","]","-","Convolutional","layer","+","Residual","Unit","+","Max","pooling","[","CONV","]","-","Convolutional","layer","[","FC","]","-","Fully","connected","layer",",","outputs","the","affine","matrix","[","WARPER","]","-","Grid","resampling","with","the","obtained","affine","matrix","#","#","#","Diagram","INPUT","PAIR","--",">","[","DOWN","CONV","]","x4","--",">","[","CONV","]","--",">","[","FC","]","--",">","[","WARPER","]","--",">","DISPLACEMENT","FIELD","#","#","#","Constraints","-","input","spatial","rank","should","be","either","2","or","3","(","2D","or","3D","images","only",")"]
docstr: :param decay: float, regularisation decay
  :param affine_w_initializer: weight initialisation for affine registration network
  :param affine_b_initializer: bias initialisation for affine registration network
  :param acti_func: activation function to use
  :param name: layer name
docstr_tok: [":","param","decay",":","float",",","regularisation","decay",":","param","affine_w_initializer",":","weight","initialisation","for","affine","registration","network",":","param","affine_b_initializer",":","bias","initialisation","for","affine","registration","network",":","param","acti_func",":","activation","function","to","use",":","param","name",":","layer","name"]
code: def __init__(
      self,
      decay=1e-6,
      affine_w_initializer=None,
      affine_b_initializer=None,
      acti_func="relu",
      name="inet-affine",
  ):
      """
  
      :param decay: float, regularisation decay
      :param affine_w_initializer: weight initialisation for affine registration network
      :param affine_b_initializer: bias initialisation for affine registration network
      :param acti_func: activation function to use
      :param name: layer name
      """
  
      BaseNet.__init__(self, name=name)
  
      self.fea = [4, 8, 16, 32, 64]
      self.k_conv = 3
      self.affine_w_initializer = affine_w_initializer
      self.affine_b_initializer = affine_b_initializer
      self.res_param = {
          "w_initializer": GlorotUniform.get_instance(""),
          "w_regularizer": regularizers.l2_regularizer(decay),
          "acti_func": acti_func,
      }
      self.affine_param = {
          "w_regularizer": regularizers.l2_regularizer(decay),
          "b_regularizer": None,
      }
  
file_path: NiftyNet/niftynet/network/interventional_affine_net.py
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.fully_connected import FullyConnectedLayer
  from niftynet.layer.grid_warper import AffineGridWarperLayer
  from niftynet.layer.layer_util import infer_spatial_rank
  from niftynet.layer.linear_resize import LinearResizeLayer
  from niftynet.network.base_net import BaseNet
label_desc: Use image node_id 1 to create a new INetAffine object from inherited base classes: BaseNet with example: obj = INetAffine(decay, affine_w_initializer, affine_b_initializer, acti_func, name)