class_docstr: 3D image from a single, supports resampling and reorientation
  (3D image from a set of 2D slices is currently not supported).
class_docstr_tok: ["3D","image","from","a","single",",","supports","resampling","and","reorientation","(","3D","image","from","a","set","of","2D","slices","is","currently","not","supported",")","."]
code: def shape(self):
      image_shape = super(SpatialImage3D, self).shape
      spatial_shape = image_shape[:3]
      rest_shape = image_shape[3:]
  
      if int(np.sum([dim > 1 for dim in spatial_shape])) < 3:
          # skip resampling and reorientation for spatially 2D
          return image_shape
      pixdim = tuple(self.original_pixdim[0])
      if self.original_axcodes[0] and self.output_axcodes[0]:
          transf, _, _ = misc.compute_orientation(
              self.output_axcodes[0], self.original_axcodes[0]
          )
          spatial_shape = tuple(
              spatial_shape[k] for k in transf[:, 0].astype(np.int)
          )
          if pixdim:
              pixdim = tuple(
                  pixdim[k] for k in transf[:, 0].astype(np.int)
              )
  
      if pixdim and self.output_pixdim[0]:
          try:
              zoom_ratio = np.divide(
                  pixdim[:3], self.output_pixdim[0][:3]
              )
              spatial_shape = tuple(
                  int(round(ii * jj))
                  for ii, jj in zip(spatial_shape, zoom_ratio)
              )
          except (ValueError, IndexError):
              tf.logging.fatal(
                  "unknown pixdim %s: %s",
                  self.original_pixdim,
                  self.output_pixdim,
              )
              raise ValueError
      return spatial_shape + rest_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 SpatialImage3D obj's underlying member method code with example usage: obj.shape() and returns: unknown, image_shape