code: def crop_resize(x, crops, new_sz):
      # NB assumes square inputs. Not tested for non-square anythings!
      bs = x.shape[0]
      lows, szs = _bbs2sizes(crops, x.shape[-1])
      if not isinstance(new_sz, (list, tuple)):
          new_sz = (new_sz, new_sz)
      id_mat = (
          tensor([[1.0, 0, 0], [0, 1, 0]])[None]
          .repeat((bs, 1, 1))
          .to(x.device)
      )
      with warnings.catch_warnings():
          warnings.filterwarnings("ignore", category=UserWarning)
          sp = F.affine_grid(id_mat, (bs, 1, *new_sz)) + 1.0
          grid = sp * unsqueeze(szs.t(), 1, n=2) + unsqueeze(
              lows.t() * 2.0, 1, n=2
          )
          return F.grid_sample(x.unsqueeze(1), grid - 1)
  
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 23 for calling a global function with example usage: crop_resize(x, crops, new_sz) and returns: F