SWC to VTK converter for visualizing neurons and neural circuit simulations in ParaView.
This software helps making easy and beautiful visualization of large scale multi-compartmental neuron simulation with highly parallelized environments.
- 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('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
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')
import swc2vtk
vtkgen = swc2vtk.VtkGenerator()
vtkgen.add_swc('simple.swc')
vtkgen.write_volume_vtk('volume.vtk')
Draw Mode
change SWC compartment drawing method. Largeer number is better.0
: simple cylinder1
: one cylinder with variable top surface2
: one cylinder with three cell mode3
: one cylinder with a hemisphere
import swc2vtk
vtkgen = swc2vtk.VtkGenerator()
vtkgen.add_swc('simple.swc')
vtkgen.set_draw_mode(4)
vtkgen.write_vtk('simple.vtk')
Division Number
import swc2vtk
vtkgen = swc2vtk.VtkGenerator()
vtkgen.add_swc('simple.swc')
vtkgen.set_division_number(20)
vtkgen.write_vtk('simple.vtk')
normalize_diam