docstr: Concatenate multiple tractograms into one.
  
  Parameters
  ----------
  tractogram_list : variable string
      The stateful tractogram filenames to concatenate
  reference : string, optional
      Reference anatomy for tck/vtk/fib/dpy file.
      support (.nii or .nii.gz).
  delete_dpv : bool, optional
      Delete dpv keys that do not exist in all the provided TrxFiles
  delete_dps : bool, optional
      Delete dps keys that do not exist in all the provided TrxFile
  delete_groups : bool, optional
      Delete all the groups that currently exist in the TrxFiles
  check_space_attributes : bool, optional
      Verify that dimensions and size of data are similar between all the
      TrxFiles
  preallocation : bool, optional
      Preallocated TrxFile has already been generated and is the first
      element in trx_list (Note: delete_groups must be set to True as
      well)
  out_dir : string, optional
      Output directory. (default current directory)
  out_extension : string, optional
      Extension of the resulting tractogram
  out_tractogram : string, optional
      Name of the resulting tractogram
docstr_tok: ["Concatenate","multiple","tractograms","into","one",".","Parameters","--","--","--","--","--","tractogram_list",":","variable","string","The","stateful","tractogram","filenames","to","concatenate","reference",":","string",",","optional","Reference","anatomy","for","tck\/vtk\/fib\/dpy","file",".","support","(",".nii","or",".nii.gz",")",".","delete_dpv",":","bool",",","optional","Delete","dpv","keys","that","do","not","exist","in","all","the","provided","TrxFiles","delete_dps",":","bool",",","optional","Delete","dps","keys","that","do","not","exist","in","all","the","provided","TrxFile","delete_groups",":","bool",",","optional","Delete","all","the","groups","that","currently","exist","in","the","TrxFiles","check_space_attributes",":","bool",",","optional","Verify","that","dimensions","and","size","of","data","are","similar","between","all","the","TrxFiles","preallocation",":","bool",",","optional","Preallocated","TrxFile","has","already","been","generated","and","is","the","first","element","in","trx_list","(","Note",":","delete_groups","must","be","set","to","True","as","well",")","out_dir",":","string",",","optional","Output","directory",".","(","default","current","directory",")","out_extension",":","string",",","optional","Extension","of","the","resulting","tractogram","out_tractogram",":","string",",","optional","Name","of","the","resulting","tractogram"]
code: def run(
      self,
      tractogram_files,
      reference=None,
      delete_dpv=False,
      delete_dps=False,
      delete_groups=False,
      check_space_attributes=True,
      preallocation=False,
      out_dir="",
      out_extension="trx",
      out_tractogram="concatenated_tractogram",
  ):
      """Concatenate multiple tractograms into one.
  
      Parameters
      ----------
      tractogram_list : variable string
          The stateful tractogram filenames to concatenate
      reference : string, optional
          Reference anatomy for tck/vtk/fib/dpy file.
          support (.nii or .nii.gz).
      delete_dpv : bool, optional
          Delete dpv keys that do not exist in all the provided TrxFiles
      delete_dps : bool, optional
          Delete dps keys that do not exist in all the provided TrxFile
      delete_groups : bool, optional
          Delete all the groups that currently exist in the TrxFiles
      check_space_attributes : bool, optional
          Verify that dimensions and size of data are similar between all the
          TrxFiles
      preallocation : bool, optional
          Preallocated TrxFile has already been generated and is the first
          element in trx_list (Note: delete_groups must be set to True as
          well)
      out_dir : string, optional
          Output directory. (default current directory)
      out_extension : string, optional
          Extension of the resulting tractogram
      out_tractogram : string, optional
          Name of the resulting tractogram
  
      """
      io_it = self.get_io_iterator()
  
      trx_list = []
      has_group = False
      for fpath, oext, otracks in io_it:
          if fpath.lower().endswith(".trx") or fpath.lower().endswith(
              ".trk"
          ):
              reference = "same"
  
          if not reference:
              raise ValueError(
                  "No reference provided. It is needed for tck,"
                  "fib, dpy or vtk files"
              )
  
          tractogram_obj = load_tractogram(
              fpath, reference, bbox_valid_check=False
          )
  
          if not isinstance(tractogram_obj, tmm.TrxFile):
              tractogram_obj = tmm.TrxFile.from_sft(tractogram_obj)
          elif len(tractogram_obj.groups):
              has_group = True
          trx_list.append(tractogram_obj)
  
      trx = concatenate_tractogram(
          trx_list,
          delete_dpv=delete_dpv,
          delete_dps=delete_dps,
          delete_groups=delete_groups or not has_group,
          check_space_attributes=check_space_attributes,
          preallocation=preallocation,
      )
  
      valid_extensions = ["trk", "trx", "tck", "fib", "dpy", "vtk"]
      if out_extension.lower() not in valid_extensions:
          raise ValueError(
              "Invalid extension. Valid extensions are: "
              "{0}".format(valid_extensions)
          )
  
      out_fpath = os.path.join(
          out_dir, f"{out_tractogram}.{out_extension}"
      )
      save_tractogram(trx.to_sft(), out_fpath, bbox_valid_check=False)
  
imports: import importlib
  import os
  import sys
  import logging
  from inspect import getmembers, isfunction
  import warnings
  import trx.trx_file_memmap
  import numpy
  from dipy.io.image import load_nifti, save_nifti
  from dipy.io.streamline import load_tractogram, save_tractogram
  from dipy.reconst.shm import convert_sh_descoteaux_tournier
  from dipy.tracking.streamlinespeed import length
  from dipy.utils.tractogram import concatenate_tractogram
  from dipy.workflows.workflow import Workflow
label_desc: Use image node_id 2 for calling the ConcatenateTractogramFlow obj's underlying member method code with example usage: obj.run(tractogram_files, reference, delete_dpv, delete_dps, delete_groups, check_space_attributes, preallocation, out_dir, out_extension, out_tractogram) without return types