code: def _set_roi_mask(self, roi_mask):
          
  
          if isinstance(roi_mask,
                        np.ndarray):  # not (roi_mask is None or roi_mask=='auto'):
              self._verify_shape_compatibility(roi_mask, 'ROI set')
              self.roi_mask = roi_mask
  
              self.roi_list = np.unique(roi_mask.flatten())
              np.setdiff1d(self.roi_list, cfg.background_value)
          else:
              self.roi_mask = np.ones(self.carpet.shape[:-1]) # last dim is self.fixed_dim already
              self.roi_list = [1, ]
docs: Sets a new ROI mask.