code: def reduce_rois(rois, include):
      """Reduce multiple ROIs to one inclusion and one exclusion ROI.
  
      Parameters
      ----------
      rois : list or ndarray
          A list of 3D arrays, each with shape (x, y, z) corresponding to the
          shape of the brain volume, or a 4D array with shape (n_rois, x, y,
          z). Non-zeros in each volume are considered to be within the region.
  
      include : array or list
          A list or 1D array of boolean marking inclusion or exclusion
          criteria.
  
      Returns
      -------
      include_roi : boolean 3D array
          An array marking the inclusion mask.
  
      exclude_roi : boolean 3D array
          An array marking the exclusion mask
  
      Notes
      -----
      The include_roi and exclude_roi can be used to perform the operation: "(A
      or B or ...) and not (X or Y or ...)", where A, B are inclusion regions
      and X, Y are exclusion regions.
  
      """
      # throw warning if non bool roi detected
      if not np.all([irois.dtype == bool for irois in rois]):
          warn(
              "Non-boolean input mask detected. Treating all nonzeros as True."
          )
  
      include_roi = np.zeros(rois[0].shape, dtype=bool)
      exclude_roi = np.zeros(rois[0].shape, dtype=bool)
  
      for i in range(len(rois)):
          if include[i]:
              include_roi |= rois[i] != 0
          else:
              exclude_roi |= rois[i] != 0
  
      return include_roi, exclude_roi
  
imports: from collections import defaultdict, OrderedDict
  from functools import wraps
  from itertools import combinations, groupby
  from warnings import warn
  import numpy
  from nibabel.affines import apply_affine
  from scipy.spatial.distance import cdist
  from dipy.core.geometry import dist_to_corner
  from dipy.tracking import metrics
  from dipy.tracking.vox2track import _streamlines_in_mask
  from dipy.tracking._utils import _mapping_to_voxel, _to_voxel_coordinates
label_desc: Use image node_id 16 for calling a global function with example usage: reduce_rois(rois, include) and returns: include_roi,  exclude_roi