class_docstr: This class provides common dispatching and validation logic for indexing.
class_docstr_tok: ["This","class","provides","common","dispatching","and","validation","logic","for","indexing","."]
code: def __getitem__(self, key):
      row, col = self._validate_indices(key)
  
      # Dispatch to specialized methods.
      if isinstance(row, INT_TYPES):
          if isinstance(col, INT_TYPES):
              return self._get_intXint(row, col)
          elif isinstance(col, slice):
              self._raise_on_1d_array_slice()
              return self._get_intXslice(row, col)
          elif col.ndim == 1:
              self._raise_on_1d_array_slice()
              return self._get_intXarray(row, col)
          elif col.ndim == 2:
              return self._get_intXarray(row, col)
          raise IndexError("index results in >2 dimensions")
      elif isinstance(row, slice):
          if isinstance(col, INT_TYPES):
              self._raise_on_1d_array_slice()
              return self._get_sliceXint(row, col)
          elif isinstance(col, slice):
              if row == slice(None) and row == col:
                  return self.copy()
              return self._get_sliceXslice(row, col)
          elif col.ndim == 1:
              return self._get_sliceXarray(row, col)
          raise IndexError("index results in >2 dimensions")
      elif row.ndim == 1:
          if isinstance(col, INT_TYPES):
              self._raise_on_1d_array_slice()
              return self._get_arrayXint(row, col)
          elif isinstance(col, slice):
              return self._get_arrayXslice(row, col)
      else:  # row.ndim == 2
          if isinstance(col, INT_TYPES):
              return self._get_arrayXint(row, col)
          elif isinstance(col, slice):
              raise IndexError("index results in >2 dimensions")
          elif row.shape[1] == 1 and (
              col.ndim == 1 or col.shape[0] == 1
          ):
              # special case for outer indexing
              return self._get_columnXarray(row[:, 0], col.ravel())
  
      # The only remaining case is inner (fancy) indexing
      row, col = _broadcast_arrays(row, col)
      if row.shape != col.shape:
          raise IndexError("number of row and column indices differ")
      if row.size == 0:
          return self.__class__(
              np.atleast_2d(row).shape, dtype=self.dtype
          )
      return self._get_arrayXarray(row, col)
  
imports: import numpy
  from ._sputils import isintlike
label_desc: Use image node_id 2 for calling the IndexMixin obj's underlying member method code with example usage: obj.__getitem__(key) and returns: self, self, self, self, self, self, self, self, self, self, self, self, self, self