Exports tree intree to the .swc format, a matrix with 7 columns:

[inode R X Y Z D/2 idpar]

node index inode is usually from 1..N and idpar is the direct parent index. The root has an idpar of -1. Fills in region index R if R is missing.

Example:

>> swc_tree (sample2_tree)

produces:

# TREES toolbox tree - tree
# written by an automatic procedure "swc_tree" part of
# the TREES package in MATLAB
# copyright 2009 Hermann Cuntz
#
# inode R X Y Z D/2 idpar
1 2 0.00000000 0.00000000 0.00000000 2.12528117 -1
2 2 8.29304961 4.44755127 -4.46045613 1.74844749 1
3 2 17.40876415 8.80206655 -3.39415938 1.42701764 2
4 2 26.90050540 10.54155965 -0.95626440 1.24193528 3
5 2 36.06519913 13.03275911 1.94061621 1.02025571 4
6 2 43.93899105 16.79337615 3.22598031 0.84536559 5
7 2 53.10549509 18.73244431 5.26125456 0.80092718 6
8 2 63.62347087 17.73353041 8.25362875 0.68685660 7
9 2 46.75945383 23.43321561 7.46333851 0.63360263 6
10 2 19.55373994 18.37988646 -0.46949875 1.10702919 3
11 2 22.96179913 27.48763086 2.41729942 0.96010238 10
12 2 27.01621437 33.48111427 2.79183599 0.81713800 11
13 2 35.71264128 36.71289453 2.66823593 0.66393903 12
14 1 31.24690854 43.64653220 2.81017550 0.73654865 12
15 1 28.66148433 20.14267570 -0.28834723 0.64516327 10

Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License