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: volume [x, y, 1, m, n] will have a spatial rank 2
  volume [x, y, z, m, n] will have a spatial rank 3
     if z > 1
  
  (resampling/reorientation will not be done when spatial rank is 2).
docstr_tok: ["volume","[","x",",","y",",","1",",","m",",","n","]","will","have","a","spatial","rank","2","volume","[","x",",","y",",","z",",","m",",","n","]","will","have","a","spatial","rank","3","if","z",">","1","(","resampling\/reorientation","will","not","be","done","when","spatial","rank","is","2",")","."]
code: def spatial_rank(self):
      """
      volume [x, y, 1, m, n] will have a spatial rank 2
      volume [x, y, z, m, n] will have a spatial rank 3
         if z > 1
  
      (resampling/reorientation will not be done when spatial rank is 2).
  
      """
      return int(np.sum([dim > 1 for dim in self.shape[:3]]))
  
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 2 for calling the SpatialImage2D obj's underlying member method code with example usage: obj.spatial_rank() and returns: int