class_docstr: Convenience class to encapsulate TCK file format.
  
  Notes
  -----
  MRtrix (so its file format: TCK) considers streamlines coordinates
  to be in world space (RAS+ and mm space). MRtrix refers to that space
  as the "real" or "scanner" space [#]_.
  
  Moreover, when streamlines are mapped back to voxel space [#]_, a
  streamline point located at an integer coordinate (i,j,k) is considered
  to be at the center of the corresponding voxel. This is in contrast with
  TRK's internal convention where it would have referred to a corner.
  
  NiBabel's streamlines internal representation follows the same
  convention as MRtrix.
  
  .. [#] http://www.nitrc.org/pipermail/mrtrix-discussion/2014-January/000859.html
  .. [#] http://nipy.org/nibabel/coordinate_systems.html#voxel-coordinates-are-in-voxel-space
class_docstr_tok: ["Convenience","class","to","encapsulate","TCK","file","format",".","Notes","--","--","-","MRtrix","(","so","its","file","format",":","TCK",")","considers","streamlines","coordinates","to","be","in","world","space","(","RAS+","and","mm","space",")",".","MRtrix","refers","to","that","space","as","the","``","real","''","or","``","scanner","''","space","[","#","]","_",".","Moreover",",","when","streamlines","are","mapped","back","to","voxel","space","[","#","]","_",",","a","streamline","point","located","at","an","integer","coordinate","(","i",",","j",",","k",")","is","considered","to","be","at","the","center","of","the","corresponding","voxel",".","This","is","in","contrast","with","TRK","'s","internal","convention","where","it","would","have","referred","to","a","corner",".","NiBabel","'s","streamlines","internal","representation","follows","the","same","convention","as","MRtrix",".","..","[","#","]","http",":","\/\/www.nitrc.org\/pipermail\/mrtrix-discussion\/2014-January\/000859.html","..","[","#","]","http",":","\/\/nipy.org\/nibabel\/coordinate_systems.html","#","voxel-coordinates-are-in-voxel-space"]
docstr: Parameters
  ----------
  tractogram : :class:`Tractogram` object
      Tractogram that will be contained in this :class:`TckFile`.
  header : None or dict, optional
      Metadata associated to this tractogram file. If None, make
      default empty header.
  
  Notes
  -----
  Streamlines of the tractogram are assumed to be in *RAS+* and *mm*
  space. It is also assumed that when streamlines are mapped back to
  voxel space, a streamline point located at an integer coordinate
  (i,j,k) is considered to be at the center of the corresponding voxel.
  This is in contrast with TRK's internal convention where it would
  have referred to a corner.
docstr_tok: ["Parameters","--","--","--","--","--","tractogram",":",":","class",":","`","Tractogram","`","object","Tractogram","that","will","be","contained","in","this",":","class",":","`","TckFile","`",".","header",":","None","or","dict",",","optional","Metadata","associated","to","this","tractogram","file",".","If","None",",","make","default","empty","header",".","Notes","--","--","-","Streamlines","of","the","tractogram","are","assumed","to","be","in","*","RAS+","*","and","*","mm","*","space",".","It","is","also","assumed","that","when","streamlines","are","mapped","back","to","voxel","space",",","a","streamline","point","located","at","an","integer","coordinate","(","i",",","j",",","k",")","is","considered","to","be","at","the","center","of","the","corresponding","voxel",".","This","is","in","contrast","with","TRK","'s","internal","convention","where","it","would","have","referred","to","a","corner","."]
code: def __init__(self, tractogram, header=None):
      """
      Parameters
      ----------
      tractogram : :class:`Tractogram` object
          Tractogram that will be contained in this :class:`TckFile`.
      header : None or dict, optional
          Metadata associated to this tractogram file. If None, make
          default empty header.
  
      Notes
      -----
      Streamlines of the tractogram are assumed to be in *RAS+* and *mm*
      space. It is also assumed that when streamlines are mapped back to
      voxel space, a streamline point located at an integer coordinate
      (i,j,k) is considered to be at the center of the corresponding voxel.
      This is in contrast with TRK's internal convention where it would
      have referred to a corner.
      """
      super().__init__(tractogram, header)
  
imports: import os
  import warnings
  from contextlib import suppress
  import numpy
  from nibabel.openers import Opener
  from .array_sequence import ArraySequence
  from .header import Field
  from .tractogram import LazyTractogram, Tractogram, TractogramItem
  from .tractogram_file import DataError, DataWarning, HeaderError, HeaderWarning, TractogramFile
  from .utils import peek_next
label_desc: Use image node_id 1 to create a new TckFile object from inherited base classes: TractogramFile with example: obj = TckFile(tractogram, header)