code: def squeeze_spatial_temporal_dim(tf_tensor):
      """
      Given a tensorflow tensor, ndims==6 means::
  
          [batch, x, y, z, time, modality]
  
      this function removes x, y, z, and time dims if
      the length along the dims is one.
  
      :return: squeezed tensor
      """
      if tf_tensor.shape.ndims != 6:
          return tf_tensor
      if tf_tensor.shape[4] != 1:
          if tf_tensor.shape[5] > 1:
              raise NotImplementedError(
                  "time sequences not currently supported"
              )
          # input shape [batch, x, y, z, t, 1]: swapping 't' and 1
          tf_tensor = tf.transpose(tf_tensor, [0, 1, 2, 3, 5, 4])
      axis_to_squeeze = []
      for idx, axis in enumerate(tf_tensor.shape.as_list()):
          if idx in (0, 5):
              continue
          if axis == 1:
              axis_to_squeeze.append(idx)
      return tf.squeeze(tf_tensor, axis=axis_to_squeeze)
  
imports: from __future__ import absolute_import, print_function, unicode_literals
  import errno
  import importlib
  import logging
  import os
  import re
  import sys
  import warnings
  import nibabel
  import numpy
  import pandas
  import scipy.ndimage
  import tensorflow
  from tensorflow.core.framework import summary_pb2
  from niftynet.io.image_loader import load_image_obj
  from niftynet.utilities.niftynet_global_config import NiftyNetGlobalConfig
  from niftynet.utilities.util_import import require_module
label_desc: Use image node_id 16 for calling a global function with example usage: squeeze_spatial_temporal_dim(tf_tensor) and returns: tf, tf_tensor