code: def crop_central_block(x, size):
      assert all(
          [i >= s for i, s in zip(x.get_shape().as_list()[1:], size)]
      ), (
          "Output size must not be bigger than input size. But was {} compared "
          "to {}".format(x.get_shape().as_list()[1:], size)
      )
  
      slicer = [slice(None)] * len(x.get_shape().as_list())
  
      for i in range(len(size)):
          # use i + 1 to account for batch dimension
          start = (x.get_shape().as_list()[i + 1] - size[i]) // 2
          end = start + size[i]
          slicer[i + 1] = slice(start, end)
  
      return x[slicer]
  
file_path: DLTK/dltk/networks/segmentation/deepmedic.py
imports: from __future__ import unicode_literals
  from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import tensorflow
  from dltk.core.upsample import linear_upsample_3d
  from dltk.core.activations import prelu, leaky_relu
label_desc: Use image node_id 1 for calling a global function with example usage: crop_central_block(x, size) and returns: x