code: def UNet3D(input_shape):
      inputs = tf.keras.Input(input_shape)
      # Encode
      x = EncoderBlock(32, kernel_size=3, strides=1, padding="same")(
          inputs
      )
      syn0 = EncoderBlock(64, kernel_size=3, strides=1, padding="same")(
          x
      )
  
      x = MaxPool3D()(syn0)
      x = EncoderBlock(64, kernel_size=3, strides=1, padding="same")(x)
      syn1 = EncoderBlock(
          128, kernel_size=3, strides=1, padding="same"
      )(x)
  
      x = MaxPool3D()(syn1)
      x = EncoderBlock(128, kernel_size=3, strides=1, padding="same")(x)
      syn2 = EncoderBlock(
          256, kernel_size=3, strides=1, padding="same"
      )(x)
  
      x = MaxPool3D()(syn2)
      x = EncoderBlock(256, kernel_size=3, strides=1, padding="same")(x)
      x = EncoderBlock(512, kernel_size=3, strides=1, padding="same")(x)
  
      # Last layer without relu
      x = Conv3D(512, kernel_size=1, strides=1, padding="same")(x)
  
      x = DecoderBlock(512, kernel_size=2, strides=2, padding="valid")(
          x
      )
  
      x = Concatenate()([x, syn2])
  
      x = DecoderBlock(256, kernel_size=3, strides=1, padding="same")(x)
      x = DecoderBlock(256, kernel_size=3, strides=1, padding="same")(x)
      x = DecoderBlock(256, kernel_size=2, strides=2, padding="valid")(
          x
      )
  
      x = Concatenate()([x, syn1])
  
      x = DecoderBlock(128, kernel_size=3, strides=1, padding="same")(x)
      x = DecoderBlock(128, kernel_size=3, strides=1, padding="same")(x)
      x = DecoderBlock(128, kernel_size=2, strides=2, padding="valid")(
          x
      )
  
      x = Concatenate()([x, syn0])
  
      x = DecoderBlock(64, kernel_size=3, strides=1, padding="same")(x)
      x = DecoderBlock(64, kernel_size=3, strides=1, padding="same")(x)
  
      x = DecoderBlock(1, kernel_size=1, strides=1, padding="valid")(x)
  
      # Last layer without relu
      out = Conv3DTranspose(
          1, kernel_size=1, strides=1, padding="valid"
      )(x)
  
      return Model(inputs, out)
  
imports: import logging
  import numpy
  from dipy.data import get_fnames
  from dipy.testing.decorators import doctest_skip_parser
  from dipy.utils.optpkg import optional_package
  from dipy.nn.utils import normalize, unnormalize, set_logger_level
label_desc: Use image node_id 4 for calling a global function with example usage: UNet3D(input_shape) and returns: Model