class_docstr: Creates  a  connectivity  matrix  using a 3D label image (the target image)
  and a set of streamlines. The connectivity matrix records how many stream-
  lines connect each pair of targets, and optionally the mean tractwise
  statistic (eg tract-averaged FA, or length).
  
  The output is a comma separated variable file or files. The first row of
  the output matrix is label names. Label names may be defined by the user,
  otherwise  they  are assigned based on label intensity.
  
  Starting  from the seed point, we move along the streamline until we find
  a point in a labeled region. This is done in both directions from the seed
  point. Streamlines are counted if they connect two target regions, one on
  either side of the seed point. Only the labeled region closest to the seed
  is counted, for example if the  input contains two streamlines: ::
  
       1: A-----B------SEED---C
       2: A--------SEED-----------
  
  then the output would be ::
  
       A,B,C
       0,0,0
       0,0,1
       0,1,0
  
  There  are  zero  connections  to A because in streamline 1, the connection
  to B is closer to the seed than the connection to A, and in streamline 2
  there is no region reached in the other direction.
  
  The connected target regions can have the same label, as long as the seed
  point is outside of the labeled region and both ends connect to the same
  label (which may  be in different locations). Therefore this is allowed: ::
  
       A------SEED-------A
  
  Such fibers will add to the diagonal elements of the matrix. To remove
  these entries, run procstreamlines with -endpointfile before running conmat.
  
  If the seed point is inside a labeled region, it counts as one end of the
  connection.  So ::
  
       ----[SEED inside A]---------B
  
  counts as a connection between A and B, while ::
  
       C----[SEED inside A]---------B
  
  counts as a connection between A and C, because C is closer to the seed point.
  
  In all cases, distance to the seed point is defined along the streamline path.
  
  Examples
  --------
  To create a standard connectivity matrix based on streamline counts.
  
  >>> import nipype.interfaces.camino as cam
  >>> conmat = cam.Conmat()
  >>> conmat.inputs.in_file = 'tracts.Bdouble'
  >>> conmat.inputs.target_file = 'atlas.nii.gz'
  >>> conmat.run()        # doctest: +SKIP
  
  To create a standard connectivity matrix and mean tractwise FA statistics.
  
  >>> import nipype.interfaces.camino as cam
  >>> conmat = cam.Conmat()
  >>> conmat.inputs.in_file = 'tracts.Bdouble'
  >>> conmat.inputs.target_file = 'atlas.nii.gz'
  >>> conmat.inputs.scalar_file = 'fa.nii.gz'
  >>> conmat.tract_stat         = 'mean'
  >>> conmat.run()        # doctest: +SKIP
class_docstr_tok: ["Creates","a","connectivity","matrix","using","a","3D","label","image","(","the","target","image",")","and","a","set","of","streamlines",".","The","connectivity","matrix","records","how","many","stream-","lines","connect","each","pair","of","targets",",","and","optionally","the","mean","tractwise","statistic","(","eg","tract-averaged","FA",",","or","length",")",".","The","output","is","a","comma","separated","variable","file","or","files",".","The","first","row","of","the","output","matrix","is","label","names",".","Label","names","may","be","defined","by","the","user",",","otherwise","they","are","assigned","based","on","label","intensity",".","Starting","from","the","seed","point",",","we","move","along","the","streamline","until","we","find","a","point","in","a","labeled","region",".","This","is","done","in","both","directions","from","the","seed","point",".","Streamlines","are","counted","if","they","connect","two","target","regions",",","one","on","either","side","of","the","seed","point",".","Only","the","labeled","region","closest","to","the","seed","is","counted",",","for","example","if","the","input","contains","two","streamlines",":",":",":","1",":","A","--","--","-B","--","--","--","SEED","--","-C","2",":","A","--","--","--","--","SEED","--","--","--","--","--","-","then","the","output","would","be",":",":","A",",","B",",","C","0,0,0","0,0,1","0,1,0","There","are","zero","connections","to","A","because","in","streamline","1",",","the","connection","to","B","is","closer","to","the","seed","than","the","connection","to","A",",","and","in","streamline","2","there","is","no","region","reached","in","the","other","direction",".","The","connected","target","regions","can","have","the","same","label",",","as","long","as","the","seed","point","is","outside","of","the","labeled","region","and","both","ends","connect","to","the","same","label","(","which","may","be","in","different","locations",")",".","Therefore","this","is","allowed",":",":",":","A","--","--","--","SEED","--","--","--","-A","Such","fibers","will","add","to","the","diagonal","elements","of","the","matrix",".","To","remove","these","entries",",","run","procstreamlines","with","-endpointfile","before","running","conmat",".","If","the","seed","point","is","inside","a","labeled","region",",","it","counts","as","one","end","of","the","connection",".","So",":",":","--","--","[","SEED","inside","A","]","--","--","--","--","-B","counts","as","a","connection","between","A","and","B",",","while",":",":","C","--","--","[","SEED","inside","A","]","--","--","--","--","-B","counts","as","a","connection","between","A","and","C",",","because","C","is","closer","to","the","seed","point",".","In","all","cases",",","distance","to","the","seed","point","is","defined","along","the","streamline","path",".","Examples","--","--","--","--","To","create","a","standard","connectivity","matrix","based","on","streamline","counts",".",">",">",">","import","nipype.interfaces.camino","as","cam",">",">",">","conmat","=","cam.Conmat","(",")",">",">",">","conmat.inputs.in_file","=","'tracts.Bdouble'",">",">",">","conmat.inputs.target_file","=","'atlas.nii.gz'",">",">",">","conmat.run","(",")","#","doctest",":","+SKIP","To","create","a","standard","connectivity","matrix","and","mean","tractwise","FA","statistics",".",">",">",">","import","nipype.interfaces.camino","as","cam",">",">",">","conmat","=","cam.Conmat","(",")",">",">",">","conmat.inputs.in_file","=","'tracts.Bdouble'",">",">",">","conmat.inputs.target_file","=","'atlas.nii.gz'",">",">",">","conmat.inputs.scalar_file","=","'fa.nii.gz'",">",">",">","conmat.tract_stat","=","'mean'",">",">",">","conmat.run","(",")","#","doctest",":","+SKIP"]
code: def _gen_outfilename(self):
      return self._gen_outputroot()
  
file_path: nipype/nipype/interfaces/camino/connectivity.py
imports: import os
  from ...utils.filemanip import split_filename
  from ..base import traits, TraitedSpec, File, CommandLine, CommandLineInputSpec, isdefined
label_desc: Use image node_id 2 for calling the Conmat obj's underlying member method code with example usage: obj._gen_outfilename() and returns: self