code: def test_cc_factors_3d():
      r"""
      Compares the output of the optimized function to compute the cross-
      correlation factors against a direct (not optimized, but less error prone)
      implementation.
      """
      a = np.array(range(20 * 20 * 20), dtype=floating).reshape(
          20, 20, 20
      )
      b = np.array(range(20 * 20 * 20)[::-1], dtype=floating).reshape(
          20, 20, 20
      )
      a /= a.max()
      b /= b.max()
      for radius in [0, 1, 3, 6]:
          factors = np.asarray(
              cc.precompute_cc_factors_3d(a, b, radius)
          )
          expected = np.asarray(
              cc.precompute_cc_factors_3d_test(a, b, radius)
          )
          assert_array_almost_equal(factors, expected, decimal=5)
  
file_path: dipy/dipy/align/tests/test_crosscorr.py
imports: import numpy
  from numpy.testing import assert_array_almost_equal
  from dipy.align import floating
  from dipy.align import crosscorr
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 2 for calling a global function with example usage: test_cc_factors_3d() without return types