code: def check_cast_bin8(arr):
      """Return binary array `arr` as uint8 type, or raise if not binary.
  
      Parameters
      ----------
      arr : array-like
  
      Returns
      -------
      bin8_arr : uint8 array
          `bin8_arr` has same shape as `arr`, is of dtype ``np.uint8``, with
          values 0 and 1 only.
  
      Raises
      ------
      ValueError
          When the array is not binary.  Specifically, raise if, for any element
          ``e``, ``e != (e != 0)``.
      """
      if np.any(arr != (arr != 0)):
          raise ValueError(
              "input array should only contain values 0 and 1"
          )
      return arr.astype(np.uint8)
  
file_path: nipy/nipy/algorithms/statistics/utils.py
imports: from itertools import combinations
  import numpy
  from scipy.stats import norm
label_desc: Use image node_id 11 for calling a global function with example usage: check_cast_bin8(arr) and returns: arr