code: def transform_to_affine(streams, header, affine):
      try:
          from dipy.tracking.utils import transform_tracking_output
      except ImportError:
          from dipy.tracking.utils import (
              move_streamlines as transform_tracking_output,
          )
  
      rotation, scale = np.linalg.qr(affine)
      streams = transform_tracking_output(streams, rotation)
      scale[0:3, 0:3] = np.dot(
          scale[0:3, 0:3], np.diag(1.0 / header["voxel_size"])
      )
      scale[0:3, 3] = abs(scale[0:3, 3])
      streams = transform_tracking_output(streams, scale)
      return streams
  
imports: import os.path
  import nibabel
  import numpy
  from nibabel.volumeutils import native_code
  from nibabel.orientations import aff2axcodes
  from ...None import logging
  from ...utils.filemanip import split_filename
  from ..base import TraitedSpec, File, isdefined
  from ..dipy.base import DipyBaseInterface, HAVE_DIPY
label_desc: Use image node_id 3 for calling a global function with example usage: transform_to_affine(streams, header, affine) and returns: streams