code: def load_boolean_mask(
      path: Union[str, Path],
      predicate: Optional[Callable[[np.ndarray], np.ndarray]] = None,
  ) -> np.ndarray:
      """Load boolean nibabel.SpatialImage mask.
  
      Parameters
      ----------
      path
          Mask path.
      predicate
          Callable used to create boolean values, e.g. a threshold function
          ``lambda x: x > 50``.
  
      Returns
      -------
      np.ndarray
          Boolean array corresponding to mask.
      """
      if not isinstance(path, str):
          path = str(path)
      data = nib.load(path).get_fdata()  # type: ignore
      if predicate is not None:
          mask = predicate(data)
      else:
          mask = data.astype(bool)
      return mask
  
file_path: brainiak/brainiak/io.py
imports: from pathlib import Path
  from typing import Optional, Callable, Iterable, List, Union
  import logging
  import nibabel
  import numpy
  from nibabel.nifti1 import Nifti1Pair
  from nibabel.spatialimages import SpatialImage
  from .image import SingleConditionSpec
label_desc: Use image node_id 3 for calling a global function with example usage: load_boolean_mask(path, predicate) and returns: mask