code: def aff2rot_zooms(affine):
      """
      Compute a rotation matrix and zooms from 4 x 4 `affine`
  
      Parameters
      ----------
      affine : 4 by 4 array
          An affine transformation matrix
  
      Returns
      -------
      R: 3 by 3 array
         A rotation matrix in 3D
  
      zooms: length 3 1-d array
           Vector with voxel sizes.
      """
      RZS = affine[:3, :3]
      zooms = np.sqrt(np.sum(RZS * RZS, axis=0))
      RS = RZS / zooms
      # Adjust zooms to make RS correspond (below) to a true
      # rotation matrix.
      if npl.det(RS) < 0:
          zooms[0] *= -1
          RS[:, 0] *= -1
      # retrieve rotation matrix from RS with polar decomposition.
      # Discard shears
      P, S, Qs = npl.svd(RS)
      R = np.dot(P, Qs)
      return R, zooms
  
file_path: nipy/nipy/algorithms/registration/scripting.py
imports: import os
  import os.path
  import nibabel
  import nibabel.eulerangles
  import numpy
  import numpy.linalg
  from nibabel.filename_parser import splitext_addext
  from nibabel.optpkg import optional_package
  import nipy.algorithms.slicetiming
  from nipy.io.api import save_image
  from .groupwise_registration import SpaceTimeRealign
label_desc: Use image node_id 2 for calling a global function with example usage: aff2rot_zooms(affine) and returns: R,  zooms