code: def test_tractogram_add_new_data(self):
      # Tractogram with only streamlines
      t = DATA["simple_tractogram"].copy()
      t.data_per_point["fa"] = DATA["fa"]
      t.data_per_point["colors"] = DATA["colors"]
      t.data_per_streamline["mean_curvature"] = DATA["mean_curvature"]
      t.data_per_streamline["mean_torsion"] = DATA["mean_torsion"]
      t.data_per_streamline["mean_colors"] = DATA["mean_colors"]
      assert_tractogram_equal(t, DATA["tractogram"])
  
      # Retrieve tractogram by their index.
      for i, item in enumerate(t):
          assert_tractogram_item_equal(t[i], item)
  
      # Use slicing.
      r_tractogram = t[::-1]
      check_tractogram(
          r_tractogram,
          t.streamlines[::-1],
          t.data_per_streamline[::-1],
          t.data_per_point[::-1],
      )
  
      # Add new data to a tractogram for which its `streamlines` is a view.
      t = Tractogram(DATA["streamlines"] * 2, affine_to_rasmm=np.eye(4))
      t = t[
          : len(DATA["streamlines"])
      ]  # Create a view of `streamlines`
      t.data_per_point["fa"] = DATA["fa"]
      t.data_per_point["colors"] = DATA["colors"]
      t.data_per_streamline["mean_curvature"] = DATA["mean_curvature"]
      t.data_per_streamline["mean_torsion"] = DATA["mean_torsion"]
      t.data_per_streamline["mean_colors"] = DATA["mean_colors"]
      assert_tractogram_equal(t, DATA["tractogram"])
  
imports: import copy
  import operator
  import sys
  import unittest
  import warnings
  from collections import defaultdict
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from ...testing import assert_arrays_equal, clear_and_catch_warnings
  from ..None import tractogram
  from ..tractogram import LazyDict, LazyTractogram, PerArrayDict, PerArraySequenceDict, Tractogram, TractogramItem, is_data_dict, is_lazy_dict
label_desc: Use image node_id 4 for calling the TestTractogram obj's underlying member method code with example usage: obj.test_tractogram_add_new_data() without return types