code: def mask2bbox(mask):
      no_batch = mask.dim() == 2
      if no_batch:
          mask = mask[None]
      bb1 = _px_bounds(mask, -1).t()
      bb2 = _px_bounds(mask, -2).t()
      res = torch.stack([bb1, bb2], dim=1).to(mask.device)
      return res[..., 0] if no_batch else res
  
imports: from __future__ import annotations
  from ..basics import *
  from ..vision.all import *
  from ..data.transforms import *
  import pydicom, kornia, skimage
  from pydicom.dataset import Dataset
  from pydicom.tag import BaseTag
  from pydicom.multival import MultiValue
  from PIL import Image
label_desc: Use image node_id 21 for calling a global function with example usage: mask2bbox(mask) and returns: unknown