class_docstr: 2D images, axcodes specifications are ignored when
  loading. (Resampling to new pixdims is currently not supported).
class_docstr_tok: ["2D","images",",","axcodes","specifications","are","ignored","when","loading",".","(","Resampling","to","new","pixdims","is","currently","not","supported",")","."]
docstr: This function read image shape info from the headers
  The lengths in the fifth dim of multiple images are summed
  as a multi-mod representation.
  The fourth dim corresponding to different time sequences
  is ignored.
  
  :return: a tuple of integers as image shape
docstr_tok: ["This","function","read","image","shape","info","from","the","headers","The","lengths","in","the","fifth","dim","of","multiple","images","are","summed","as","a","multi-mod","representation",".","The","fourth","dim","corresponding","to","different","time","sequences","is","ignored",".",":","return",":","a","tuple","of","integers","as","image","shape"]
code: def shape(self):
      """
      This function read image shape info from the headers
      The lengths in the fifth dim of multiple images are summed
      as a multi-mod representation.
      The fourth dim corresponding to different time sequences
      is ignored.
  
      :return: a tuple of integers as image shape
      """
      if self._original_shape is None:
          try:
              self._original_shape = tuple(
                  load_image_obj(_file, _loader).header["dim"][1:6]
                  for _file, _loader in zip(self.file_path, self.loader)
              )
          except (IOError, KeyError, AttributeError, IndexError):
              tf.logging.fatal(
                  "unknown image shape from header %s", self.file_path
              )
              raise ValueError
          try:
              non_modality_shapes = set(
                  [
                      tuple(shape[:4].tolist())
                      for shape in self._original_shape
                  ]
              )
              assert len(non_modality_shapes) == 1
          except (TypeError, IndexError, AssertionError):
              tf.logging.fatal(
                  "could not combining multimodal images: "
                  "shapes not consistent %s -- %s",
                  self.file_path,
                  self._original_shape,
              )
              raise ValueError
          n_modalities = np.sum(
              [int(shape[4]) for shape in self._original_shape]
          )
          self._original_shape = non_modality_shapes.pop() + (
              n_modalities,
          )
          self._original_shape = tuple(
              [
                  shape_i if shape_i > 0 else 1
                  for shape_i in self._original_shape
              ]
          )
      return self._original_shape
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  from abc import ABCMeta, abstractmethod
  import nibabel
  import numpy
  import tensorflow
  from six import with_metaclass, string_types
  import niftynet.io.misc_io
  from niftynet.io.image_loader import load_image_obj
  from niftynet.io.misc_io import resolve_file_name, dtype_casting
  from niftynet.utilities.niftynet_global_config import NiftyNetGlobalConfig
label_desc: Use image node_id 4 for calling the SpatialImage2D obj's underlying member method code with example usage: obj.shape() and returns: self