code: def F_affine3d(x, matrix, center=True):
      A = matrix[:3, :3]
      b = matrix[:3, 3]
  
      # make a meshgrid of normal coordinates
      with torch.no_grad:
          coords = th_iterproduct(
              x.size(1), x.size(2), x.size(3)
          ).float()
  
      if center:
          # shift the coordinates so center is the origin
          coords[:, 0] = coords[:, 0] - (x.size(1) / 2.0 + 0.5)
          coords[:, 1] = coords[:, 1] - (x.size(2) / 2.0 + 0.5)
          coords[:, 2] = coords[:, 2] - (x.size(3) / 2.0 + 0.5)
  
      # apply the coordinate transformation
      new_coords = F.linear(coords, A, b)
  
      if center:
          # shift the coordinates back so origin is origin
          new_coords[:, 0] = new_coords[:, 0] + (x.size(1) / 2.0 + 0.5)
          new_coords[:, 1] = new_coords[:, 1] + (x.size(2) / 2.0 + 0.5)
          new_coords[:, 2] = new_coords[:, 2] + (x.size(3) / 2.0 + 0.5)
  
      # map new coordinates using bilinear interpolation
      x_transformed = F_trilinear_interp3d(x, new_coords)
  
      return x_transformed
  
file_path: pywick/pywick/functions/affine.py
imports: import torch
  import torch.nn.functional
  from ..utils import th_iterproduct, th_flatten
label_desc: Use image node_id 5 for calling a global function with example usage: F_affine3d(x, matrix, center) and returns: x_transformed