swc2vtk package

Submodules

swc2vtk.genprimitives module

Created on Thu Jun 9 12:37:20 2016

@author: nebula

class swc2vtk.genprimitives.GenPrimitives
static base_sphere(div=10)
static cuboid()
static cylinder(div=8, top_face_diam=1.0)
static cylinder_3cell(div=8, top_face_diam=1.0)
static hemisphere(div=10)
static hemisphere_cylinder(div=8, top_face_diam=1.0, height=1.0, radius=1.0)
static line(pos1=(0, 0, 0), pos2=(1, 0, 0), data=0.0, point_start=0)
classmethod sphere(pos=(0, 0, 0), size=1.0, data=0.0, point_start=0)

swc2vtk.swc module

Created on Thu Jun 9 15:52:38 2016

@author: nebula

class swc2vtk.swc.Swc(filename='')
invert(x=False, y=False, z=False)
load_swc(filename)
shift(x=0.0, y=0.0, z=0.0)

swc2vtk.vtkgenerator module

Created on Thu Jun 9 12:37:20 2016

@author: nebula

class swc2vtk.vtkgenerator.VtkGenerator
add_cylinder(pos_x=0, pos_y=0, pos_z=0, radius=1.0, height=1.0, rot_y=0, rot_z=0, data=0.0, radius_ratio=1.0)
add_cylinder_p2p(pos1=(0, 0, 0), pos2=(2, 0, 0), size=1.0, data=0, radius_ratio=1.0)
add_datafile(datafilename)
add_mark(pos=(0, 0, 0), size=1.0, data=0.0)
add_swc(swc_filename, shift_x=0.0, shift_y=0.0, shift_z=0.0, inv_x=False, inv_y=False, inv_z=False)

add swc file for generating vtk file

Parameters:
  • swc_filename – swc filename
  • shift_x
  • shift_y
  • shift_z
  • inv_x
  • inv_y
  • inv_z
Returns:

add_swc_connection(swc_index1, swc_compartment1, swc_index2, swc_compartment2, size=1.0, data=1.0)
add_swc_mark(swc_index, compartment_index, size=1.0, data=0.0)
clear_datafile()
convert_swc(diam_ratio=1.0, normalize_diam=False)
header_base = '# vtk DataFile Version 3.0\nSWC2VTK\nASCII\nDATASET UNSTRUCTURED_GRID\n'
set_draw_mode(draw_mode)
show_state()
volume_header_base = '# vtk DataFile Version 1.0\nSWC2VTK VOLUME\nASCII\nDATASET STRUCTURED_POINTS\n'
write_annotation_vtk(filename)
write_swc(filename, swc_index=0, comment='swc2vtk')
write_volume_vtk(filename, origin=(0.0, 0.0, 0.0), ratio=(1.0, 1.0, 1.0), div=(256, 256, 64))
write_vtk(filename, fixedval=None, datatitle='filedata', movingval=False, coloring=False, diam_ratio=1.0, normalize_diam=False, radius_data=False, type_data=False)

generate and write vtk to file

Parameters:
  • filename (text) – Output VTK filename
  • fixedval (float) – add fixed value to CELL_DATA in VTK file
  • datatitle (text) – change title of CELL_DATA from appended data file
  • movingval (bool) – add moving value to CELL_DATA in VTK file
  • coloring (bool) – add coloring data to CELL_DATA in VTK file
  • diam_ratio (float) – multiply diam_ratio to all diameter of SWC compartments
  • normalize_diam (bool) – sqrt(diam) to normalize diameter of SWC compartments
  • radius_data (bool) – add radius information of SWC compartments to CELL_DATA in VTK file
  • type_data (bool) – Output type information of SWC compartments to CELL_DATA in VTK file
Returns:

Module contents