class_docstr: Ecat implementation of array proxy protocol
  
  The array proxy allows us to freeze the passed fileobj and
  header such that it returns the expected data array.
class_docstr_tok: ["Ecat","implementation","of","array","proxy","protocol","The","array","proxy","allows","us","to","freeze","the","passed","fileobj","and","header","such","that","it","returns","the","expected","data","array","."]
docstr: Return slice `sliceobj` from ECAT data, optimizing if possible
docstr_tok: ["Return","slice","`","sliceobj","`","from","ECAT","data",",","optimizing","if","possible"]
code: def __getitem__(self, sliceobj):
      """Return slice `sliceobj` from ECAT data, optimizing if possible"""
      sliceobj = canonical_slicers(sliceobj, self.shape)
      # Indices into sliceobj referring to image axes
      ax_inds = [i for i, obj in enumerate(sliceobj) if obj is not None]
      assert len(ax_inds) == len(self.shape)
      frame_mapping = get_frame_order(self._subheader._mlist)
      # Analyze index for 4th axis
      slice3 = sliceobj[ax_inds[3]]
      # We will load volume by volume.  Make slicer into volume by dropping
      # index over the volume axis
      in_slicer = sliceobj[: ax_inds[3]] + sliceobj[ax_inds[3] + 1 :]
      # int index for 4th axis, load one slice
      if isinstance(slice3, Integral):
          data = self._subheader.data_from_fileobj(
              frame_mapping[slice3][0]
          )
          return data[in_slicer]
      # slice axis for 4th axis, we will iterate over slices
      out_shape = predict_shape(sliceobj, self.shape)
      out_data = np.empty(out_shape)
      # Slice into output data with out_slicer
      out_slicer = [slice(None)] * len(out_shape)
      # Work out axis corresponding to volume in output
      in2out_ind = slice2outax(len(self.shape), sliceobj)[3]
      # Iterate over specified 4th axis indices
      for i in list(range(self.shape[3]))[slice3]:
          data = self._subheader.data_from_fileobj(frame_mapping[i][0])
          out_slicer[in2out_ind] = i
          out_data[tuple(out_slicer)] = data[in_slicer]
      return out_data
  
imports: import warnings
  from numbers import Integral
  import numpy
  from .arraywriters import make_array_writer
  from .fileslice import canonical_slicers, predict_shape, slice2outax
  from .spatialimages import SpatialHeader, SpatialImage
  from .volumeutils import array_from_file, make_dt_codes, native_code, swapped_code
  from .wrapstruct import WrapStruct
label_desc: Use image node_id 6 for calling the EcatImageArrayProxy obj's underlying member method code with example usage: obj.__getitem__(sliceobj) and returns: out_data, data