class_docstr: Implementation of No New-Net
    Isensee et al., "No New-Net", MICCAI BrainLesion Workshop 2018.
  
    The major changes between this and our standard 3d U-Net:
    * input size == output size: padded convs are used
    * leaky relu as non-linearity
    * reduced number of filters before upsampling
    * instance normalization (not batch)
    * fits 128x128x128 with batch size of 2 on one TitanX GPU for
    training
    * no learned upsampling: linear resizing. 
class_docstr_tok: ["Implementation","of","No","New-Net","Isensee","et","al.",",","``","No","New-Net","''",",","MICCAI","BrainLesion","Workshop","2018",".","The","major","changes","between","this","and","our","standard","3d","U-Net",":","*","input","size","==","output","size",":","padded","convs","are","used","*","leaky","relu","as","non-linearity","*","reduced","number","of","filters","before","upsampling","*","instance","normalization","(","not","batch",")","*","fits","128x128x128","with","batch","size","of","2","on","one","TitanX","GPU","for","training","*","no","learned","upsampling",":","linear","resizing","."]
docstr: :param thru_tensor: the input is modified in-place as it goes through the network
  :param is_training:
  :param unused_kwargs:
  :return:
docstr_tok: [":","param","thru_tensor",":","the","input","is","modified","in-place","as","it","goes","through","the","network",":","param","is_training",":",":","param","unused_kwargs",":",":","return",":"]
code: def layer_op(self, thru_tensor, is_training=True, **unused_kwargs):
      """
  
      :param thru_tensor: the input is modified in-place as it goes through the network
      :param is_training:
      :param unused_kwargs:
      :return:
      """
      # image_size  should be divisible by 16 because of max-pooling 4 times, 2x2x2
      assert layer_util.check_spatial_dims(
          thru_tensor, lambda x: x % 16 == 0
      )
      block_layer = UNetBlock(
          "DOWNSAMPLE",
          (self.n_features[0], self.n_features[0]),
          (3, 3),
          with_downsample_branch=True,
          w_initializer=self.initializers["w"],
          w_regularizer=self.regularizers["w"],
          acti_func=self.acti_func,
          name="L1",
      )
      thru_tensor, conv_1 = block_layer(thru_tensor, is_training)
      print(block_layer)
  
      block_layer = UNetBlock(
          "DOWNSAMPLE",
          (self.n_features[1], self.n_features[1]),
          (3, 3),
          with_downsample_branch=True,
          w_initializer=self.initializers["w"],
          w_regularizer=self.regularizers["w"],
          acti_func=self.acti_func,
          name="L2",
      )
      thru_tensor, conv_2 = block_layer(thru_tensor, is_training)
      print(block_layer)
  
      block_layer = UNetBlock(
          "DOWNSAMPLE",
          (self.n_features[2], self.n_features[2]),
          (3, 3),
          with_downsample_branch=True,
          w_initializer=self.initializers["w"],
          w_regularizer=self.regularizers["w"],
          acti_func=self.acti_func,
          name="L3",
      )
      thru_tensor, conv_3 = block_layer(thru_tensor, is_training)
      print(block_layer)
  
      block_layer = UNetBlock(
          "DOWNSAMPLE",
          (self.n_features[3], self.n_features[3]),
          (3, 3),
          with_downsample_branch=True,
          w_initializer=self.initializers["w"],
          w_regularizer=self.regularizers["w"],
          acti_func=self.acti_func,
          name="L4",
      )
      thru_tensor, conv_4 = block_layer(thru_tensor, is_training)
      print(block_layer)
  
      block_layer = UNetBlock(
          "UPSAMPLE",
          (self.n_features[4], self.n_features[3]),
          (3, 3),
          with_downsample_branch=False,
          w_initializer=self.initializers["w"],
          w_regularizer=self.regularizers["w"],
          acti_func=self.acti_func,
          name="bottom",
      )
      thru_tensor, _ = block_layer(thru_tensor, is_training)
      print(block_layer)
  
      block_layer = UNetBlock(
          "UPSAMPLE",
          (self.n_features[3], self.n_features[2]),
          (3, 3),
          with_downsample_branch=False,
          w_initializer=self.initializers["w"],
          w_regularizer=self.regularizers["w"],
          acti_func=self.acti_func,
          name="R4",
      )
      concat_4 = ElementwiseLayer("CONCAT")(conv_4, thru_tensor)
      thru_tensor, _ = block_layer(concat_4, is_training)
      print(block_layer)
  
      block_layer = UNetBlock(
          "UPSAMPLE",
          (self.n_features[2], self.n_features[1]),
          (3, 3),
          with_downsample_branch=False,
          w_initializer=self.initializers["w"],
          w_regularizer=self.regularizers["w"],
          acti_func=self.acti_func,
          name="R3",
      )
      concat_3 = ElementwiseLayer("CONCAT")(conv_3, thru_tensor)
      thru_tensor, _ = block_layer(concat_3, is_training)
      print(block_layer)
  
      block_layer = UNetBlock(
          "UPSAMPLE",
          (self.n_features[1], self.n_features[0]),
          (3, 3),
          with_downsample_branch=False,
          w_initializer=self.initializers["w"],
          w_regularizer=self.regularizers["w"],
          acti_func=self.acti_func,
          name="R2",
      )
      concat_2 = ElementwiseLayer("CONCAT")(conv_2, thru_tensor)
      thru_tensor, _ = block_layer(concat_2, is_training)
      print(block_layer)
  
      block_layer = UNetBlock(
          "NONE",
          (self.n_features[0], self.n_features[0], self.num_classes),
          (3, 3, 1),
          with_downsample_branch=False,
          w_initializer=self.initializers["w"],
          w_regularizer=self.regularizers["w"],
          acti_func=self.acti_func,
          name="R1_FC",
      )
  
      concat_1 = ElementwiseLayer("CONCAT")(conv_1, thru_tensor)
      thru_tensor, _ = block_layer(concat_1, is_training)
      print(block_layer)
  
      return thru_tensor
  
file_path: NiftyNet/niftynet/network/no_new_net.py
imports: from __future__ import absolute_import, print_function
  from niftynet.layer import layer_util
  from niftynet.layer.base_layer import TrainableLayer
  from niftynet.layer.convolution import ConvolutionalLayer
  from niftynet.layer.deconvolution import DeconvolutionalLayer
  from niftynet.layer.downsample import DownSampleLayer
  from niftynet.layer.elementwise import ElementwiseLayer
  from niftynet.layer.crop import CropLayer
  from niftynet.layer.linear_resize import LinearResizeLayer
  from niftynet.utilities.util_common import look_up_operations
label_desc: Use image node_id 2 for calling the UNet3D obj's underlying member method code with example usage: obj.layer_op(thru_tensor, is_training) and returns: thru_tensor