code: def test_dtd_covariance():
      """Test diffusion tensor distribution covariance calculation."""
  
      # Input validation
      npt.assert_raises(ValueError, qti.dtd_covariance, np.arange(2))
      npt.assert_raises(
          ValueError, qti.dtd_covariance, np.zeros((1, 1, 1))
      )
  
      # Covariance of isotropic tensors (Figure 1 in Westin's paper)
      DTD = _isotropic_DTD()
      C = np.zeros((6, 6))
      C[0:3, 0:3] = 0.98116667
      npt.assert_almost_equal(qti.dtd_covariance(DTD), C)
  
      # Covariance of anisotropic tensors (Figure 1 in Westin's paper)
      DTD = _anisotropic_DTD()
      C = np.eye(6) * 2 / 15
      C[0:3, 0:3] = np.array(
          [
              [4 / 45, -2 / 45, -2 / 45],
              [-2 / 45, 4 / 45, -2 / 45],
              [-2 / 45, -2 / 45, 4 / 45],
          ]
      )
      npt.assert_almost_equal(qti.dtd_covariance(DTD), C)
  
imports: import numpy
  import numpy.testing
  import dipy.reconst.qti
  from dipy.core.gradients import gradient_table
  from dipy.sims.voxel import vec2vec_rotmat
  from dipy.core.sphere import disperse_charges, HemiSphere
  from dipy.reconst.dti import fractional_anisotropy
  from dipy.testing.decorators import set_random_number_generator
  from dipy.utils.optpkg import optional_package
label_desc: Use image node_id 10 for calling a global function with example usage: test_dtd_covariance() without return types