code: def nifti1_symmat(image_data, *args, **kwargs):
      """Returns a Nifti1Image with a symmetric matrix intent
  
      Parameters
      ----------
      image_data : array-like
          should have lower triangular elements of a symmetric matrix along the
          last dimension
      all other arguments and keywords are passed to Nifti1Image
  
      Returns
      -------
      image : Nifti1Image
          5d, extra dimensions added before the last. Has symmetric matrix intent
          code
  
      """
      image_data = make5d(image_data)
      last_dim = image_data.shape[-1]
      n = (np.sqrt(1 + 8 * last_dim) - 1) / 2
      if (n % 1) != 0:
          raise ValueError(
              "input_data does not seem to have matrix elements"
          )
  
      image = Nifti1Image(image_data, *args, **kwargs)
      hdr = image.header
      hdr.set_intent("symmetric matrix", (n,))
      return image
  
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 1 for calling a global function with example usage: nifti1_symmat(image_data) and returns: image