code: def test_decfa():
      data_orig = np.zeros((4, 4, 4, 3))
      data_orig[0, 0, 0] = np.array([1, 0, 0])
      img_orig = nib.Nifti1Image(data_orig, np.eye(4))
      img_new = decfa(img_orig)
      data_new = np.asanyarray(img_new.dataobj)
      assert data_new[0, 0, 0] == np.array(
          (1, 0, 0),
          dtype=np.dtype(
              [("R", "uint8"), ("G", "uint8"), ("B", "uint8")]
          ),
      )
      assert data_new.dtype == np.dtype(
          [("R", "uint8"), ("G", "uint8"), ("B", "uint8")]
      )
  
      round_trip = decfa_to_float(img_new)
      data_rt = np.asanyarray(round_trip.dataobj)
      assert np.all(data_rt == data_orig)
  
      data_orig = np.zeros((4, 4, 4, 3))
      data_orig[0, 0, 0] = np.array([0.1, 0, 0])
      img_orig = nib.Nifti1Image(data_orig, np.eye(4))
      img_new = decfa(img_orig, scale=True)
      data_new = np.asanyarray(img_new.dataobj)
      assert data_new[0, 0, 0] == np.array(
          (25, 0, 0),
          dtype=np.dtype(
              [("R", "uint8"), ("G", "uint8"), ("B", "uint8")]
          ),
      )
      assert data_new.dtype == np.dtype(
          [("R", "uint8"), ("G", "uint8"), ("B", "uint8")]
      )
  
      round_trip = decfa_to_float(img_new)
      data_rt = np.asanyarray(round_trip.dataobj)
      assert data_rt.shape == (4, 4, 4, 3)
      assert np.all(data_rt[0, 0, 0] == np.array([25, 0, 0]))
  
imports: import tempfile
  from urllib.error import URLError, HTTPError
  import pytest
  import nibabel
  import numpy
  from numpy.testing import assert_allclose, assert_array_equal, assert_
  import trx.trx_file_memmap
  from dipy.data import get_fnames
  from dipy.io.streamline import load_tractogram
  from dipy.io.utils import create_nifti_header, decfa, decfa_to_float, get_reference_info, is_reference_info_valid, read_img_arr_or_path
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 3 for calling a global function with example usage: test_decfa() without return types