class_docstr: Mixin class for Cartesian 2D elements to add basic support for
  SelectionExpr streams.
class_docstr_tok: ["Mixin","class","for","Cartesian","2D","elements","to","add","basic","support","for","SelectionExpr","streams","."]
code: def _get_index_expr(self, index_cols, sel):
      if len(index_cols) == 1:
          index_dim = index_cols[0]
          vals = dim(index_dim).apply(sel, expanded=False, flat=True)
          expr = dim(index_dim).isin(list(util.unique_iterator(vals)))
      else:
          get_shape = dim(self.dataset.get_dimension(), np.shape)
          index_cols = [
              dim(self.dataset.get_dimension(c), np.ravel)
              for c in index_cols
          ]
          vals = dim(
              index_cols[0], util.unique_zip, *index_cols[1:]
          ).apply(sel, expanded=True, flat=True)
          contains = dim(
              index_cols[0], util.lzip, *index_cols[1:]
          ).isin(vals, object=True)
          expr = dim(contains, np.reshape, get_shape)
      return expr
  
imports: import sys
  import numpy
  import pandas
  from ..core import Dataset, NdOverlay, util
  from ..streams import Lasso, Selection1D, SelectionXY
  from ..util.transform import dim
  from .annotation import HSpan, VSpan
label_desc: Use image node_id 3 for calling the Selection2DExpr obj's underlying member method code with example usage: obj._get_index_expr(index_cols, sel) and returns: expr