code: def test_adc():
      """
      Test the implementation of the calculation of apparent diffusion
      coefficient
      """
      data, gtab = dsi_voxels()
      dm = dti.TensorModel(gtab, "LS")
      mask = np.zeros(data.shape[:-1], dtype=bool)
      mask[0, 0, 0] = True
      dtifit = dm.fit(data)
      # The ADC in the principal diffusion direction should be equal to the AD in
      # each voxel:
  
      pdd0 = dtifit.evecs[0, 0, 0, 0]
      sphere_pdd0 = dps.Sphere(x=pdd0[0], y=pdd0[1], z=pdd0[2])
      npt.assert_array_almost_equal(
          dtifit.adc(sphere_pdd0)[0, 0, 0],
          dtifit.ad[0, 0, 0],
          decimal=5,
      )
  
      # Test that it works for cases in which the data is 1D
      dtifit = dm.fit(data[0, 0, 0])
      sphere_pdd0 = dps.Sphere(x=pdd0[0], y=pdd0[1], z=pdd0[2])
      npt.assert_array_almost_equal(
          dtifit.adc(sphere_pdd0), dtifit.ad, decimal=5
      )
  
imports: import warnings
  import numpy
  import numpy.testing
  import scipy.optimize
  import dipy.reconst.dti
  from dipy.io.gradients import read_bvals_bvecs
  from dipy.reconst.dti import ols_resort_msg, axial_diffusivity, color_fa, fractional_anisotropy, from_lower_triangular, geodesic_anisotropy, lower_triangular, mean_diffusivity, radial_diffusivity, TensorModel, trace, linearity, planarity, sphericity, decompose_tensor, _decompose_tensor_nan
  from dipy.io.image import load_nifti_data
  from dipy.data import get_fnames, dsi_voxels, get_sphere
  from dipy.core.subdivide_octahedron import create_unit_sphere
  import dipy.core.gradients
  import dipy.core.sphere
  from dipy.sims.voxel import single_tensor
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 21 for calling a global function with example usage: test_adc() without return types