code: def _mask_from_roi(data_shape, roi_center, roi_radii):
      """Produces a mask from a cuboid ROI defined by center and radii.
  
      Parameters
      ----------
      data_shape : array-like, (3,)
          Shape of the data from which the ROI is taken.
      roi_center : array-like, (3,)
          Center of ROI in data.
      roi_radii : array-like, (3,)
          Radii of cuboid ROI.
  
      Returns
      -------
      mask : ndarray
          Mask of the cuboid ROI.
      """
  
      ci, cj, ck = roi_center
      wi, wj, wk = roi_radii
      interval_i = slice(int(ci - wi), int(ci + wi) + 1)
      interval_j = slice(int(cj - wj), int(cj + wj) + 1)
      interval_k = slice(int(ck - wk), int(ck + wk) + 1)
  
      if wi == 0:
          interval_i = ci
      elif wj == 0:
          interval_j = cj
      elif wk == 0:
          interval_k = ck
  
      mask = np.zeros(data_shape, dtype=np.int64)
      mask[interval_i, interval_j, interval_k] = 1
  
      return mask
  
imports: import numpy
label_desc: Use image node_id 4 for calling a global function with example usage: _mask_from_roi(data_shape, roi_center, roi_radii) and returns: mask