class_docstr: Convenience class to encapsulate TRK file format.
  
  Notes
  -----
  TrackVis (so its file format: TRK) considers the streamline coordinate
  (0,0,0) to be in the corner of the voxel whereas NiBabel's streamlines
  internal representation (Voxel space) assumes (0,0,0) to be in the
  center of the voxel.
  
  Thus, streamlines are shifted by half a voxel on load and are shifted
  back on save.
docstr: Parameters
  ----------
  tractogram : :class:`Tractogram` object
      Tractogram that will be contained in this :class:`TrkFile`.
  
  header : dict, optional
      Metadata associated to this tractogram file.
  
  Notes
  -----
  Streamlines of the tractogram are assumed to be in *RAS+*
  and *mm* space where coordinate (0,0,0) refers to the center
  of the voxel.
docstr_tok: ["Parameters","--","--","--","--","--","tractogram",":",":","class",":","`","Tractogram","`","object","Tractogram","that","will","be","contained","in","this",":","class",":","`","TrkFile","`",".","header",":","dict",",","optional","Metadata","associated","to","this","tractogram","file",".","Notes","--","--","-","Streamlines","of","the","tractogram","are","assumed","to","be","in","*","RAS+","*","and","*","mm","*","space","where","coordinate","(","0,0,0",")","refers","to","the","center","of","the","voxel","."]
code: def __init__(self, tractogram, header=None):
      """
      Parameters
      ----------
      tractogram : :class:`Tractogram` object
          Tractogram that will be contained in this :class:`TrkFile`.
  
      header : dict, optional
          Metadata associated to this tractogram file.
  
      Notes
      -----
      Streamlines of the tractogram are assumed to be in *RAS+*
      and *mm* space where coordinate (0,0,0) refers to the center
      of the voxel.
      """
      super().__init__(tractogram, header)
  
imports: import os
  import string
  import struct
  import warnings
  import numpy
  import nibabel
  from nibabel.openers import Opener
  from nibabel.orientations import aff2axcodes, axcodes2ornt
  from nibabel.volumeutils import endian_codes, native_code, swapped_code
  from .array_sequence import create_arraysequences_from_generator
  from .header import Field
  from .tractogram import LazyTractogram, Tractogram, TractogramItem
  from .tractogram_file import DataError, HeaderError, HeaderWarning, TractogramFile
  from .utils import peek_next
label_desc: Use image node_id 1 to create a new TrkFile object from inherited base classes: TractogramFile with example: obj = TrkFile(tractogram, header)