code: def ir2tf(imp_resp, shape, dim=None, is_real=True):
      """Compute the transfer function of an impulse response (IR).
  
      This function makes the necessary correct zero-padding, zero
      convention, correct fft2, etc... to compute the transfer function
      of IR. To use with unitary Fourier transform for the signal (ufftn
      or equivalent).
  
      Parameters
      ----------
      imp_resp : ndarray
          The impulse responses.
      shape : tuple of int
          A tuple of integer corresponding to the target shape of the
          transfer function.
      dim : int, optional
          The last axis along which to compute the transform. All
          axes by default.
      is_real : boolean, optional
         If True (default), imp_resp is supposed real and the Hermitian property
         is used with rfftn Fourier transform.
  
      Returns
      -------
      y : complex ndarray
         The transfer function of shape ``shape``.
  
      See Also
      --------
      ufftn, uifftn, urfftn, uirfftn
  
      Examples
      --------
      >>> np.all(np.array([[4, 0], [0, 0]]) == ir2tf(np.ones((2, 2)), (2, 2)))
      True
      >>> ir2tf(np.ones((2, 2)), (512, 512)).shape == (512, 257)
      True
      >>> ir2tf(np.ones((2, 2)), (512, 512), is_real=False).shape == (512, 512)
      True
  
      Notes
      -----
      The input array can be composed of multiple-dimensional IR with
      an arbitrary number of IR. The individual IR must be accessed
      through the first axes. The last ``dim`` axes contain the space
      definition.
      """
      if not dim:
          dim = imp_resp.ndim
      # Zero padding and fill
      irpadded_dtype = _supported_float_type(imp_resp.dtype)
      irpadded = np.zeros(shape, dtype=irpadded_dtype)
      irpadded[tuple([slice(0, s) for s in imp_resp.shape])] = imp_resp
      # Roll for zero convention of the fft to avoid the phase
      # problem. Work with odd and even size.
      for axis, axis_size in enumerate(imp_resp.shape):
          if axis >= imp_resp.ndim - dim:
              irpadded = np.roll(
                  irpadded,
                  shift=-int(np.floor(axis_size / 2)),
                  axis=axis,
              )
  
      func = fft.rfftn if is_real else fft.fftn
      out = func(irpadded, axes=(range(-dim, 0)))
  
      # TODO: remove .astype call once SciPy >= 1.4 is required
      cplx_dtype = np.promote_types(irpadded_dtype, np.complex64)
      return out.astype(cplx_dtype, copy=False)
  
file_path: scikit-image/skimage/restoration/uft.py
imports: import numpy
  import scipy.fft
  from .._shared.utils import _supported_float_type
label_desc: Use image node_id 10 for calling a global function with example usage: ir2tf(imp_resp, shape, dim, is_real) and returns: out