Ajayrama Kumaraswamy, 17.10.2014
Scripts for vizualizing a SWC files in Blender
'blenderHelper.py' contains classes for representing a SWC model in Blender
The other four files are examples of how to use this class.
Mainly tested on a Ubuntu Linux Machine. Needs Blender to be installed.
- The argument triplet in "abc.importWholeSWC([0, 0, 1])" is the RGB value of the color with which the neuron will be colored
- To use, change the string in sys.path.append('...') to the path which contains blenderHelper.py
- Then, type in a terminal, "blender --python vizSWC.py -- /path/to/SWC/file".
- To use, specify the paths to the SWC files in the list 'swcs'.
- Specify the colors with which the neurons are to be colored in 'cols'. The neuron to color mapping is element wise one to one.
- Change the string in sys.path.append('...') to the path which contains blenderHelper.py
- Then, in a terminal, enter "blender --python compareNrnsBlender.py"
- An SSWC file contains an extra column in addition to the 7 in a normal SWC file. This extra column must contain only integers from 0 to 7.
- The array baseCols is a color map.
- If a segment has the value 3 in it's 8th column, then it will be coloured with the 4th color in the colormap in baseCols.
- Materials are internally created corresponding to each color in baseCols. The "emit" and transparency "alpha"s of these materials can also be specified using the arrays "emits" and "alphas"
- To use, change the string in sys.path.append('...') to the path which contains blenderHelper.py
- Then in a terminal, enter "blender --python vizSSWC.py -- /path/to/SWC/file"
vizSSWC_schematic.py: Similar to vizSSWC.py but with the radii of all the segments set to a single specified value.
- The radius is specified as the right hand side of "swcData[:, 5] = 0.01"
- To use, change the string in sys.path.append('...') to the path which contains blenderHelper.py
- Then, in a terminal, enter "blender --python vizSSWC.py -- /path/to/SWC/file"
- To use, specify the paths to the SSWC files in the list 'swcFiles'
- Change the string in sys.path.append('...') to the path which contains blenderHelper.py
- Then, in a terminal, enter "blender --python vizSSWCMultiple.py"
- Zoom View: Mouse wheel scroll
- 3D rotate View: Mouse wheel click + drag
- Select Object: Right click(hold Shift to select more)
- Move Object: Select object, press G, move object and left click to fix position
- Rotate Object: Select object, press R, rotate object and left click to fix position