code: def create_nifti_header(affine, dimensions, voxel_sizes):
      """Write a standard nifti header from spatial attribute"""
      new_header = nib.Nifti1Header()
      new_header.set_sform(affine)
      new_header["dim"][1:4] = dimensions
      new_header["pixdim"][1:4] = voxel_sizes
  
      new_header.affine = new_header.get_best_affine()
  
      return new_header
  
imports: import logging
  import numbers
  import os
  from dipy.utils.optpkg import optional_package
  import dipy
  import nibabel
  from nibabel.streamlines import detect_format
  from nibabel import Nifti1Image
  import numpy
  from trx import trx_file_memmap
label_desc: Use image node_id 10 for calling a global function with example usage: create_nifti_header(affine, dimensions, voxel_sizes) and returns: new_header