SWC to VTK converter for visualizing neurons and neural circuit simulations in ParaView. This software helps making beautiful visualization of large scale multi-compartmental neuron simulations with a parallelized environment. If you need any further information, please check http://daisukemiyamoto.github.io/swc2vtk/ .
- tqdm
- numpy
PyVTK
- $ pip install swc2vtk
import swc2vtk
vtkgen = swc2vtk.VtkGenerator()
vtkgen.add_swc('simple.swc')
vtkgen.write_vtk('simple.vtk')
import swc2vtk
vtkgen = swc2vtk.VtkGenerator()
vtkgen.add_swc('simple.swc')
vtkgen.add_swc('simple1.swc')
vtkgen.add_swc('simple2.swc')
vtkgen.write_vtk('combined.vtk')
import swc2vtk
vtkgen = swc2vtk.VtkGenerator()
vtkgen.add_swc('simple1.swc')
vtkgen.write_vtk('simple1.vtk', fixedval=0.5)
vtkgen2 = swc2vtk.VtkGenerator()
vtkgen2.add_swc('simple2.swc')
vtkgen2.write_vtk('simple2.vtk', fixedval=1.0)
import swc2vtk
vtkgen = swc2vtk.VtkGenerator()
vtkgen.add_swc('simple.swc')
vtkgen.add_swc('simple1.swc')
vtkgen.add_swc('simple2.swc')
vtkgen.write_vtk('combined.vtk', coloring=True)
import swc2vtk
vtkgen = swc2vtk.VtkGenerator()
vtkgen.add_swc('simple.swc')
vtkgen.add_datafile('result.dat')
vtkgen.write_vtk('simple.vtk')
- data example
each rows correspondence to SWC compartments
-65.0
-65.0
-65.0
-65.0
- data output example for NEURON
proc saveData() { local i localobj outfile strdef filename
filename = $s1
printf("filename: %s\n", filename)
outfile = new File()
outfile.wopen(filename)
for(i=0; i<SectionNum; i=i 1){
access Dend[i]
outfile.printf("%f\n", v)
}
outfile.printf("\n")
outfile.close()
}
import swc2vtk
vtkgen = swc2vtk.VtkGenerator()
vtkgen.add_swc('simple.swc')
vtkgen.add_datafile('result1.dat')
vtkgen.write_vtk('simple1.vtk')
vtkgen.clear_datafile()
vtkgen.add_datafile('result2.dat')
vtkgen.write_vtk('simple2.vtk')
vtkgen.clear_datafile()
vtkgen.add_datafile('result3.dat')
vtkgen.write_vtk('simple3.vtk')