code: def fourier_domain_adaptation(
      img: np.ndarray, target_img: np.ndarray, beta: float
  ) -> np.ndarray:
      """
      Fourier Domain Adaptation from https://github.com/YanchaoYang/FDA
  
      Args:
          img:  source image
          target_img:  target image for domain adaptation
          beta: coefficient from source paper
  
      Returns:
          transformed image
  
      """
  
      img = np.squeeze(img)
      target_img = np.squeeze(target_img)
  
      if target_img.shape != img.shape:
          raise ValueError(
              "The source and target images must have the same shape,"
              " but got {} and {} respectively.".format(
                  img.shape, target_img.shape
              )
          )
  
      # get fft of both source and target
      fft_src = np.fft.fft2(img.astype(np.float32), axes=(0, 1))
      fft_trg = np.fft.fft2(target_img.astype(np.float32), axes=(0, 1))
  
      # extract amplitude and phase of both fft-s
      amplitude_src, phase_src = np.abs(fft_src), np.angle(fft_src)
      amplitude_trg = np.abs(fft_trg)
  
      # mutate the amplitude part of source with target
      amplitude_src = np.fft.fftshift(amplitude_src, axes=(0, 1))
      amplitude_trg = np.fft.fftshift(amplitude_trg, axes=(0, 1))
      height, width = amplitude_src.shape[:2]
      border = np.floor(min(height, width) * beta).astype(int)
      center_y, center_x = np.floor([height / 2.0, width / 2.0]).astype(
          int
      )
  
      y1, y2 = center_y - border, center_y + border + 1
      x1, x2 = center_x - border, center_x + border + 1
  
      amplitude_src[y1:y2, x1:x2] = amplitude_trg[y1:y2, x1:x2]
      amplitude_src = np.fft.ifftshift(amplitude_src, axes=(0, 1))
  
      # get mutated image
      src_image_transformed = np.fft.ifft2(
          amplitude_src * np.exp(1j * phase_src), axes=(0, 1)
      )
      src_image_transformed = np.real(src_image_transformed)
  
      return src_image_transformed
  
imports: import random
  from typing import Any, Callable, Literal, Sequence, Tuple
  import cv2
  import numpy
  from qudida import DomainAdapter
  from skimage.exposure import match_histograms
  from sklearn.decomposition import PCA
  from sklearn.preprocessing import MinMaxScaler, StandardScaler
  from albumentations.augmentations.utils import clipped, get_opencv_dtype_from_numpy, is_grayscale_image, is_multispectral_image, preserve_shape, read_rgb_image
  from ..core.transforms_interface import ImageOnlyTransform, ScaleFloatType, to_tuple
label_desc: Use image node_id 1 for calling a global function with example usage: fourier_domain_adaptation(img, target_img, beta) and returns: src_image_transformed