code: def is_reference_info_valid(
      affine, dimensions, voxel_sizes, voxel_order
  ):
      """Validate basic data type and value of spatial attribute.
  
      Does not ensure that voxel_sizes and voxel_order are self-coherent with
      the affine.
      Only verify the following:
          - affine is of the right type (float) and dimension (4,4)
          - affine contain values in the rotation part
          - dimensions is of right type (int) and length (3)
          - voxel_sizes is of right type (float) and length (3)
          - voxel_order is of right type (str) and length (3)
      The listed parameters are what is expected, provide something else and this
      function should fail (cover common mistakes).
  
      Parameters
      ----------
      affine: ndarray (4,4)
          Transformation of VOX to RASMM
      dimensions: ndarray (3,), int16
          Volume shape for each axis
      voxel_sizes:  ndarray (3,), float32
          Size of voxel for each axis
      voxel_order: string
          Typically 'RAS' or 'LPS'
  
      Returns
      -------
      output : bool
          Does the input represent a valid 'state' of spatial attribute
  
      """
      all_valid = True
      only_3d_warning = False
  
      if not affine.shape == (4, 4):
          all_valid = False
          logging.warning("Transformation matrix must be 4x4")
  
      if not affine[0:3, 0:3].any():
          all_valid = False
          logging.warning("Rotation matrix cannot be all zeros")
  
      if not len(dimensions) >= 3:
          all_valid = False
          only_3d_warning = True
  
      for i in dimensions:
          if not isinstance(i, numbers.Integral):
              all_valid = False
              logging.warning("Dimensions must be int.")
          if i <= 0:
              all_valid = False
              logging.warning("Dimensions must be above 0.")
  
      if not len(voxel_sizes) >= 3:
          all_valid = False
          only_3d_warning = True
      for i in voxel_sizes:
          if not isinstance(i, numbers.Number):
              all_valid = False
              logging.warning("Voxel size must be int/float.")
          if i <= 0:
              all_valid = False
              logging.warning("Voxel size must be above 0.")
  
      if not len(voxel_order) >= 3:
          all_valid = False
          only_3d_warning = True
      for i in voxel_order:
          if not isinstance(i, str):
              all_valid = False
              logging.warning("Voxel order must be string/char.")
          if i not in ["R", "A", "S", "L", "P", "I"]:
              all_valid = False
              logging.warning("Voxel order does not follow convention.")
  
      if only_3d_warning:
          logging.warning(
              "Only 3D (and above) reference are considered valid."
          )
  
      return all_valid
  
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 5 for calling a global function with example usage: is_reference_info_valid(affine, dimensions, voxel_sizes, voxel_order) and returns: all_valid